fix(#4763): surface the displaced session record and pass --phase from the executor decision loop (#4919)

* test(#4763): failing-first — replaced-record payload and executor --phase pins

* fix(#4763): surface the displaced session record and pass --phase from the executor decision loop

state record-session keeps its last-writer-wins write (the recorded single-slot
handoff design) but no longer displaces silently: when a non-empty Stopped At or
authored Resume File record is replaced, the payload carries the full prior text
under replacedRecord. Same-value rewrites, the insert path, and the #944
template-default DWIM are not displacements and report nothing.

The executor decision loop now passes --phase "${PHASE}" to state.add-decision,
matching execute-plan.md, so decisions stop inheriting whichever phase the
global pointer names (#4763 case 2). advance-plan is unchanged (#3311 by-design).

Emitted-Drift-Ack-Growth: gsd-executor.md — the decision loop gained its --phase guard and a comment naming why (#4763)

* docs(#4763): add the changeset fragment

* docs(#4763): backfill the changeset PR number

---------

Co-authored-by: sim <sim@local>
This commit is contained in:
Tom Boucher
2026-09-21 12:42:11 -04:00
committed by GitHub
parent 55fba5f7ce
commit 6a4984cf69
5 changed files with 275 additions and 2 deletions

View File

@@ -777,8 +777,10 @@ gsd_run query state.record-metric \
--tasks "${TASK_COUNT}" --files "${FILE_COUNT}"
# Add decisions (extract from SUMMARY.md key-decisions)
# --phase is required here: without it the verb falls back to STATE.md's global
# pointer, which misattributes decisions when plans execute out of pointer order (#4763).
for decision in "${DECISIONS[@]}"; do
gsd_run query state.add-decision --summary "${decision}"
gsd_run query state.add-decision --phase "${PHASE}" --summary "${decision}"
done
# Update session info (stopped-at, resume-file; timestamp set automatically)