Skip to content

fix(ack): set the next state's transitions when ack.sh advances - #223

Merged
tupe12334 merged 1 commit into
mainfrom
fix/ack-advances-transitions
Sep 29, 2026
Merged

tupe12334 merged 1 commit into
mainfrom
fix/ack-advances-transitions

Conversation

@tupe12334

@tupe12334 tupe12334 commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Bug: ack.sh moved current_state forward but left the old state's transitions in state.json. A second ack before the hook fired again failed with invalid next state '', so an agent had to retry the gated command after every step. On a 9-step run of the Kev PR checklist that meant about 20 extra tool calls.
  • Fix: the gate stores the flow's transition map in state.json as flow_transitions. ack.sh sets transitions and next_state for the state it advances to, so acks can run back to back.
  • Existing sessions: ensure_ack_sh now rewrites an ack.sh that differs from the current script, so a session started by an older steplock gets the fix on its next block.
  • Cleanup: removed core/src/ack.sh, an unused copy of core/scripts/ack.sh (only scripts/ack.sh is embedded).
  • schemas/session-state.schema.json documents flow_transitions. The field is optional, so older state.json files still load.

Test plan

  • cargo test --locked passes (179 tests)
  • cargo clippy --all-targets --locked -- -D warnings passes
  • cargo fmt --check passes
  • New ack_sh_advances_twice_without_a_hook_call_between runs the real ack.sh three times in a row (linear, branch, linear), then checks that the hook blocks at the last step. It fails on the old ack.sh with invalid next state 'right'.
  • ensure_ack_sh_replaces_stale_script replaces the old test that asserted a stale ack.sh is kept
  • Live check: this build, installed as the local steplock, replaced an existing session's old ack.sh on the next block. On this PR's own checklist run, 7 acks then ran back to back with no retried command
  • CI: 13 of 13 checks passed (cargo audit runs only when Cargo.lock changes)

Kev review

Local Kev (kev-latest), one round, verified facts only:

  • Merge noul: 0.835 (gate 0.8)
  • Scope: keep 0.84, split 0.10, grow 0.06
  • Field name: flow_transitions 0.69, all_transitions 0.18, graph 0.12
  • Concerns (each asked as "X is a reason to wait"): no human review 0.50, rewriting a stale ack.sh 0.45, removing the duplicate script here 0.41. All are below the merge score, so the PR is kept as is.

🤖 Generated with Claude Code

ack.sh moved current_state forward but left the old state's transitions
in state.json. A second ack before the hook fired again failed with
"invalid next state ''", so the agent had to retry the gated command
after every step.

The gate now stores the flow's transition map in state.json as
flow_transitions, and ack.sh sets transitions and next_state for the
state it advances to. ensure_ack_sh rewrites an ack.sh that differs from
the current script, so sessions started by an older steplock get the
fix on their next block. The unused duplicate core/src/ack.sh is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tupe12334
tupe12334 marked this pull request as ready for review September 29, 2026 11:08
@tupe12334
tupe12334 merged commit 0093a5e into main Sep 29, 2026
13 checks passed
@tupe12334
tupe12334 deleted the fix/ack-advances-transitions branch September 29, 2026 11:08
@tupe12334 tupe12334 mentioned this pull request Sep 29, 2026
6 tasks
tupe12334 added a commit that referenced this pull request Sep 29, 2026
- Bump steplock to 0.2.1 for the ack.sh transitions fix (#223).
- CHANGELOG: cut the Unreleased entry as 0.2.1 (2026-09-29).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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