mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-07 05:56:41 +02:00
78e4b770fa
Two bugs surfaced when validating the v1.21 fix end-to-end:
1. PlanSkillObservation outcome detection ran 'asked' (any numbered
options list) BEFORE 'plan_ready'. Plan-mode's "Ready to execute?"
confirmation IS a numbered options list (1=auto, 2=manual, ...), so
any skill that successfully reached the native confirmation got
misclassified as 'asked'. Reorder: 'auto_decided' (most specific,
requires AUTO_DECIDE annotation) > 'plan_ready' (next, requires the
"ready to execute" stem) > 'asked' (any remaining numbered list).
2. isPlanReadyVisible and isAutoDecidedVisible regexes only matched
spaced forms ("ready to execute", "(your preference)"). stripAnsi
removes cursor-positioning escapes (`\x1b[40C`) entirely instead of
replacing them with spaces, so the same text can render as
"readytoexecute" or "(yourpreference)". Both detectors now test the
spaced form first, fall through to a whitespace-collapsed comparison.
Inline unit smoke confirms both forms match.
Updates to the 5 strict 'asked' regression test cases (plan-ceo,
plan-eng, plan-devex, autoplan, office-hours): with the detection order
corrected, the model's plan-file fallback flow legitimately lands at
'plan_ready' instead of 'asked'. Pass envelope expanded to ['asked',
'plan_ready'] (matching plan-design-review's existing pattern). Failure
signals tightened to include 'auto_decided' (catches AUTO_DECIDE without
opt-in) plus the standard silent_write/exited/timeout. plan-design was
already on this contract from v1.21's first commit, no change needed.
The expanded envelope is correct: under --disallowedTools AskUserQuestion
the Tool resolution preamble routes the question through plan-mode's
native "Ready to execute?" surface — the user still sees the decision,
just via the plan-file flow rather than a numbered prompt.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
60 lines
2.6 KiB
TypeScript
60 lines
2.6 KiB
TypeScript
/**
|
|
* autoplan AskUserQuestion-blocked regression (gate, paid, real-PTY).
|
|
*
|
|
* v1.21+ regression: Conductor launches Claude Code with
|
|
* `--disallowedTools AskUserQuestion --permission-mode default` (verified
|
|
* by inspecting the parent claude process via `ps`). The native
|
|
* AskUserQuestion tool is removed from the model's tool registry; without
|
|
* fallback guidance the model can't ask the user and silently proceeds.
|
|
*
|
|
* Autoplan auto-decides INTERMEDIATE questions BY DESIGN
|
|
* (autoplan/SKILL.md.tmpl:45), but Phase 1's premise confirmation gate is
|
|
* one of the few non-auto-decided AskUserQuestions and MUST surface to the
|
|
* user. This test asserts that gate still surfaces when AskUserQuestion is
|
|
* disallowed at the tool-registry level — the fix must route the question
|
|
* through a Conductor-side variant (mcp__conductor__AskUserQuestion) or
|
|
* through the plan-file + ExitPlanMode flow.
|
|
*
|
|
* Filename keeps `auto-mode` for branch-history continuity. Auto-mode (the
|
|
* AUTO_DECIDE preamble path when QUESTION_TUNING=true) is a related but
|
|
* distinct silencing mechanism; both share the same fix surface.
|
|
*/
|
|
|
|
import { describe, test, expect } from 'bun:test';
|
|
import { runPlanSkillObservation } from './helpers/claude-pty-runner';
|
|
|
|
const shouldRun = !!process.env.EVALS && process.env.EVALS_TIER === 'gate';
|
|
const describeE2E = shouldRun ? describe : describe.skip;
|
|
|
|
describeE2E('autoplan AskUserQuestion-blocked smoke (gate)', () => {
|
|
// Pass envelope is ['asked', 'plan_ready']: model either renders the
|
|
// first non-auto-decided gate (Phase 1 premise confirmation) as numbered
|
|
// prose or surfaces it through the plan file + ExitPlanMode flow.
|
|
// Autoplan auto-decides intermediate questions BY DESIGN; the failure
|
|
// signal we care about is the AUTO_DECIDE preamble firing on a gate it
|
|
// shouldn't (caught explicitly via the 'auto_decided' outcome).
|
|
test('a non-auto-decided gate surfaces when AskUserQuestion is --disallowedTools', async () => {
|
|
const obs = await runPlanSkillObservation({
|
|
skillName: 'autoplan',
|
|
inPlanMode: true,
|
|
extraArgs: ['--disallowedTools', 'AskUserQuestion'],
|
|
timeoutMs: 300_000,
|
|
});
|
|
|
|
if (
|
|
obs.outcome === 'auto_decided' ||
|
|
obs.outcome === 'silent_write' ||
|
|
obs.outcome === 'exited' ||
|
|
obs.outcome === 'timeout'
|
|
) {
|
|
throw new Error(
|
|
`autoplan AskUserQuestion-blocked regression: outcome=${obs.outcome}\n` +
|
|
`summary: ${obs.summary}\n` +
|
|
`elapsed: ${obs.elapsedMs}ms\n` +
|
|
`--- evidence (last 2KB visible) ---\n${obs.evidence}`,
|
|
);
|
|
}
|
|
expect(['asked', 'plan_ready']).toContain(obs.outcome);
|
|
}, 360_000);
|
|
});
|