Skip to content

Keep one active Codex lead per PR across linked worktrees (T64) #239

Open

Description

@erickb336

Sage task T64
Parent tracking issue: #88. Extends the completed per-task ownership work in #177.

Approved outcome

Keep one active lead per pull request within one local project and its linked Git worktrees. Different task records or chief sessions must not create overlapping leads for that PR. The owner approved this scope on 2026-10-14 in #88. Independent clones and other machines are outside this guarantee.

The old lead and its active team must finish through the supported lifecycle before ownership transfers. Preserve ordinary branch-only tasks before a PR is attached. Preserve exact retries and independent PR work.

Acceptance

  • Use one canonical local-project identity across linked worktrees. Caller labels, alternate worktree paths, and alternate state roots must not create separate claim domains.
  • Enforce ownership during initial claims, concurrent claims, PR attachment, retargeting, clearing, and transfer. Check the common write boundary; a caller-side preflight alone is insufficient.
  • Publish a durable claim before exposing a run or PR association. Recover interrupted publication from the original exact request; keep uncertain claims occupied.
  • Preserve immutable saved run targets and briefs when a branch-only task later gains its first PR.
  • Release ownership only from authoritative terminal run and team evidence. Do not infer completion from a report, missing process, elapsed time, or parent interruption alone.
  • Cover races between different tasks, owners, linked worktrees, and attach/retarget operations. Include crash recovery, identical retries, conflicting retries, active descendants, and independent PR controls.
  • Exercise the real supported Codex tool path and show the second lead refusal and later allowed transfer.

Ownership and sequencing

Codex owns this work. PR #140 merged at b5889f6 after owner-authorized Codex takeover, so that source-ownership conflict is resolved. Prerequisites #252 and #253 are merged through PRs #254 and #257. Main is443c00a at this design refresh. Complete the common mutation boundary; do not ship a narrower preflight as this guarantee. Claude-owned #119, #105 and #67 remain outside Codex scope.

Design the canonical project identity, claim storage, transaction order, and recovery before implementation. Recheck latest main and Claude ownership at that point. Current interrupted-run completion work is #237.

Validation and limits

Require meaningful failure proofs on detached main, deterministic race/crash tests, build/check/full suite with fake process commands, native verification, and two clean independent code/security/QA cycles. Separate simulated responses from real-model evidence. No claim of cross-machine ownership or installed automatic Sage follows from this component.

Current design evidence

A disposable Git topology probe on merged main confirms that ordinary and bare-backed linked worktrees share their respective real common-directory identity. It also shows that the current logbook projectRoot helper maps two distinct sibling bare repositories to their parent directory. The ownership resolver therefore must use the validated Git common directory itself, not reuse that parent-directory grouping.

The probe also distinguishes a same-volume rename from a copy through filesystem identity, while showing that an unrepaired linked-worktree pointer fails after the rename. This is bounded local evidence, not a complete relocation protocol or inventory proof. The common writer migration, complete participant registration, verified relocation and native execution checks remain required. No production ownership behavior changed.

Legacy inventory API audit

Source audit at OpenAI Codex commit 3b8f43a06bb3105e81406b35ff69f94977d18ae4:

  • thread/loaded/list reads one server manager's in-memory thread map; it does not enumerate every server or arbitrary state root.
  • thread/list reads its configured thread store. Default filters can exclude agent sources, other model providers, and archived threads. Exhausting this list is not a complete project inventory certificate.
  • Stored thread records do not establish live execution or authoritative settlement.

Evidence: loaded-list implementation, manager inventory, list filters.

Migration must establish a complete inventory boundary and prevent older unregistered writers from acquiring authority during the census. Known-store scans can find conflicts but cannot prove unknown stores empty. Keep uncertain domains occupied; do not narrow acceptance to newly registered rows. This is source evidence, not an installed runtime trial, and does not rule out an additional supported API. No production behavior changed.

