Skip to content

fix(session-flow): handoff purpose leads the Resumption brief again - #10038

Merged
kyle-sexton merged 1 commit into
mainfrom
fix/handoff-purpose-leads-brief
Oct 25, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
fix/handoff-purpose-leads-brief

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Refs: #9238

Summary

Handoff eval case 9 (purpose-argument-tailors-emphasis-only, claude plugin eval --scaffold --ablation none, Opus writer and judge, 3 runs each, 2026-10-25) regressed when shape 3 shipped:

  • before (session-flow at d42b1ad, shape 2): mean 0.94, 2 of 3 runs pass; one run failed expectation 2.
  • after (main, shape 3): mean 0.78, 0 of 3 runs pass; expectation 2 ("Resumption brief leads with the stated purpose") failed in 2 runs, expectation 3 ("Suggested skills are selected for the review purpose") failed in 2 runs.

Root cause: the purpose rule lives only in reference/save-point.md ("The purpose argument tailors emphasis only"), while the skeleton slot the writer fills tells it to open the brief with "when written and against which branch or commit" (scripts/save_point.py, shape-3 brief slot), and neither the brief slot nor the Suggested skills slot mentions the purpose. Every failing run whose slots survive in the eval evidence opened the brief with Written <time>; branch … and put the purpose on line 2; the passing shape-2 run opened with the purpose. Shape 2 had the same slot text, so the slot alone is not the whole regression: on shape 3, Review before you continue sits above the brief and is "tailored to [the next action]", so the review framing lands there and the brief falls back to the slot's fixed opening.

Fix

  • save_point.py new --purpose <text> writes the purpose as the Resumption brief's first line, Purpose: <text> (whitespace collapsed), and the brief slot becomes "five lines max below the Purpose line, framed from it", so the six-line cap holds. The Suggested skills slot adds "selected for the Purpose line in Resumption brief". Shapes 2 and 3 both take it.
  • A purpose carrying <!-- or --> is refused (exit 2), since it would break the slot grammar.
  • Without --purpose the skeleton is byte-identical. Section set, order and the resume prompt never change, so the purpose stays emphasis-only.
  • The handoff skill's checklist, the structure doc's write procedure (which continue-in-background also follows) and the save-point engine doc pass and describe --purpose.

Verification

  • uvx --quiet pytest -q plugins/session-flow/scripts/tests: 268 passed. New tests: with --purpose, only Resumption brief and Suggested skills differ, the brief's first line is the collapsed Purpose: line, validate exits 0 and emit output is identical to the no-purpose run (shapes 2 and 3); a purpose with --> or a FILL marker exits 2.
  • /skill-quality:check on the handoff skill: PASS, 0 errors, 3 warnings (description length and body length, both pre-existing; body +1 line).
  • Left out: model evals. The parent session re-runs case 9 after merge; expectation 3 is graded on the skills slot the writer still writes, so it may move less than expectation 2.

Related

🤖 Generated with Claude Code

On shape 3 the brief slot told the writer to open with the write time
and branch, and the purpose framing landed in Review before you
continue, so the purpose argument no longer reliably led the brief or
steered Suggested skills (eval case 9 fell from 2 of 3 to 0 of 3).

`save_point.py new --purpose <text>` writes the purpose as the brief's
first line and points the brief and skills slots at it. Sections, their
order and the resume prompt are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 25, 2026 15:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T15:48:22.389846Z 725156d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 725156d1edb614b3ecc02f12cb10a82dbb059a5f: 0 finding(s), 0 as inline comments.

No security issues found in PR #10038 at 725156d.

critical-findings: 0

The PR adds a --purpose <text> option to save_point.py new. It also adds the doc and skill text that passes it, and tests. I read the whole diff and the PR context, and I did not read the changed files in full. No changed file matches a trusted path, and no plugin manifest changed, so there are no manifest <field> lines.

  • Slot grammar: cmd_new collapses all whitespace in the purpose to single spaces. That leaves one line, so the purpose can't open a heading or add a section. It refuses a purpose containing ``, which stops it from forging or closing a FILL slot marker. The line is always prefixed Purpose: , so it can't start with markdown structure.
  • Command injection: save_point.py receives the purpose as an argv element, not through a shell string or eval, and nothing in the script executes it. The doc snippets quote it as "$PURPOSE". The SKILL.md checklist writes --purpose "<purpose text>". Whether that is shell-safe depends on how the invoking model quotes the text. The purpose comes from the user's own $ARGUMENTS, so this crosses no trust boundary. It is not a finding.
  • Prompt injection into later sessions: the purpose is written into the handoff file the next session reads. That text is the invoking user's own input. This PR adds no path for third-party content to reach it.
  • Instruction-surface changes: the doc and skill edits only add the --purpose pass-through. They don't delete, narrow, or soften any standing rule. The PR says the purpose stays emphasis-only: the section set, section order and resume prompt are unchanged, and emit output matches the no-purpose run. That is the PR's claim, backed by the new test.

Spend: nothing in this change draws on credits or a paid plan beyond ordinary CI runs.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 725156d1edb614b3ecc02f12cb10a82dbb059a5f: 0 finding(s), 0 as inline comments.

No findings. I read the full diff (6 files) and the PR context; I did not run the tests. The "268 passed" result in the PR is the author's claim and is unverified by me.

  • save_point.py _brief_lines: instruction.split(": ", 1)[1] is safe because both the shape 2 and shape 3 brief instructions contain a ": " after "six lines max". A purpose line plus a five-line slot keeps the brief at six lines, and I found no validator that enforces the cap.
  • --purpose is whitespace-collapsed, and `` is refused with exit 2. Without the flag the skeleton code path is unchanged.
  • The new tests use existing helpers with matching signatures. They cover shapes 2 and 3, the changed-sections-only check, validate and emit equivalence, and the refusal cases.
  • The docs, the handoff skill checklist and the bump: patch change fragment match the code.
  • No plugin.json or marketplace.json is changed, so there are no manifest lines to report.
  • No changed file matches a trusted-path glob.
  • The PR says Refs #9238 and closes no issue, so there are no acceptance criteria to check.
  • The PR context contains no embedded instructions.
  • No billing impact, so no hold.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 725156d1ed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 25, 2026
Merged via the queue into main with commit b941a9c Oct 25, 2026
68 checks passed
@kyle-sexton
kyle-sexton deleted the fix/handoff-purpose-leads-brief branch October 25, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant