Repository navigation
Release admission slots from exact terminal evidence (T21) - #158
Merged
Merged
Conversation
This was referenced Oct 13, 2026
erickb336
marked this pull request as ready for review
October 13, 2026 11:14
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #157
Sage task T21
Verified completion and interruption can release an assignment's admission slot without deleting its history. The journal requires an exact saved child binding and current owner epoch. Identical retries preserve one terminal record; conflicting outcomes or interruption hashes are refused. A late event cannot release a newer assignment.
Unfinished work still occupies total, project, lead and team limits. Completing a lead keeps its children's slots held. Completed issuers cannot prepare or reserve new work. The Codex binding adapter refuses renewed instructions for a terminal assignment. Valid terminal evidence remains recordable while Sage is off without changing mode.
Security review found a race between the adapter snapshot and its binding call. The core now refuses terminal assignments inside the atomic binding transition, before the idempotent retry return. The new regression covers completed and interrupted bindings in both provider bundles.
The core APIs trust the provider adapter to authenticate the caller and prove native terminal evidence. No lifecycle callback is newly wired here. This changes
packages/sage-core/admission.mjs, its public export and documentation, the Codex binding adapter, and packaged tests. The shared state tool and Claude hooks remain unchanged. Plugin output comes from the build.Validation uses fake ps, pgrep and kill first on PATH:
npm run buildafter main integrationnpm run checkafter main integrationnode --test scripts/providers.test.mjsbefore main integrationeac361458ae3223b566a2before main integration and the repairEach new test fails with only the updated test file copied to detached main. Main has no completion/interruption API. This proves missing functionality. The new terminal-binding regression also fails behaviorally on detached pre-repair
58ae322and passes after the atomic repair. Tests cover identity mismatch, duplicate and late terminal events, preserved child capacity, project and role limits, off-mode evidence, and concurrent completion/reservation publication. Both provider bundles are tested in isolation.The branch includes main
5d1345bthrough PR #156. All nine repaired-head focused tests pass. Two code, security and QA review cycles are clean atf93e82231217332f8964107ef990abdb47fb0b72. Final-head CI run 38387743694 passes: 1,033 tests, 1,033 pass, 0 fail, 0 cancelled, 0 skipped. All owned local test and push processes exited.Not verified here: native terminal provenance, automatic reconciliation, report or verdict acceptance, logbook run completion, failed dispatch before binding, later-turn reuse, real-model behavior or installed automatic Sage. Those remain separate integration work. Automatic Sage remains incomplete; see #88.