Activity

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

    @erickb336
    OwnerAuthor

    The shared-ownership design now has independently reviewed process-exit and lock-contention evidence. This issue remains open.

    A local prototype stores unfinished operations under the actual Git common directory. Nine cases passed, then an independent reviewer ran the same nine successfully:

    • Ordinary and bare-backed linked worktrees, with different Sage roots, found the same unfinished operation.
    • Exits after central intent publication, after one local reference and after both references kept the original operation visible. Different requests refused; exact retries stayed pending; changed retries preserved the original bytes.
    • Two first entrants contended on the actual core lock. Exactly one intent remained, with one preparation and one refusal.
    • Independent repository domains stayed separate.
    • A deliberate root-local negative control missed the earlier operation and allowed a second preparation. It demonstrates why separate per-root discovery is insufficient.

    These were real disposable Git layouts and Node processes, with synthetic operation records and guarded fake process probes. They were not native Codex agent trials or power-loss tests. Every owned worker closed before fixture removal. No production source, setting or default changed.

    The next contract also preserves cross-project merge eligibility. Current core merge checks include blocking verdicts from other project logbooks. The proposed coordinator therefore declares and locks all authority read dependencies, even when it writes only one repository. A pending operation whose bound dependency changed must preserve its partial state and refuse stale completion. Independent protocol review found no new defect in that stated contract; behavioral proof remains required.

    Still open: trusted repository binding, participant registration and generations, typed command planners, complete writer migration and legacy exclusion, exact multi-participant recovery, authoritative whole-team settlement, and the actual supported Codex tool-path demonstration. The local experiment does not close those requirements or complete automatic Sage support. Claude's active board and documentation work remains untouched.

    Further registration evidence:

    • Seven process/race cases passed locally and independently. A command with an old lock plan detected a newly registered root, released its locks and read that root's denying policy. The omitted-revalidation control incorrectly prepared from the old set.
    • Registration recovered the original revision after exits before or after registry publication. Changed policy kept it unresolved. Exact historical and conflicting retries preserved a newer registration. These use fixture identities and do not prove native authorization.
    • A separate current-API check passed locally and independently. Two independent Git repositories can use the same admission journal, and its total-capacity limit spans both. Splitting journals changed that limit's scope in the control. The final registry must therefore discover shared resources and every registered consumer; root-only enrollment is not enough.

    All owned workers ended before fixture removal. No production source or default changed. Shared-resource discovery, trusted enrollment, common writer integration and the native acceptance remain open. Claude's active PR302 now includes the state tool and its tests; those integration edits are deferred while independent design work continues.

    Shared-resource enrollment and discovery experiment

    A new disposable experiment tests the resource-owned registry proposal. The chief and an independent reviewer each passed 11/11 cases. This uses actual independent Git repositories, worker processes, core locks and the current admission journal. It does not change production source or defaults.

    • Forced exits after the resource intent, repository reference and consumer-generation write left enrollment incomplete. Existing and new consumers both refused work, with unchanged journal bytes.
    • Exact recovery completed one generation and preserved the original intent. Enrollment itself granted no work. A later beta reservation occupied the shared total capacity and correctly prevented alpha from reserving it.
    • Changed policies or a changed repository reference kept recovery unresolved. Historical and conflicting retries preserved later membership.
    • A caller found another repository's pending command through the shared resource's consumer registry, even before any resource-local pointer existed.
    • A deterministic discovery barrier let a second repository enroll before the first acquired its locks. The first released and rediscovered, then applied the new consumer's denying policy.
    • Two deliberately broken caller-only controls actually wrote reservations despite unfinished work elsewhere. The corresponding complete-discovery checks refused them.

    The independent review is clean for this bounded mechanism. All owned workers closed before fixture cleanup. The artifacts remain local; no production implementation or native acceptance is claimed.

    Still required: trusted resource bindings, a complete consumer inventory, exclusion of older writers, the complete writer/read-dependency migration, general recovery and native team evidence. The discovery finding and this issue remain open. Claude PR #302 still owns overlapping state/test files; PR #300 and paused PR #298 also remain excluded from Codex edits.

    Resource binding: current API diagnostic

    The chief and an independent reviewer each observed all 8/8 diagnostic cases, with no failures, cancellations or skips. These are diagnostic observations, not eight proofs of a completed repair.

    Using the current configuration and admission APIs, an exact copy replacing the configured journal or its parent received a real reservation through the unchanged frozen path. The retained original stayed unchanged. A prior stat/content check and an unused directory descriptor did not bind the subsequent path-based publisher. Stable publication worked; existing symlink and missing-path refusals also worked.

    The fixture itself controls its disposable directories and uses synthetic task/session identities. This does not prove an installed exploit or untrusted model access to those directories. It does demonstrate why the planned coordinator cannot rely on frozen paths or an independent preflight.

    The binding contract now separates object identity, namespace authority, current state and task authority. All must hold at the actual consumer. The trusted locator, complete writer migration, original-intent recovery, relocation and native activation gates remain open. No production files or defaults changed.

    The latest released-source check resolved Codex 0.163.0 to 83086188ae0614bd882818ff1aa23f3194962012. Its inspected filesystem interface, local/remote write paths and Unix no-follow writer do not accept a retained target capability or expected earlier object identity. No-follow traversal remains useful protection; it is not the missing earlier-review binding. This is source evidence, not a new native trial or proof that every alternative is absent.

    Next work must reach the actual publisher or executor boundary. Another wrapper-only path check will not close #239, #243 or #295. Claude's open shared-state work remains excluded.

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