Repository navigation
Recover authenticated Codex task updates safely (T13) - #257
Merged
Merged
Conversation
9 tasks
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 #253
Sage task T13
The authenticated chief can update a task's title, branch, PR and state through
sage_update_task. Exact retries return the saved historical result without overwriting later changes. Unknown outcomes preserve the transaction until recovery. Stale versions now request a fresh read and new UUID; pending updates request the original UUID and identical contents.The shared planner preserves CLI argument order and lead retirement. The native route uses fixed ownership, task versions, current readiness checks and a recoverable transaction across tasks, runs, decisions and admission. Managed work cannot gain authority during publication. Disruptive changes invalidate earlier preparations. Authenticated terminal evidence can settle old work without granting new authority.
Candidate
7cec7f5cfaa68144f7cf28509c26d0eabca26001repairs CODE-T13-1 and has two clean independent code/security/UX/QA cycles. All findings are closed. Exact-head CI run38995483360 passed all1,604 tests with zero failures, cancellations or skips. Both clean cycles, local checks and native verification are complete. The terminal reader distinguishes the exact pending receipt from completed history. It checks the full intent and independent journal outcome. Only that pending receipt may lack an acknowledgement; an existing hash must match. Pending receipts never supply completed transition edges. Every other receipt keeps full history authentication. SEC-T13-1 and earlier UX/QA findings remain independently resolved.Changes and validation
Sources are in
packages/sage-core/andpackages/sage-codex/runtime/. Plugin copies come only from the build. The repairs add bounded recovery guidance, six deterministic publication races, twenty interrupted-publication terminal/report cases, and authenticated historical outcomes with seventeen security and control tests.Every test command uses fake process commands first on PATH and unsets
NODE_TEST_CONTEXT. Attack inputs never go to a real shell.npm run buildbuilt 317 filesnpm run checkall checks pass (4 timing bounds carry "// timing-ok:")node --test --test-name-pattern='T13:' scripts/codex-server.test.mjsnode --test --test-name-pattern='UX-T13-1:|QA-T13-1:|QA-T13-2:' scripts/codex-server.test.mjsnpm testgit diff --checknode scripts/probe-codex-lifecycle.mjs --sage-update-taskThe native probe uses simulated model responses in a temporary profile. It changes no installed trust or mode settings. The earlier read-only control passed on the parent commit; it was not repeated for this repair.
Round-two evidence
The 40 focused history, publication and security checks passed. The round-two native update probe passed with simulated responses; the round-three probe also passed with five requests, exact fresh/retry evidence and cleanup.
The first 16 security tests failed on detached main because its task-update module is absent. On published parent c9becc1, nine failed and seven passed: seven failures expose outcome or terminal-history gaps, and two expose incorrect corruption guidance. Four passing invalid-callback cases were weak: the test helper failed during release for an unrelated reason. The corrected helper resolves the exact saved update and includes a valid-history control.
An isolated control passed all five callback tests. Removing only proof validation, while preserving callback invocation and release, made all four invalid-proof tests fail with a missing-exception assertion. The valid callback still passed. The isolated mutation was restored. This is sensitivity evidence; the earlier callback passes alone were insufficient. The terminal-history regression changes a rejected receipt and its proposed table after-images while leaving the journal rejected; it is broader than receipt-only corruption.
Round-three evidence
The final combined task-update, security, recovery, guidance and publication checks passed 115/115. Twelve new tests cover held-child completion before and after acknowledgement, corrupted outcomes, mismatched intents, malformed pending markers, unrelated historical corruption and an incorrect acknowledgement hash. Corrupt-data cases restore valid bytes and then complete the same child. Valid completion preserves pending work and the unfinished logbook run; it grants no tool authority.
The final twelve tests were copied without production changes to detached ac8e957. Seven controls passed; five assertions failed behaviorally: the direct pre-ack completion and four completion assertions after valid bytes were restored. On detached main 5cf760a, all twelve fail because the task-update API is absent. The baseline proves feature absence only; the parent failures isolate the repaired behavior.
Failure evidence
The original 47 tests were copied, without production backports, to detached main
5cf760a8d856c921d97f0753011c1bc3d2d06148. All failed: one CLI planner test observed two retirement decisions instead of one; the other 46 failed because the task-update API is absent. All 34 repair tests also fail on that detached main because the API is absent. These missing-API results prove absence, not internal correctness.The eight new UX tests all fail behaviorally on published parent
6984b89, which returns the same generic retry message. The repaired implementation passes all eight.The six race tests pass against the unchanged published parent. Removing only its retired-preparation generation guard in an isolated copy makes all three update-wins cases fail: initial dispatch, continuation and another owner. The three reservation-wins controls still pass. The mutation was restored.
Earlier controlled mutations also showed that the tests detect removal of the post-evaluator transaction fence, captured preparation generation, current-head readiness filter, and running-reviewer refusal. Each unmodified control passed. The legacy-table test failed before its compatibility repair and passes afterward.
The first repair-test drafts had fixture errors: rejected transactions have no accepted-fence release field, core preparation returns a wrapper, unchanged tables have no rename boundary, and report receipts contain parsed fields. Valid CLI arguments and legal state transitions were also corrected. Failed outputs were retained. No admission or terminal protection was weakened to make these tests pass.
Reachability and limits
Eight tests exercise first authenticated completion before and after the changed tasks/decisions publications. They first corrupt the pending proof and confirm refusal, then restore exact proof and confirm one completion. Runs remain unchanged in this case, so no runs rename occurs.
Twelve tests cover all three changed tables after authentic child completion. They verify late reports, idempotent completion replay, blocked logbook writes, and exact recovery. These completed replays do not prove traversal of the first-completion snapshot validator. Each case first proves that unsettled work prevents the disruptive update.
This does not complete cross-worktree PR ownership (#239), trusted execution context (#243), abrupt-child recovery (#246), or installed automatic Sage. No real-model pilot or operating-system power-loss test is claimed. Defaults remain unchanged. Claude-owned #119, #105 and #67 are outside this change.