Skip to content

feat(codex): deliver cross-provider catch-up via turn/start.additionalContext - #83

Merged
qiankunli merged 1 commit into
mainfrom
feat/codex-sync-via-additional-context
Jul 13, 2026
Merged

feat(codex): deliver cross-provider catch-up via turn/start.additionalContext#83
qiankunli merged 1 commit into
mainfrom
feat/codex-sync-via-additional-context

Conversation

@qiankunli

Copy link
Copy Markdown
Collaborator

Replaces thread/inject_items (standalone user-role message) as the codex
catch-up channel. Injecting a bare user message leaves a dangling entry
in the native rollout with no matching turn, pollutes codex-native
history, and the eager-injection watermark advanced before the content
was tied to any turn.

  • PromptInput.syncBlocks: catch-up context that must ride the same
    submit; admission failure means not-delivered (watermark untouched,
    re-injected next turn) — same semantics as the prepend path
  • AdapterCapabilities.sync marker: adapter natively carries syncBlocks
    as a side-channel; without it the runtime falls back to prepending
    into the prompt text
  • runtime: sync-capable adapters get syncBlocks instead of a text
    prepend; watermark advances only after admission for both shapes
  • codex adapter: drops syncContext/inject_items, declares sync, maps
    syncBlocks to turn/start.additionalContext {baton-sync: {value,
    kind: untrusted}} — codex records it as a contextual fragment inside
    the turn and it bypasses UserPromptSubmit hooks
  • verified against live codex 0.144.1 app-server: model answered the
    secret word embedded in additionalContext and the turn completed
    normally

Claude adapter (eager syncContext path) is unchanged.

…lContext

Replaces thread/inject_items (standalone user-role message) as the codex
catch-up channel. Injecting a bare user message leaves a dangling entry
in the native rollout with no matching turn, pollutes codex-native
history, and the eager-injection watermark advanced before the content
was tied to any turn.

- PromptInput.syncBlocks: catch-up context that must ride the same
  submit; admission failure means not-delivered (watermark untouched,
  re-injected next turn) — same semantics as the prepend path
- AdapterCapabilities.sync marker: adapter natively carries syncBlocks
  as a side-channel; without it the runtime falls back to prepending
  into the prompt text
- runtime: sync-capable adapters get syncBlocks instead of a text
  prepend; watermark advances only after admission for both shapes
- codex adapter: drops syncContext/inject_items, declares sync, maps
  syncBlocks to turn/start.additionalContext {baton-sync: {value,
  kind: untrusted}} — codex records it as a contextual fragment inside
  the turn and it bypasses UserPromptSubmit hooks
- verified against live codex 0.144.1 app-server: model answered the
  secret word embedded in additionalContext and the turn completed
  normally

Claude adapter (eager syncContext path) is unchanged.
@qiankunli
qiankunli merged commit d9e1063 into main Jul 13, 2026
Comment thread src/session/runtime.ts
...session.meta.providerSessions[key],
provider: key,
providerSessionId:
session.meta.providerSessions[key]?.providerSessionId ?? this.nativeSessionId(slot),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🤖 devloop code-review · seed-2.1-pro

Inconsistent access pattern for existing session data between two setProviderSession calls: the syncContext path (line 476) spreads the captured meta variable, while the post-submit path (line 506) re-reads session.meta.providerSessions[key]. Since the two paths are mutually exclusive (syncContext vs. sync/prepend), they produce equivalent results, but the inconsistency could confuse future readers or become fragile if the code is restructured. Consider using meta consistently in both paths, or re-reading from session.meta.providerSessions[key] in both.

ccr:fp=578e330df5d0

@qiankunli

Copy link
Copy Markdown
Collaborator Author

🤖 devloop code-review · origin/main..HEAD · e14c29807 · models: deepseek-v4-pro×10, seed-2.1-pro×9, seed-2.1-turbo×9 · cost: 566s · ccr v1.8.0

1 finding(s)(1 条已内联到 diff 行)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants