Skip to content

feat(session-flow): carry buys/surface/cost on inherited security and design decisions - #17596

Merged
kyle-sexton merged 2 commits into
mainfrom
feat/session-flow-decision-rationale
Nov 20, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
feat/session-flow-decision-rationale

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: owner-approved corrections:codify proposal (hub Q243)

Summary

A resumed hub session carried out decision D427 (move the Claude secrets to a main-only environment) through several build steps. The owner then reversed it. Its handoff entry under "Decisions in force" recorded only what was decided and by whom. It did not say what the decision bought, what surface it exposed, or what it had cost so far, so the resumed session had nothing to re-check before building on it.

Codifies: inherited security/design decisions carry buys/surface/cost; the handoff validator enforces it

Fix

  • Template and writer. A Decisions in force entry tagged [security] or [design] right after its id ends with three fields: buys: (what it gains), surface: (the surface exposed today, or none) and cost: (measured cost so far, or none yet). The decisions and decisions-new slot instructions in save_point.py, the shape-3 table and a "What the writer owns" bullet in reference/structure.md, and the handoff SKILL.md all state this shape. Tagging a carried decision changes its text, so it ends with Rewritten h<N>: <why> like any other rewrite.
  • Check. save_point.py validate (shape 3) fails a tagged entry that lacks any of the three fields, for example Decisions in force: [security] decision lacks surface:; add buys:/surface:/cost: to D1. Untagged entries need no fields, so older handoffs still pass. The tag is matched only directly after the id: an entry that just mentions the word "security" (like D424) is not treated as tagged.
  • Resume. /session-flow:reanchor gains check 6. It prints each tagged decision's buys, surface and cost, and states the rule: when cost exceeds buys, or surface is none for a security decision, bring the decision back to the owner before building on it.
  • Release. A .changes/session-flow/ fragment with bump: minor.

Scope: shape 2's "Decisions already settled" section is unchanged, because new writes shape 3.

Verification

  • uvx --with pytest --with pytest-xdist pytest -n 8 plugins/session-flow/scripts/tests/test_save_point.py plugins/session-flow/scripts/harness: all pass. The new tests cover three cases. A tagged entry fails when it has no fields, two of the three, or an empty cost:. A tagged entry passes with its fields inline or on a continuation line. An untagged legacy entry that mentions "security" also passes.
  • Sabotage check: with the new check call removed, the three failing-case tests go red.
  • scripts/check-changed-skills.sh origin/main: handoff and reanchor PASS.
  • scripts/check-changelog-fragments.sh --check: valid.

Related

  • Example handoff that motivated this: the hub night handoff's Decisions in force, entry D427.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj

… design decisions

A Decisions in force entry tagged [security] or [design] after its id ends
with buys:, surface: and cost:. save_point.py validate fails a tagged entry
missing any field and names the fix; untagged entries and older handoffs
still pass. The decisions slots and the structure doc state the shape.
/session-flow:reanchor prints each tagged decision's three fields on resume
and sends it back to the owner when its cost exceeds what it buys, or a
security decision exposes no surface.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T04:30:52.850521Z faedadf PR opened
ℹ️ 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.

@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: faedadfd1b

ℹ️ 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".

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 44674778053

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 1 inline finding(s) on faedadfd1b0d8e9485caa6dae111676699938f7f; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 13deac16a9832897738bf2fa2ed2e2b045ae9046: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #17596 (incremental, blocking only)

This is an incremental review of faedadfd..13deac16. It covers two files: plugins/session-flow/scripts/save_point.py and its tests. This lane already reviewed an earlier head, so it reports blocking findings only.

The earlier finding is fixed. That finding said an empty buys:, surface: or cost: passed whenever a ; or the next field label followed it. It is now addressed at save_point.py#L1900-L1906. The fix does two things:

  • It cuts off the trailing Rewritten h… mark before checking the fields.
  • It requires each label to be followed by a character that is neither ; nor whitespace, and is not the start of another field label.

