Skip to content

Prevent duplicate run dispatches and preserve old journals (T34) - #184

Merged
erickb336 merged 2 commits into
mainfrom
codex/t34-one-dispatch-per-run
Oct 13, 2026
Merged

erickb336 merged 2 commits into
mainfrom
codex/t34-one-dispatch-per-run

Conversation

@erickb336

@erickb336 erickb336 commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Closes #183
Sage task T34

A run now receives only one dispatch within its project, even across owners, task labels, and completed work. An exact retry retains its old receipt. A proven initial dispatch failure permits a new attempt.

Older journals can contain duplicate initial dispatches. Those records remain readable and retain their bytes, but they cannot authorize another dispatch of that run. Continuations retain their existing replay checks. This is a component of #88 and #138; installed automatic Sage remains disabled.

Sources: packages/sage-core/admission.mjs and admission.md. Both provider bundles come from npm run build. No shared state-tool or Claude-hook changes.

Validation on 68254c1:

  • npm run build: built 280 files.
  • npm run check: all checks pass.
  • Focused provider and native-server tests: 56 tests, 56 pass, 0 fail.
  • npm test -- --test-concurrency=1: 1,137 tests, 1,137 pass, 0 fail, 0 skipped. Every test and internal concurrency assertion ran.
  • Exact-head CI run 38425337326: check passed; 1,137 tests, 1,137 pass, 0 fail.
  • The earlier parallel local suite had one existing F-T229-20 stress-test timeout after 120 seconds. Its unchanged test passed on detached main in isolation, and in the full serial suite in about 9.9 seconds. Serial file scheduling avoids competition between test files; the exact cause of the earlier delay is not proven.
  • Code, security and QA each passed two clean cycles on the unchanged final commit.

Baseline proof: the four new run-claim tests all fail behaviorally on detached main a0f6674. Main permits duplicate dispatches; the concurrency check observes two winners. The historical fixture was produced through that main commit's public API. Its test reads both old reservations, refuses a third duplicate, handles one failed and one completed reservation, and allows a different run without changing old bytes.

Existing test assertions are unchanged. Admission fixtures now give unrelated calls distinct run IDs. The composed native fixture gives the QA child its own run instead of reusing its lead's run. The first full run found this latter fixture error (1,136 pass, 1 fail); it was fixed before final validation. Review also found a worker startup cleanup gap; teardown now disconnects and awaits every owned worker.

Every test uses fake ps, pgrep and kill first on PATH. No attack strings run in a real shell. Not verified: real-model behavior, installed automatic Sage, current-logbook validation by the provider, or complete native policy composition. All local test suites and diagnostic processes have finished. No owned background workers remain.

@erickb336
erickb336 marked this pull request as ready for review October 13, 2026 16:05
@erickb336
erickb336 merged commit ed7cf14 into main Oct 13, 2026
1 check passed
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.

Keep one dispatch per run while preserving historical journals (T34)

1 participant