Skip to content

fix(sdk): persist Codex step history - #617

Merged
khaliqgant merged 1 commit into
mainfrom
fix/persist-provider-history
Oct 6, 2026
Merged

khaliqgant merged 1 commit into
mainfrom
fix/persist-provider-history

Conversation

@kjgbot

@kjgbot kjgbot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • keep Codex model-readiness probes ephemeral
  • let real agent and llm steps persist their native Codex sessions
  • pin the persistent argv contract in adapter and live-kernel tests

Why

Cloud teardown now uses the released headless Relayhistory probe successfully, but a real hosted smoke run completed with exitReason=drained, sessionsCaptured=0, and acknowledgedRecords=0. The released Flow runtime launches real Codex steps with --ephemeral, so Codex deliberately writes no session under CODEX_HOME/~/.codex for the teardown uploader to capture.

Verification

npx vitest run tests/adapters/codex.test.ts tests/adapters/registry.test.ts tests/cli-adapter.test.ts tests/live-kernel.test.ts -t codex... --maxWorkers=1 --minWorkers=1
Test Files 4 passed (4)
Tests 13 passed | 34 skipped (47)

npm run typecheck
PASS
npm run typecheck:tests
PASS
npm run build
PASS

npx vitest run tests/worker-cli.test.ts tests/real-cli-adapters.test.ts --maxWorkers=1 --minWorkers=1
23 passed; 2 unrelated timing-sensitive wrapper tests failed under the combined run. Both passed immediately when rerun alone (2 passed).

The monolithic macOS suite was also attempted. Its adapter/build gates passed, then unrelated Linux-only isolation tests and widespread 5-second parallel timeouts failed; focused and affected suites above are green.


Note

Medium Risk
Changes the Codex CLI contract for all agent/llm steps (persistent sessions on disk), which affects hosted history capture but is intentional and narrowly scoped with test pins.

Overview
Fixes hosted runs reporting zero captured Codex sessions by stopping use of --ephemeral on real workflow invocations.

Agent and LLM Codex exec argv no longer include --ephemeral, so steps can write native session data under CODEX_HOME / ~/.codex for Relayflow teardown to flush into Relayhistory. Model readiness probes still use --ephemeral because they are diagnostics, not steps.

Adapter tests, cli-adapter expectations, and the live-kernel Codex argv contract are updated to assert the persistent argv shape (no --ephemeral on agent/llm; still present on probes).

Reviewed by Cursor Bugbot for commit e310a18. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f3ac7375-5487-4c3d-a556-45cedc04dd18
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 4 files

Re-trigger cubic

@kjgbot

kjgbot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

maintainability lens — UNCLEAR

You've hit your weekly limit · resets Oct 7 at 3am (America/Los_Angeles)

@kjgbot

kjgbot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

history lens — PASS

Blockers: none.

Concerns

  • The tests only pin the generated argv (packages/sdk/tests/adapters/codex.test.ts:30-50, packages/sdk/tests/live-kernel.test.ts:1106-1110); they do not demonstrate an actual Codex session being captured during teardown. That is an evidence gap, not a HISTORY blocker, because the PR does not falsely claim a post-fix end-to-end capture.

Notes

  • No DRIVE-LOG mistake is repeated. --ephemeral originated in the earlier CLI/model contract and was preserved by the adapter refactor; history records no deliberate decision that real workflow steps must discard provider sessions. Readiness probes remain ephemeral.
  • No settled RFC-0001 decision is contradicted. Removing --ephemeral for real agent and LLM invocations (packages/sdk/src/adapters/codex.ts:38-49, :59-63) preserves a trajectory for bounded archival; it does not make the agent process resident or use the native session as durable execution state. This supports Gate 5’s requirement that trajectories reach Relayhistory. The RFC’s “ephemeral agents” rule concerns process lifetime, not deletion of post-step evidence.
  • The commit subject, fix(sdk): persist Codex step history, accurately describes the diff. Codex documents --ephemeral as running without persisting session files; the change removes that flag from real steps while retaining it for diagnostics. The commit message makes no claims about tests, evidence, or additional files.

REVIEW_PASSED

@kjgbot

kjgbot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

structure lens — UNCLEAR

Error: Error from provider (Console): OpenCode's free tier can only be used from within OpenCode

@kjgbot

kjgbot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

🎯 review-swarm: FAILED (M:unclear H:pass S:unclear)

Lens transcripts posted as sibling comments above.

@kjgbot
kjgbot requested a review from khaliqgant October 6, 2026 05:00
@khaliqgant
khaliqgant merged commit a32faa2 into main Oct 6, 2026
9 of 10 checks passed
@khaliqgant
khaliqgant deleted the fix/persist-provider-history branch October 6, 2026 13:04
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