I traced each new case through the regex by hand:

  • buys: ; surface: ; cost: 3 steps fails on buys and surface. Even when \s* gives back the space, [^;\s] still cannot match ; or the space.
  • An empty surface: before a continuation line cost: fails. The lookahead rejects cost:, and with zero-width \s* the next character is a space.
  • cost: Rewritten h1: tagged fails on cost, because the split leaves cost: empty.
  • The fully filled entry that ends in a rewrite mark still passes.

The new test cases at test_save_point.py#L3608-L3610 and #L3628-L3631 match these cases. I checked them by reading the code only. I could not run the tests, so the pass and fail results are the author's claim and I have not confirmed them.

Nothing blocking in this push. One non-blocking edge case was dropped under blocking-only mode: the split on the plain text Rewritten h would also cut off a field value that starts with a word like "Rewritten handlers". The settled thread on this line is marked lines changed since resolution: no, and this review does not raise its point again.

Other notes:

  • No closing issue; this is an owner-approved codify proposal, so there are no acceptance criteria to check.
  • Loosened-check verdict: fail. That is the default, because the wrapper supplied no loosened_check_verdict: or loosened_check_patterns: lines; patterns: 0. There was no loosened_check_decision_record: line, so the citation requirement was not checked. This push tightens a check and loosens none.
  • No plugin manifests changed.
  • No spend: nothing here draws on credits or causes a charge.
  • The PR context file contains no embedded instructions.

Verifier dropped 0 of 0 candidates.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 13deac16a9832897738bf2fa2ed2e2b045ae9046: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review (incremental, blocking only): no security issues found.

This is an incremental review of the changes since faedadfd. I read every hunk of both listed files, plugins/session-flow/scripts/save_point.py and plugins/session-flow/scripts/tests/test_save_point.py. Neither file matches a trusted-path glob. The change touches no trust control, merge hold, token scope, kill switch or plugin manifest.

What changed: _check_decision_fields now rejects a tagged decision whose buys:, surface: or cost: field is empty. Before matching, it drops any trailing Rewritten h… text, and it no longer counts a field label that is followed directly by another label as having a value.

  • Regex construction. The new pattern is \b{name}:\s*(?!(?:{labels}):)[^;\s]. It is built only from the constant tuple DECISION_FIELDS, so no handoff text reaches it. It has no nested quantifiers, so there is no ReDoS risk. REWRITE_MARK is only used as a literal argument to str.split, never inside a regex.
  • Effect. The check is stricter than before: it only adds failures. It loosens no validation, runs no command, writes no file and makes no network call.
  • Tests. The new tests are data only.
  • PR context. It contains no embedded directives aimed at this lane.

The earlier summary post at faedadfd reported nothing, so there is nothing to carry forward.

Because this lane already reviewed an earlier head of this pull request, this review reported only CRITICAL and IMPORTANT findings.

critical-findings: 0

A blank buys:, surface: or cost: followed by a semicolon, the next field's
label or a Rewritten mark passed, since the value check matched any
non-space character. The check now ignores the rewrite mark and requires a
value that is neither a separator nor another field label.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit b051cf5 Nov 20, 2026
53 checks passed
@kyle-sexton
kyle-sexton deleted the feat/session-flow-decision-rationale branch November 20, 2026 05:07
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 5, survived 2, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 71%; mutation score 71%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/session-flow/scripts/save_point.py 5 2 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/session-flow/scripts/save_point.py:3732 SBR productive no-assertion
plugins/session-flow/scripts/save_point.py:3805 SBR productive no-assertion

The run's summary has the full report.

kyle-sexton added a commit that referenced this pull request Nov 20, 2026
Carries #17596's tagged security/design decisions into Track B: the
decision-field check uses S3.id_spec("D") and id_of(prefix, ...), the
shape-3 decisions slot names DECISION_TAG_SHAPE, and the structure doc,
handoff skill and reanchor skill keep Track B's wording plus the tag rule.

The Phase 2 harness tests build with this checkout's save_point.py as if
it were the before tree; the next commit builds them as the after arm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgaqsQksryU8CarAPiU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant