Skip to content

Recover verified native follow-up capacity rejections #242

Closed

Description

@erickb336

Codex manual logbook: T2 records the native evidence investigation. Implementation remains gated on that evidence. Task IDs are local to each provider logbook.

A prepared followup_task reserves Sage capacity before native dispatch. If native capacity rejects the call before delivery, Sage currently retains that reservation. This is a bounded follow-up to #88 and the initial-spawn recovery in #240.

Evidence-first gate

Capture an actual rejection through pinned Codex rust-v0.160.0 before implementing recovery. Do not infer non-delivery from an arbitrary tool error, a missing callback, or an absent transcript entry.

Pinned source review (rust-v0.160.0; the baseline native capture below now confirms the candidate error):

  • followup_task.rs selects TriggerTurn. message_tool.rs resolves the target and maps send errors through collab_v2_agent_error.
  • api.rs calls ensure_v2_agent_loaded before constructing and submitting the communication. Evicted A therefore requires restoration before the later turn-start check.
  • spawn.rs implements target restoration. residency.rs refuses a residency slot when the cap is full and no resident can be unloaded. Only completed, errored, or interrupted idle threads are unloadable. With B active and native capacity one, the candidate failure is restoration preflight; do not label it a proven turn-start rejection.
  • For a loaded target, control.rs also checks execution capacity before submitting communication.
  • multi_agents_common.rs maps this error to the candidate tool text collab tool failed: agent thread limit reached. This differs from the initial-spawn prefix. The baseline capture below confirms this exact tool-visible text.

The prepared isolated route completes A, holds B, and uses the public report-reader assignment in A's follow-up preparation. It checks the exact native result, unchanged A transcript, no later A request, retained Sage reservation, and B completion. It retains native transcript evidence outside the disposable profile. Current baseline Sage guards prevent a fresh continuation retry; successful recovery/retry remains a later implementation proof, not a claim of this investigation.

Native experiment

  1. Complete child A and preserve its binding, completion, and transcript evidence.
  2. Hold an unrelated child B active with native capacity one; keep Sage capacity high enough to admit the prepared follow-up.
  3. Prepare a valid follow-up to completed A and attempt native dispatch while B occupies capacity.
  4. Capture the exact authenticated call and result, and prove that this rejection precedes task delivery.
  5. Finish B, admit a fresh retry, and verify A receives and completes exactly that retry.

Native capacity one can evict completed A from residency. Check supported target restoration semantics first. If restoration changes the failure path, document the actual behavior and adjust the experiment without weakening the non-delivery requirement. Stop before implementation if the failure cannot be established safely.

Captured baseline evidence

The isolated native capture passed at 74966ae2dbaa0016a0c90abcda635610ea9b9864, based on main through #241. It used actual Codex CLI 0.160.0 with simulated model responses, native capacity one, and Sage capacity two.

  • A completed before B started. B then occupied native capacity.
  • A valid prepared follow-up used the target returned by the public preparation tool. The actual authenticated native call returned exactly collab tool failed: agent thread limit reached.
  • The captured sender session, call, turn, arguments hash, and task-message hash matched the saved continuation reservation. The call and result had the same native turn.
  • A's transcript remained byte-for-byte unchanged through rejection and B completion. No subsequent model request reached A. These observations accompany the source path: target restoration reserves native residency before communication construction/submission, and cannot evict active B.
  • Sage retained the rejected continuation: one continuation reservation, zero failures, two bindings, and two completions after B finished. The earlier binding/completion history and logbook remained unchanged by the rejection.
  • The native process exited zero. All probe assertions passed, and the temporary profile was removed. B completed normally. Bounded raw session, admission, and hook evidence remains local; no raw evidence or private identifiers are published here.

This establishes the captured pre-delivery rejection and the retained-reservation baseline. Recovery implementation is now underway but is not verified. Fresh retry, conflict refusal, and idempotent recovery still require their own implementation and proof. This capture does not establish real-model behavior or automatic Sage readiness.

Implementation scope, only after the capture passes

  • Add distinct continuation-failure evidence and transition. Pin project, owner epoch, sender, call, predecessor, recipient, turn, arguments hash, task hash, and native evidence.
  • Preserve authenticated success, delivery, or later-turn binding as conflicting evidence that prevents release.
  • Keep the initial-spawn rule separate. packages/sage-core/admission.mjs currently refuses failAdmission for a continuation.
  • Address both predecessor guards in packages/sage-core/admission.mjs: preparation and reservation each currently reject any prior continuation. Permit a fresh retry only when its predecessor's prior attempt has verified failure; retain all history and prevent concurrent retries.
  • Update later-turn candidate selection in packages/sage-codex/runtime/child-tool.mjs to exclude verified failed continuations. Do not let a late binding revive a failed attempt.
  • Reuse the protected sender evidence principles in packages/sage-codex/runtime/identity.mjs and the exact prepared target and task checks in packages/sage-codex/runtime/preparation.mjs.

Acceptance

  • Exact native preflight evidence fails behaviorally on the prior implementation, then releases only the rejected continuation.
  • Near-match errors, forged identity, duplicate or conflicting results, late bindings, and arbitrary send errors never release capacity.
  • Reconciliation is idempotent, supports historical evidence while Sage is off, and preserves prior bindings, completions, reports, and logbook state.
  • One fresh retry succeeds through native transport after capacity is available; the rejected attempt delivers no task.
  • Build, checks, focused behavioral tests, full tests, and independent reviews pass.
  • Clearly label simulated model responses. This does not establish real-model behavior or enable automatic Sage.

Codex task T2 now tracks the evidence investigation on codex/t2-followup-capacity-evidence. Probe preparation is underway; no recovery behavior has changed. Keep work separate from Claude-owned #140. Task IDs are scoped to their provider logbooks.

Activity

  1. added
    codex
    on Oct 15, 2026
  2. erickb336 commented on Oct 15, 2026

    @erickb336
    OwnerAuthor

    Native recovery check on 12ac2e9 found an incomplete retry path. Sage recorded the verified failure, preserved the completed predecessor, and prepared a fresh follow-up. The restored child then received a PreToolUse denial on its first tool call, so the check failed. The cause is under investigation; this is not a successful recovery result.

    The actual CLI used simulated model responses. Bounded failed-run evidence was retained locally, the temporary runtime profile was removed, and the process exited. No recovery bypass or weaker assertion was added. Final reviews and full-suite validation must use the repaired commit.

  3. erickb336 commented on Oct 15, 2026

    @erickb336
    OwnerAuthor

    The diagnostic run at 12b6ea7 completed the fresh retry on the original child. It recorded four reservations, one failure receipt, three bindings, and three completions. The failed attempt never bound. Cleanup passed. This run used the actual CLI with simulated model responses.

    This does not resolve the earlier denial. The only new changes captured diagnostics; production policy stayed unchanged. Both captures show the child tool call before the parent success result entered the transcript. A final binding record cannot establish whether binding happened before the denial, because parent recovery can write it later.

    The next check will reproduce this ordering with a controlled publication barrier. It must preserve the requirement for exact parent success and recipient delivery. No additional native retry, merge, or completion claim follows from this single passing run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    codex

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions