Repository navigation
Description
Summary
I have been testing a downstream Codex runtime where the logical unit of production work is durable independently of the Codex thread that is currently reasoning about it.
The experiment is intentionally narrow:
Thread = one cognition execution
Work = durable production identity
This is not a request to merge the downstream runtime into Codex. I am trying to understand whether Codex intends Thread / thread-scoped Goal to remain the canonical identity for long-running work, or whether a generic work/task identity independent of a cognition thread would be useful as an extension/runtime primitive.
Observed upstream while preparing this issue:
openai/codexmain:c7e80f873f67dbef58206b9d4f3c60e9d556eb16- thread goals are durable, but their persisted record is still thread-scoped (
thread_idis the primary key) - Codex already exposes useful extension seams such as
ThreadLifecycleContributor,TurnLifecycleContributor,ToolLifecycleContributor, extension-private stores, projects, goals, and persisted agent topology
Why I tested this
For multi-agent or long-running production workflows, the logical task may need to survive:
- thread completion or replacement
- process restart
- model replacement
- child-agent completion
- a later thread continuing the same unfinished objective
A thread can persist and resume, but that is not always the same semantic requirement as saying that the work itself has an identity independent of whichever thread/model is currently attached to it.
The concrete question I wanted to test was:
Can Codex cognition remain transient while production work identity survives independently and is rebound to later threads?
Downstream experiment
Reference implementation:
- repo: https://github.com/4LFR3Dv1/brinecdx
- tested line:
bcdx/r3-workgraph - pinned witness commit:
b649a01834dfeca79e54afbb08f5108121a0b7f2
Relevant implementation:
- runtime model:
https://github.com/4LFR3Dv1/brinecdx/blob/b649a01834dfeca79e54afbb08f5108121a0b7f2/codex-rs/brine-runtime/src/model.rs - durable authority:
https://github.com/4LFR3Dv1/brinecdx/blob/b649a01834dfeca79e54afbb08f5108121a0b7f2/codex-rs/brine-runtime/src/authority.rs - Codex lifecycle adapter:
https://github.com/4LFR3Dv1/brinecdx/blob/b649a01834dfeca79e54afbb08f5108121a0b7f2/codex-rs/ext/brine-runtime/src/lib.rs - deterministic R3 witness:
https://github.com/4LFR3Dv1/brinecdx/blob/b649a01834dfeca79e54afbb08f5108121a0b7f2/scripts/witness-r3-workgraph.ps1
The runtime keeps a separate identity:
WorkspaceId
WorkId
SessionId
with a record approximately shaped as:
WorkRecord {
id
workspace_id
parent_work
objective
status
assigned_thread
candidate
created_revision
last_revision
}
The Codex-facing adapter uses normal extension lifecycle contributors. It does not replace the model loop, TUI, shell semantics, compaction, or ordinary tools.
At thread start/resume, a temporary Codex thread is attached/reconciled to durable work. At thread stop, the thread detaches without deleting the work identity.
Witness
The R3 witness exercises this sequence against the real runtime implementation:
root session
-> root Work W1
child session
-> child Work W2
-> parent_work = W1
complete child
-> W2.status = complete
detach child
stop runtime process
restart runtime process
reattach child session
-> same WorkspaceId
-> same WorkId W2
-> same completed Work state
It also verifies that the child receives a distinct Work identity instead of reusing the root Work.
The important property is that destroying/replacing the temporary cognition attachment does not destroy the production identity.
Relationship to existing Codex primitives
I do not think this necessarily implies that Codex needs a new first-class public Work type.
Current primitives already cover large parts of the problem:
- persisted threads provide durable conversation/execution history
- thread goals provide durable objective/status state for a thread
- projects provide a higher-level grouping identity
- persisted agent topology tracks parent/child thread relationships
- extension-private state can maintain additional runtime data
The missing distinction in this experiment is specifically:
one logical piece of work
!=
one thread that is currently executing cognition for it
For example, a later thread can attach to the same WorkId without requiring the original thread to remain the identity of that work.
Questions for maintainers
-
Is the intended Codex model that long-running work should remain identified by a durable Thread (with Goal/Project metadata), even when cognition is replaced?
-
If an extension/runtime needs a task identity that can survive and be rebound across multiple threads, is extension-private durable state the intended solution?
-
Is there an existing or planned generic binding surface that an extension should use for something conceptually like:
thread A -> work X
thread B -> work X
child C -> work Y (parent X)
- If this distinction is useful upstream, would you prefer it to appear as:
- a generic durable task/work identity,
- a Goal evolution that is no longer strictly thread-owned,
- a Project/task relationship,
- or only a small extension API seam for binding external durable identities to threads?
Why I am asking before proposing a specific API
The downstream implementation proves the semantics, but it does not prove that its data model is the right Codex abstraction.
I would rather keep the Brine-specific graph downstream and extract only the smallest generic primitive that matches Codex's architecture.
If the intended answer is “keep this entirely extension-private,” that is also useful: it means the existing lifecycle API is already sufficient and the downstream should avoid asking Codex core to own this concept.
Potential acceptance property, if Codex does want a generic primitive
A minimal generic primitive should make it possible to demonstrate:
create/bind logical work
attach thread A
stop thread A
start thread B
attach thread B to the same logical work
preserve parent/child work lineage
preserve work status across process restart
without requiring transcript replay to reconstruct the work identity, and without changing normal Codex behavior when the primitive is unused.
Non-goals
- replacing Codex Thread/Turn semantics
- replacing Goals or Projects
- changing the model loop
- changing compaction
- changing shell/tool execution
- proposing Brine-specific types for upstream
- requiring a remote runtime for normal Codex use
The downstream exists mainly as executable evidence for the architectural question above.
Activity