Skip to content

feat(codex): fork upstream-linked sessions at a message via thread/fork - #111149

Merged
steipete merged 10 commits into
mainfrom
claude/codex-upstream-fork
Jul 19, 2026
Merged

steipete merged 10 commits into
mainfrom
claude/codex-upstream-fork

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

sessions.fork (#110660) rejects sessions whose conversation is owned by an external agent harness — for Codex-app-server-backed sessions the canonical history lives in Codex rollout files addressed by threadId, so a local-mirror fork would diverge from the authoritative context. Fork from a message bubble therefore did not work for adopted/Continue Codex sessions. Final follow-up agreed in #110660.

Why This Change Was Made

  • New generic AgentHarness.sessionFork capability: core resolves it from the harness registry by upstream kind (single-match, fail-closed) and delegates the entire fork; core imports no plugin code. The Codex plugin registers the implementation.
  • Cut-point resolution ports Codex TUI's own backtrack algorithm (codex-rs/tui/src/app_backtrack.rs:473-544): ordinal walk over visible turn-initial user messages with steer/review-span skips, full-prefix text verification against the local transcript, and fail-closed handling of anything unverifiable (images, skills, mentions, hidden semantic inputs), in-progress turns, and drifted text. First-message cuts fork with beforeTurnId of the first turn — a valid empty-history fork (verified: thread_fork_inner has no minimum-turn guard). Paginated-history threads are rejected with a clear message (upstream forbids forking them: method_not_found("paginated_threads is not supported yet")).
  • Upstream fork uses thread/fork + experimental beforeTurnId (the shared client already negotiates experimentalApi), pinned to the connection fingerprint that owns the thread. Because an older app-server could silently drop the experimental field and copy full history, the forked thread is read back and its tail verified against the expected retained boundary; mismatches archive the fork and fail with a version message. A response reusing the source thread id is rejected outright and never archived.
  • The local session is materialized by importing the verified forked thread's history (the same machinery session adoption uses), so local history derives from upstream canon instead of the best-effort mirror — no equality proof between mirror and upstream is needed beyond the cut mapping. Marker/covered-through derive from the standard adoption helpers; the upstream link is written before the binding so any crash window leaves a fail-closed (upstream-owned, unbound) session, never a locally mutable one. All compensation (archive fork, clear binding, delete link) lives in the capability.
  • Rewind, branch switch, and branch listing stay rejected for upstream-linked sessions (in-place mutation of shared upstream history; upstream thread/rollback is deprecated). Covered by tests including the previously masked capability-registered case.
  • Plugin SDK surface intentionally grows by the harness fork contracts and the upstream-link registry write/delete (ledger updated in scripts/plugin-sdk-surface-report.mjs with rationale). Protocol unchanged.

User Impact

"Fork from here" now works on Codex-backed (adopted/Continue) sessions in every surface that calls sessions.fork: it forks the real Codex thread at the chosen message, creates a new OpenClaw session whose history is imported from that fork, and binds it for the next turn. Unsupported cases fail with precise, actionable errors (steered messages, in-progress turns, image-bearing spans, paginated threads, old Codex versions) instead of generic failures.

Evidence

  • Upstream contracts verified directly in the sibling codex-rs checkout: app-server-protocol/src/protocol/v2/thread.rs:495-626 (fork params/response, experimental gating), common.rs:494-499, app-server/src/request_processors/thread_processor.rs:3702+ (fork mechanics, paginated rejection, no empty-fork guard), core/src/thread_rollout_truncation.rs:162-235 (before/after truncation asymmetry), tui/src/app_backtrack.rs:473-544 (reference cut algorithm).
  • node scripts/run-vitest.mjs src/gateway/server-methods/sessions-rewind.test.ts — 20 tests: capability delegation, typed failure pass-through, rewind/switch rejection for upstream links (with and without a registered capability), non-upstream paths unchanged.
  • node scripts/run-vitest.mjs extensions/codex/src/app-server/upstream-fork-boundary.test.ts extensions/codex/src/app-server/upstream-session-fork.test.ts — 15 tests: ordinal/prefix/steer/review/in-progress/drift/unverifiable-input/first-turn/paginated boundaries; verified import, version-skew read-back mismatch → archive + typed failure, source-id reuse rejection, compensation, fresh-target materialization.
  • pnpm tsgo:core + pnpm tsgo:extensions green locally; oxlint/oxfmt clean; pnpm plugin-sdk:surface:check green after the ledger update.
  • Seven autoreview cycles (codex gpt-5.6-sol) drove the design here — findings on cut semantics, marker baselines, crash ordering, drift-guard completeness, and version skew were each verified against codex-rs and fixed (or, for first-message forks, corrected back per upstream evidence); the final cycle on the import-based design reported no actionable findings.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling extensions: codex size: XL maintainer Maintainer-authored PR labels Jul 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f72ecb94a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +280 to +283
const localPrefixTexts = visibleUserEntries
.slice(0, userMessageOrdinal + 1)
.map((entry) => localMessageText(entry.message.content));
const turns = await listCodexUpstreamTurns(params.control, params.threadId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align fork mapping with bounded imported history

When an adopted Codex thread exceeds the import limits, transcript-mirror.ts:42-44,242-261 retains only the newest 200 messages/512 KiB, but this code treats that retained tail as ordinal zero and compares it against the upstream thread from its first turn. Consequently, any fork from a message in a truncated imported session reports drift-mismatch before reaching the selected upstream message, even though the visible tail is valid. Map using persisted mirror identities or align the local tail against the corresponding upstream suffix.

Useful? React with 👍 / 👎.

Comment on lines +140 to +141
if (reviewMode || hiddenNestedReviewTurn) {
continue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep review messages consistent between import and fork mapping

For threads containing a review span before the selected message, this skips the upstream userMessage, while transcript-mirror.ts:172-199 imports every userMessage in that same span as an ordinary visible local user entry. The next visible local ordinal therefore compares the review prompt against a later upstream prompt and every such fork fails with drift-mismatch; either exclude these messages during import or consume the corresponding local entry while resolving the boundary.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 19, 2026
@clawsweeper

clawsweeper Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 19, 2026, 2:46 AM ET / 06:46 UTC.

Summary
Adds generic harness-driven forking for Codex app-server-linked sessions, with verified upstream thread cuts, imported fork history, and an upstream binding for the new session.

PR surface: Source +800, Tests +634, Other +3. Total +1437 across 19 files.

Reproducibility: not applicable. This PR adds support for a previously rejected upstream-owned-session fork path rather than repairing an established current behavior contract. The reported focused tests provide source-level coverage, but no final-head live Codex app-server run is included.

Review metrics: 2 noteworthy metrics.

  • Public fork contract: 1 new AgentHarness capability; 3 exported harness contract types. This is a new plugin-facing API commitment, not only a Codex implementation detail.
  • Upstream-link SDK access: 2 new public mutation exports. Plugins can now create and remove persisted upstream session links, so upgrade and ownership expectations need review.

Stored data model
Persistent data-model change detected: serialized state: extensions/codex/src/app-server/session-history-import.ts, serialized state: extensions/codex/src/session-catalog-types.ts, serialized state: extensions/codex/src/session-catalog.ts, serialized state: src/gateway/server-methods/sessions-rewind.test.ts, serialized state: src/gateway/server-methods/sessions-rewind.ts, serialized state: src/plugin-sdk/session-catalog.ts, and 4 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #110660
Summary: This PR is the candidate implementation for the Codex upstream-linked-session limitation intentionally left by the merged message-bubble fork feature.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted live Codex app-server proof for a selected-message fork on an adopted/Continue session, including the next resumed turn on the fork.
  • Get explicit maintainer acceptance for the public AgentHarness and session-catalog SDK additions.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body reports unit tests and static checks, but no inspected final-head live Codex app-server evidence shows the selected-message fork, verified imported target, subsequent binding reuse, and unchanged source. Please add a redacted terminal transcript, runtime logs, recording, or linked artifact; redact private endpoints, IPs, keys, and user data. Updating the PR body should trigger review, or a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The new public AgentHarness sessionFork and session-catalog mutation exports create a compatibility-sensitive plugin SDK contract that needs explicit maintainer acceptance and a durable ownership/deprecation posture.
  • [P1] The feature creates and binds persisted upstream-linked session state; final-head proof should demonstrate that the fork resumes through the originating Codex supervision connection, imports the intended prefix, leaves the source unchanged, and does not fall back to a fresh thread.

Maintainer options:

  1. Prove and accept the SDK contract (recommended)
    Obtain maintainer acceptance for the public harness/session-catalog exports and add redacted final-head live evidence covering fork, imported history, binding reuse, and source preservation.
  2. Narrow the API before merge
    If maintainers do not want a supported generic harness fork contract yet, move the behavior behind a narrower existing Codex-owned seam and avoid exporting parallel public APIs.

Next step before merge

  • [P1] A maintainer must accept the new public plugin-SDK contract, and the contributor must provide final-head live Codex app-server proof; neither is a safe automated repair task.

Maintainer decision needed

  • Question: Should OpenClaw make the generic AgentHarness sessionFork capability and upstream-link registry mutation helpers part of the supported public plugin SDK for upstream-owned session forks?
  • Rationale: The implementation follows the intended core/plugin boundary, but the added SDK API is a persistent compatibility commitment that tests alone cannot define.
  • Likely owner: steipete — Authored both the original fork feature and this Codex-specific follow-up, including the proposed plugin-SDK contract.
  • Options:
    • Accept the generic SDK seam (recommended): Keep the capability and registry helpers public, with Codex as the first implementation, after final-head live proof confirms the end-to-end session lifecycle.
    • Keep it Codex-internal for now: Rework the feature behind existing internal Codex ownership boundaries and defer public SDK exposure until another harness has a concrete need.

Security
Cleared: The reviewed branch adds no dependency, workflow, secret, permission, download, publishing, or new code-execution surface; its stateful operations stay within the existing Codex control and session-link boundaries.

Review details

Best possible solution:

Retain the generic core capability with the Codex-specific implementation, but land only after an owner accepts the public SDK contract and final-head live proof demonstrates an adopted Codex session fork through the next resumed turn.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR adds support for a previously rejected upstream-owned-session fork path rather than repairing an established current behavior contract. The reported focused tests provide source-level coverage, but no final-head live Codex app-server run is included.

Is this the best way to solve the issue?

Yes, conditionally: delegating an upstream-owned fork through a generic harness capability is cleaner than having core import Codex behavior, but maintainers must first accept the resulting public SDK contract and verify the state transition in a real app-server session.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against aaacee8166cd.

Label changes

Label justifications:

  • P2: This is a bounded feature for Codex-backed sessions, but it changes a compatibility-sensitive session lifecycle path.
  • merge-risk: 🚨 compatibility: The PR expands the public plugin SDK with new harness and session-catalog contracts.
  • merge-risk: 🚨 session-state: The new flow creates imported session state and binds it to an upstream thread for subsequent turns.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports unit tests and static checks, but no inspected final-head live Codex app-server evidence shows the selected-message fork, verified imported target, subsequent binding reuse, and unchanged source. Please add a redacted terminal transcript, runtime logs, recording, or linked artifact; redact private endpoints, IPs, keys, and user data. Updating the PR body should trigger review, or a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +800, Tests +634, Other +3. Total +1437 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 14 847 47 +800
Tests 4 635 1 +634
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 5 2 +3
Total 19 1487 50 +1437

What I checked:

  • Merged feature provenance: The related merged PR introduced message-bubble fork/rewind but explicitly rejected externally owned harness sessions; this PR is the stated Codex-specific follow-up for that remaining case. (src/gateway/server-methods/sessions-rewind.ts:190, 0acece45912d)
  • Plugin-owned implementation boundary: The branch adds an optional sessionFork capability on AgentHarness and resolves it from the harness registry by upstream kind; the Codex implementation remains under extensions/codex rather than being imported by core. (src/agents/harness/types.ts:131, 5f9a3f33be7d)
  • Session-state safety design: The Codex fork path verifies the upstream result, imports that verified thread into a new local session, writes the upstream link, and binds the new session; this is the central stateful behavior requiring final-head runtime proof. (extensions/codex/src/app-server/upstream-session-fork.ts:38, 5f9a3f33be7d)
  • Current review cycle: The prior ClawSweeper review had no code findings but required real behavior proof. The current PR body reports focused tests, type checks, lint, and SDK surface checks, but contains no inspected live Codex app-server fork transcript, terminal output, log, recording, or artifact for the final head. (5f9a3f33be7d)
  • Public SDK surface expansion: The branch exports three harness session-fork types and exposes upstream-link write/delete helpers through plugin-SDK barrels, with the SDK surface budget updated accordingly. (src/plugin-sdk/agent-harness-runtime.ts:51, 5f9a3f33be7d)

Likely related people:

  • steipete: Authored the current branch and the merged message-bubble fork feature that established the externally owned-session limitation this PR addresses. (role: feature author and prior merged feature contributor; confidence: high; commits: 0acece45912d, 5f9a3f33be7d; files: src/gateway/server-methods/sessions-rewind.ts, extensions/codex/src/app-server/upstream-session-fork.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (3 earlier review cycles)
  • reviewed 2026-07-19T03:44:05.282Z sha 3f72ecb :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-19T05:20:41.407Z sha 3f72ecb :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-19T06:02:01.083Z sha 26f1934b194dab784b4ecd506b5763a19d4cbd83 :: needs real behavior proof before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot reopened this Jul 19, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 19, 2026
@steipete
steipete force-pushed the claude/codex-upstream-fork branch from 3f72ecb to 26f1934 Compare July 19, 2026 05:58
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 26f1934b19

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +180 to +184
binding: {
threadId,
cwd: forkedThread.cwd ?? "",
model: response.model,
modelProvider: response.modelProvider ?? undefined,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the fork's supervision connection in the binding

With the default stdio configuration, the catalog forks on the user-home supervision connection (extensions/codex/src/session-catalog.ts:238-239), while ordinary harness runs default to the agent home (extensions/codex/src/app-server/config.ts:603-605). This binding omits the connectionScope: "supervision", source/fingerprint, and native-ownership fields required by extensions/codex/src/app-server/session-binding.ts:178-186,233-257, so the first message in the newly forked session tries to resume the user-home thread from the agent-home app server; the resume rejection is then handled by clearing the binding and starting a fresh thread, severing the canonical fork lineage.

Useful? React with 👍 / 👎.

Comment on lines +280 to +282
const localPrefixTexts = visibleUserEntries
.slice(0, userMessageOrdinal + 1)
.map((entry) => localMessageText(entry.message.content));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match mirrored messages using their canonical upstream text

When a post-adoption turn is decorated with OpenClaw workspace or inbound context, the visible transcript retains the user's original content while the exact text sent to Codex is stored as __openclaw.upstreamUserText by extensions/codex/src/app-server/transcript-mirror.ts:446-452. Building the comparison prefix only from message.content therefore compares the undecorated local text with the decorated upstream userMessage, causing drift-mismatch for otherwise valid fork points; use the persisted upstream text for identity verification while retaining the visible content for editorText.

Useful? React with 👍 / 👎.

@steipete steipete self-assigned this Jul 19, 2026
@clawsweeper

clawsweeper Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: feat(codex): fork upstream-linked sessions at a message via thread/fork This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e6fdaa7eac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"A message before the fork point contains images or attachments that cannot be verified across OpenClaw and Codex. Fork from a text-only span instead.",
);
}
if (display.text !== localText) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match against the imported prompt representation

When an adopted thread contains a prompt with leading/trailing whitespace or more than 64 KiB of text, its local entry is trimmed or truncated by extensions/codex/src/app-server/transcript-mirror.ts:90-103, while userMessageDisplay retains the raw upstream text. This exact comparison therefore returns drift-mismatch for that entry and every later fork point even though the transcript was imported from the same thread. Preserve canonical upstream text during import or compare using the same projection.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the claude/codex-upstream-fork branch from e6fdaa7 to 5f9a3f3 Compare July 19, 2026 06:43
@steipete
steipete merged commit ea54060 into main Jul 19, 2026
118 checks passed
@steipete
steipete deleted the claude/codex-upstream-fork branch July 19, 2026 07:11
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 20, 2026
…rk (openclaw#111149)

* feat(codex): fork upstream-linked sessions at a message via thread/fork

* fix(gateway): fail closed for rewind and branch switch on upstream-linked sessions

* fix(codex): fail closed on first-message forks, image-only prompts, and orphan archival

* fix(codex): baseline retained history and reject paginated threads on upstream fork

* fix(codex): validate the full fork prefix and fail closed across crash windows

* fix(codex): treat all non-text inputs as unverifiable in fork drift checks

* fix(codex): support first-message forks as empty-history upstream cuts

* fix(codex): reject source-id reuse and unverifiable hidden inputs in fork boundaries

* refactor(codex): materialize upstream forks from verified thread read-back

* fix(codex): satisfy strict type lanes and knip for upstream fork
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…rk (openclaw#111149)

* feat(codex): fork upstream-linked sessions at a message via thread/fork

* fix(gateway): fail closed for rewind and branch switch on upstream-linked sessions

* fix(codex): fail closed on first-message forks, image-only prompts, and orphan archival

* fix(codex): baseline retained history and reject paginated threads on upstream fork

* fix(codex): validate the full fork prefix and fail closed across crash windows

* fix(codex): treat all non-text inputs as unverifiable in fork drift checks

* fix(codex): support first-message forks as empty-history upstream cuts

* fix(codex): reject source-id reuse and unverifiable hidden inputs in fork boundaries

* refactor(codex): materialize upstream forks from verified thread read-back

* fix(codex): satisfy strict type lanes and knip for upstream fork
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: codex gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant