Repository navigation
refactor(codex): deduplicate generated protocol schemas - #117382
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 7:57 AM ET / 11:57 UTC. ClawSweeper reviewWhat this changesThe PR moves repeated Codex app-server JSON Schema definitions into one generated shared document, then restores each runtime validator’s reachable local definitions before TypeBox compiles it. Merge readinessKeep this PR open for maintainer review. The implementation is coherent from the inspected OpenClaw generator and validator paths, but this environment cannot complete OpenClaw’s mandatory direct Codex and TypeBox dependency-contract pass: Priority: P3 Review scores
Verification
How this fits togetherThe Codex plugin mirrors selected Codex app-server schemas during a sync step, then uses those schemas to validate app-server responses that drive thread, turn, model, and tool-call handling. This PR changes the generated mirror’s storage shape while preserving the local schema shape consumed by the validator. flowchart LR
Upstream[Codex app-server schemas] --> Sync[OpenClaw schema sync]
Sync --> Mirror[Generated schema mirror]
Mirror --> Materialize[Validator restores reachable definitions]
Materialize --> Compile[TypeBox validator compilation]
Compile --> Runtime[Codex thread and turn handling]
Decision needed
Why: Repository policy explicitly forbids a Codex verdict without direct sibling-source inspection, which this read-only environment cannot perform; deciding whether existing contributor evidence substitutes for that unavailable check is maintainer intent. Before merge
Agent review detailsSecurityNone. PR surfaceSource -6369, Tests +85, Other +204. Total -6080 across 13 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Repeat the exact-tag upstream exporter and TypeBox contract check in an environment with the required sibling Codex checkout, then validate the resulting merge commit’s generator reconstruction and Codex plugin validator paths before landing. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors generated schema storage rather than reporting a user-visible defect. The relevant after-change proof is reconstruction plus live validator compilation, which cannot be independently rerun here because required dependency sources are unavailable. Is this the best way to solve the issue? Unclear: the compact-and-materialize design matches the inspected OpenClaw owner boundaries, but it needs the mandatory direct Codex exporter and TypeBox resolver review before it can be called the best safe solution. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3777f009d0d6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
Summary
$refvalues, and materialize only its reachable closure before the existing TypeBox validator compilationRoot cause and owner
The committed OpenClaw mirror copied the upstream exporter standalone-file shape verbatim. That is correct for external standalone exports, but in this private generated mirror it repeated 191 definition occurrences even though only 55 unique definition bodies exist. The sync/generation boundary owns that duplication; runtime validation owns resolving the compact representation before compilation.
The canonical fix leaves the upstream exporter and dependency pin untouched, removes repeated per-root
definitionsblocks from the private mirror, and teaches both generator verification and the validator owner how to reconstruct the exact source closure.Contract evidence
Pinned Codex source:
rust-v0.146.0/e363b08.codex-rs/app-server-protocol/src/bin/export.rs:23-34: exporter entry point emits TypeScript and JSON with the experimental option.codex-rs/app-server-protocol/src/export.rs:197-255,1000-1142,1332-1377,1567-1663: bundle extraction, standalone schema writing, and reference rewriting.codex-rs/app-server-protocol/src/schema_fixtures.rs:84-114and126-209: canonical regeneration and fixture comparison.The three exporter/fixture files above are byte-identical in the inspected sibling Codex checkout at
07490c75234ed3c63291a8eb7629f04f647038fa; protocol sources outside them differ, so all live generation proof used the exact pinned tag.Pinned TypeBox source:
1.3.6/41f0b1d.src/compile/compile.ts:47-52: one-argumentCompilesupplies an empty external context.src/schema/engine/ref.ts:60-74andsrc/schema/engine/_stack.ts:94-105: unresolved refs resolve tofalse; context/root resolution is explicit.src/schema/resolve/ref.ts:133-137: URI resolution starts from the supplied schema root.Therefore the plugin materializes the exact reachable shared definitions and restores local refs before the unchanged one-argument compile call.
Consumer audit found no
$idor external refs in the eight sources, no same-name definition conflicts, no browser/public/docs imports, and no raw-path consumers. Seven roots are private validator imports;GetAccountResponseis generator/check-only. Published@openclaw/codexartifacts bundle schema data into JavaScript and omit raw JSON.Size
Proof
OPENCLAW_CODEX_REPO=<rust-v0.146.0> pnpm codex-app-server:protocol:check: passed; every compact root expands to its upstream schemaf01d7f3fcfde04677ae8ac992b6797ce24738ac2ac61548e29ef45ca3aef7dc1pnpm test extensions/codex: 147 files, 3,217/3,217 tests passedpnpm build: passed, including Control UI/browser buildscripts/plugin-npm-publish.sh --pack-dry-run extensions/codex: passed; 50 package entries, zero raw JSON files; representative formerly duplicated definition text occurs once in built JavaScriptpnpm check:changed: passed after the final type assertion fix.agents/skills/autoreview/scripts/autoreview --mode local --engine codex --model gpt-5.6-sol --thinking xhigh --stream-engine-output: clean, no accepted/actionable findings, confidence 0.96No dependency, protocol version, public API, plugin manifest, browser API, config, persistence, or package file contract changes.