mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-14 08:18:40 +08:00
v1.12.1.0 fix: remove vestigial plan-mode handshake (#1185)
* refactor: remove vestigial plan-mode handshake resolver Delete scripts/resolvers/preamble/generate-plan-mode-handshake.ts and its four question-registry entries. Split the authoritative "Plan Mode Safe Operations" and "Skill Invocation During Plan Mode" sections out of generate-completion-status.ts into a sibling generatePlanModeInfo() export in the same module, wired at preamble position 1 where the handshake used to live. Same text, new position. The vestigial handshake told interactive review skills to emit an A=exit-and-rerun / C=cancel AskUserQuestion before running their interactive STOP-Ask workflow. That contradicted the authoritative rule at the tail of completion-status.ts saying AskUserQuestion satisfies plan mode's end-of-turn requirement. Skills now run directly when invoked in plan mode, with each finding gated by AskUserQuestion just like outside plan mode. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test: rename plan-mode-handshake-helpers to plan-mode-helpers, strengthen smokes Rename test/helpers/plan-mode-handshake-helpers.ts to test/helpers/plan-mode-helpers.ts. Keep the write-guard helper that asserts no Write/Edit tool call before the first AskUserQuestion (this is what catches silent-bypass regressions the textual smoke can't see). Rename the API: runPlanModeHandshakeTest to runPlanModeSkillTest, assertHandshakeShape to assertNotHandshakeShape. Extend the capture struct with exitPlanModeBeforeAsk. Rewrite the four per-skill E2E tests (plan-ceo, plan-eng, plan-design, plan-devex) as smoke tests that assert the skill's Step 0 question fires first, not an A/C handshake. Each test picks a cheap first answer (HOLD, TRIAGE, numeric score) so the run terminates quickly. Keep test/skill-e2e-plan-mode-no-op.test.ts as the outside-plan-mode non-interference regression, per codex outside-voice review: deleting it would lose coverage for "the hoisted section stays quiet when plan mode is absent." Replace the gen-skill-docs.test.ts handshake describe block (lines 2778+) with a plan-mode-info describe block that: - scans every generated SKILL.md under the repo root + every host subdir (.agents, .openclaw, .opencode, .factory, .hermes, .kiro, .cursor, .slate) and asserts "## Plan Mode Handshake" is absent - asserts "## Skill Invocation During Plan Mode" lands in the first 15KB of each of the four review skills' generated SKILL.md Both assertions run on every bun test. A PR that re-introduces the handshake resolver fails CI immediately. Update test/e2e-harness-audit.test.ts to reference the renamed runPlanModeSkillTest. Update test/helpers/touchfiles.ts entries to point at the new resolver owner (generate-completion-status.ts) and the renamed helper, and align per-skill touchfile keys. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: regenerate SKILL.md across all hosts + refresh golden fixtures Run bun run gen:skill-docs for every host to flush the vestigial "## Plan Mode Handshake" section from every generated SKILL.md and emit the hoisted "## Skill Invocation During Plan Mode" section at preamble position 1 instead. Refresh the three golden-fixture snapshots (claude, codex, factory) to match the new position. No behavior change beyond the resolver swap in the prior commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: bump version and changelog (v1.12.1.0) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,41 +1,45 @@
|
||||
/**
|
||||
* Plan-mode handshake negative regression (gate tier, paid).
|
||||
* Plan-mode-info no-op regression (gate tier, paid).
|
||||
*
|
||||
* Asserts: when /plan-ceo-review is invoked WITHOUT the plan-mode distinctive
|
||||
* phrase in the system reminder, the handshake does NOT fire. The skill
|
||||
* should proceed to its normal Step 0 flow. This is the REGRESSION RULE
|
||||
* guardrail — the handshake must be a no-op outside plan mode or it breaks
|
||||
* every existing interactive-review session.
|
||||
* phrase in the system reminder, the plan-mode-info preamble section is a
|
||||
* no-op. The skill should proceed to its normal Step 0 flow with no
|
||||
* AskUserQuestion echoing or referencing the plan-mode reminder text.
|
||||
*
|
||||
* This guardrails the "outside plan mode, this block doesn't interfere"
|
||||
* case — a different coverage case from the per-skill in-plan-mode smokes.
|
||||
* If the plan-mode-info section ever starts misfiring for non-plan-mode
|
||||
* sessions, this test catches it.
|
||||
*
|
||||
* Cost: ~$0.50 per run. Gated: EVALS=1 EVALS_TIER=gate.
|
||||
*/
|
||||
|
||||
import { describe, test, expect } from 'bun:test';
|
||||
import {
|
||||
runPlanModeHandshakeTest,
|
||||
runPlanModeSkillTest,
|
||||
PLAN_MODE_REMINDER,
|
||||
} from './helpers/plan-mode-handshake-helpers';
|
||||
} from './helpers/plan-mode-helpers';
|
||||
|
||||
const shouldRun = !!process.env.EVALS && process.env.EVALS_TIER === 'gate';
|
||||
const describeE2E = shouldRun ? describe : describe.skip;
|
||||
|
||||
describeE2E('plan-mode handshake no-op outside plan mode (gate regression)', () => {
|
||||
test('handshake does NOT fire when distinctive phrase is absent', async () => {
|
||||
const result = await runPlanModeHandshakeTest({
|
||||
describeE2E('plan-mode-info no-op outside plan mode (gate regression)', () => {
|
||||
test('no AskUserQuestion echoes the plan-mode reminder when absent', async () => {
|
||||
const result = await runPlanModeSkillTest({
|
||||
skillName: 'plan-ceo-review',
|
||||
answerLabel: 'Exit', // ignored — handshake should never fire
|
||||
firstAnswerSubstring: 'HOLD',
|
||||
omitPlanModeReminder: true,
|
||||
maxTurns: 3, // enough to see Step 0 start, but bounded
|
||||
maxTurns: 3,
|
||||
});
|
||||
|
||||
// The handshake AskUserQuestion should NOT have fired during Step 0 entry.
|
||||
// Other AskUserQuestions may fire later in the skill (e.g., Step 0C-bis),
|
||||
// but they will NOT have the handshake's question text.
|
||||
// Skill should still hit Step 0 normally outside plan mode.
|
||||
expect(result.askUserQuestions.length).toBeGreaterThanOrEqual(1);
|
||||
|
||||
// No AskUserQuestion should echo the plan-mode distinctive phrase.
|
||||
// If one does, the plan-mode-info section is leaking outside plan mode.
|
||||
for (const aq of result.askUserQuestions) {
|
||||
const questions = aq.input.questions as Array<{ question: string }>;
|
||||
for (const q of questions) {
|
||||
// The handshake's question mentions the distinctive phrase in its
|
||||
// prose; a non-handshake AskUserQuestion won't.
|
||||
expect(q.question).not.toContain(PLAN_MODE_REMINDER);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user