[codex] Add transcript repair runtime contracts#71042
[codex] Add transcript repair runtime contracts#71042100yenadmin wants to merge 2 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR adds Phase 1 transcript-repair contract tests covering Pi orphan-user-prompt merging and Codex context projection, with no changes to production code. The test fixtures are accurate, the expected values are correctly derived from production logic (e.g. the 4118-char data-URI count, the `[QUEUED_USER_MESSAGE_MARKER] ... Confidence Score: 5/5Test-only change with no production code modifications; safe to merge. All three new files are test/helper code only. Fixture values match production logic exactly (verified manually), no P0/P1 issues found, and the afterEach cleanup guard prevents strategy-override leakage between tests. No files require special attention. Reviews (1): Last reviewed commit: "test: add transcript repair runtime cont..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
Adds Phase 1 transcript-repair “runtime contract” coverage (test-only) to lock current Pi orphan-leaf merge behavior and Codex context projection behavior ahead of the RFC #71004 runtime-plan refactor work.
Changes:
- Introduces shared test fixtures for transcript-repair scenarios (text, structured, inline data URI, media-only history).
- Adds Pi contract tests for orphan trailing-user prompt merging and the message-merge-strategy seam.
- Adds Codex contract tests for context-engine projection behavior (dropping duplicate trailing prompt; keeping media-only history as omitted media).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/helpers/agents/transcript-repair-runtime-contract.ts | Shared fixtures/constants for transcript-repair contract tests. |
| src/agents/pi-embedded-runner/run/transcript-repair-runtime-contract.test.ts | Pi-side contract tests for orphan-leaf merging and strategy seam. |
| extensions/codex/src/app-server/transcript-repair-runtime-contract.test.ts | Codex-side contract tests for prompt projection and media omission behavior. |
|
@steipete gpt 5.4 fixes contract layer |
Summary
Adds the transcript-repair contract rung from RFC #71004. This is test-only: it does not change Pi runtime behavior, Codex app-server behavior, or production transcript repair code.
Files Changed And Why
test/helpers/agents/transcript-repair-runtime-contract.tssrc/agents/pi-embedded-runner/run/transcript-repair-runtime-contract.test.tsextensions/codex/src/app-server/transcript-repair-runtime-contract.test.tsContract Matrix
Known Boundary
Codex coverage is projection-only in this phase. A shared Codex transcript repair strategy belongs in
AgentRuntimePlanconsumption, not in this test-only PR.How This Helps The RuntimePlan Work
Transcript repair is OpenClaw-owned policy. These fixtures make payload-shape behavior explicit before the plan centralizes text, structured content, media, and data URI handling.
Reviewer Notes
Verification
node scripts/run-vitest.mjs run --config test/vitest/vitest.agents.config.ts src/agents/pi-embedded-runner/run/transcript-repair-runtime-contract.test.tsnode scripts/run-vitest.mjs run --config test/vitest/vitest.extensions.config.ts extensions/codex/src/app-server/transcript-repair-runtime-contract.test.ts./node_modules/.bin/oxlint --tsconfig tsconfig.oxlint.core.json test/helpers/agents/transcript-repair-runtime-contract.ts src/agents/pi-embedded-runner/run/transcript-repair-runtime-contract.test.ts extensions/codex/src/app-server/transcript-repair-runtime-contract.test.tsgit diff --check -- test/helpers/agents/transcript-repair-runtime-contract.ts src/agents/pi-embedded-runner/run/transcript-repair-runtime-contract.test.ts extensions/codex/src/app-server/transcript-repair-runtime-contract.test.tsRefs #71004
Follows #71009, #71029, #71038, #71039