You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(playbooks): stop the holder when cancelling a run - #1089
Migration 070 records cancellation and archive recovery. Archive and delete events cancel the run and stop its current holder. A read or refused move before the event leaves that work to the event handler. The startup sweep records cancellations without interrupting holders.
The archive port passed 142 tests. The additional holder-limit and waiting-turn changes passed 27 relay and integration tests and server typecheck. Earlier tested head · Earlier stack verification.
Historical submission and tests on earlier commits
The following records the original submission. The December re-review section above tracks current evidence.
Problem
Cancelling a playbook left its current worker running, while archiving a Crew incorrectly ended the Captain's run. Closes#789.
What changed
Cancellation now commits the ended run before stopping its recorded non-owner holder through the existing upstream Stop path. The durable result distinguishes idle, stopped, unavailable, and refused holders; retries never issue another Stop, including cancellations recorded before this upgrade. Owner archive/delete events and startup recovery cancel the owner's run. Crew archive preserves it for reassignment or takeback.
This is stacked on #1088. Migration 062 precedes checkpoint migration 063 in #1090; progress follows in #1091.
Live testing
Automated real-orchestrator coverage captures the active holder run, cancels the playbook, verifies that exact run becomes interrupted, and verifies retry adds no turn items. The owner-archive checkpoint closure is covered in the following integration layer.
Combined validation at bc432f7c64040976df0400625870a4b235a8e81b: check:changed passed: 568 tests across 43 files, all 36 affected package typechecks, 17 React compiler cases across 12 selected files, format, lint, Knip, and GraphQL. Captain browser smoke verified the approval-required library preview, Inbox loading, a completed free Replay turn, and restoration of that transcript after an at-rest server restart. Replay exercises provider rendering; it does not verify the Playbook approval flow. Detailed report: artifacts/test-reports/feat-playbooks-next-integrated-331968a7/bc432f7c6.md. Real-model Stop/Continue, held-turn restart, and migration rehearsal on copied real data remain unrun; the earlier request to authorize paid test models is still pending. No live deployment was performed.
Upstream impact
Only the measured agent context budget changes outside J5-owned code; recorded in FORK.md cases 2 and 110. Stop uses the existing provider-neutral implementation and Captain exception.
Checklist
One concern: cancellation and owner lifecycle
Tests cover changed behavior, retries, mode limits, and upgrade history
UI changes: no new control in this layer; readable history labels ship in the progress layer
Live testing: exercised and unexercised paths are stated above
Upstream-owned files recorded in FORK.md
Upstream product: existing behavior reused; no new divergence
@Jacksondr5, Migration 063 records cancellation and archive recovery. A delayed archive targets the old handoff and preserves replacement work. Peer handoffs enforce the owner’s current limits. The archive port passed 142 tests. The additional holder-limit and waiting-turn changes passed 27 relay and integration tests and server typecheck. Commit · Stack-wide response and outstanding evidence.
Blocking: archiving the owner doesn't stop the holder.PlaybookCrewRelay.ts:125-154: the archive and delete path interrupts only a turn that started from the step notice, and records already_idle otherwise. A holder's work on a step routinely spans turns (it asks the owner a question, gets steered), so this misses the common case. Reproduced live: the owner hands a step to a Peer; the Peer asks a question and the owner answers; archive the owner. The run is cancelled owner_archived and holder_stop records already_idle, but the Peer's command keeps running. Upstream's Stop already knows whether the thread has an active turn, so there's no need to guess from the notice. Fix: when the archive or delete event arrives, stop the holder with the same ordinary Stop that explicit cancel uses. When a cancellation is only caught later (startup sweep or a lazy read), don't stop anything: record that the holder wasn't stopped, and leave the ordinary Stop to the person.
Where:holderLimit (PlaybookCrewRelay.ts:89-101, applied at :246-247) holds the step notice to the owner's runtime and interaction mode. The comment there says a spawned Peer inherits the owner's ceiling, but a persona Peer runs with the persona's own access.
Reproduced live:
A Supervised owner starts a run whose step needs a Full-access persona.
An Owner approves the grouped request.
The agent spawns the persona and assigns it.
Result: the delivery stays unresolved, and current reports pending. A Stop on cancel hits the same limit and records failed.
Fix: deliver the step notice the way a queued j5_send_message is delivered, with no owner-mode limit.
Should-fix: Stop recovery machinery. These cover a crash window:
the replay of Stop through run.interrupt from the startup sweep and on retries;
the placeholder outcome written before Stop runs;
migration 063's holder_stop_json backfill, which the filters never read.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:L100-499 effective changed lines (test files excluded in mixed PRs).vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #789.
Migration 070 records cancellation and archive recovery. Archive and delete events cancel the run and stop its current holder. A read or refused move before the event leaves that work to the event handler. The startup sweep records cancellations without interrupting holders.
The archive port passed 142 tests. The additional holder-limit and waiting-turn changes passed 27 relay and integration tests and server typecheck. Earlier tested head · Earlier stack verification.
December re-review
Current layer commit.
Historical submission and tests on earlier commits
The following records the original submission. The December re-review section above tracks current evidence.
Problem
Cancelling a playbook left its current worker running, while archiving a Crew incorrectly ended the Captain's run. Closes #789.
What changed
Cancellation now commits the ended run before stopping its recorded non-owner holder through the existing upstream Stop path. The durable result distinguishes idle, stopped, unavailable, and refused holders; retries never issue another Stop, including cancellations recorded before this upgrade. Owner archive/delete events and startup recovery cancel the owner's run. Crew archive preserves it for reassignment or takeback.
This is stacked on #1088. Migration 062 precedes checkpoint migration 063 in #1090; progress follows in #1091.
Live testing
Automated real-orchestrator coverage captures the active holder run, cancels the playbook, verifies that exact run becomes interrupted, and verifies retry adds no turn items. The owner-archive checkpoint closure is covered in the following integration layer.
Combined validation at
bc432f7c64040976df0400625870a4b235a8e81b:check:changedpassed: 568 tests across 43 files, all 36 affected package typechecks, 17 React compiler cases across 12 selected files, format, lint, Knip, and GraphQL. Captain browser smoke verified the approval-required library preview, Inbox loading, a completed free Replay turn, and restoration of that transcript after an at-rest server restart. Replay exercises provider rendering; it does not verify the Playbook approval flow. Detailed report:artifacts/test-reports/feat-playbooks-next-integrated-331968a7/bc432f7c6.md. Real-model Stop/Continue, held-turn restart, and migration rehearsal on copied real data remain unrun; the earlier request to authorize paid test models is still pending. No live deployment was performed.Upstream impact
Only the measured agent context budget changes outside J5-owned code; recorded in FORK.md cases 2 and 110. Stop uses the existing provider-neutral implementation and Captain exception.
Checklist
Implemented with GPT-6 Astra in the Codex harness and a J5 Crew.