Repository navigation
refactor(harness): share native output projection operations - #156187
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 23, 2026, 9:19 PM ET / September 24, 2026, 01:19 UTC (Revision 6). ClawSweeper reviewWhat this changesMoves Codex native output formatting, transcript message construction, and presentation callback settlement into shared agent-harness helpers, updates Codex callers and documentation, and relocates four formatting tests. Merge readiness✅ Ready for maintainer review Keep open. Current main and the latest release lack the shared projection owner, and the open Agents API PR depends on this branch. The updated installed Codex run addresses the earlier delivery and transcript parity concern within its stated scope; this review found no actionable patch defect. Priority: P3 Review scores
Verification
How this fits togetherCodex app-server sends native turn and item events to OpenClaw’s Codex plugin. The plugin turns those events into bounded progress, transcript messages, and callbacks used by history and reply delivery. flowchart LR
A[Codex app-server events] --> B[Codex protocol adapter]
B --> C[Shared projection helpers]
C --> D[Transcript messages]
C --> E[Presentation callbacks]
D --> F[OpenClaw history]
E --> G[Reply delivery]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +99, Tests -139, Docs +13. Total -27 across 15 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one shared owner for native output, message construction, and callback settlement while Codex retains protocol decoding, approvals, and transcript persistence. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR reorganizes existing behavior rather than reporting a current-main defect. The relevant parity path is an installed Codex app-server turn. Is this the best way to solve the issue? Yes: the existing harness boundary is a suitable owner for reusable projection operations, and the adapter retains Codex-specific protocol and persistence responsibilities. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 10145049f817. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
f1b0cf9 to
d3b4859
Compare
69216a4 to
6568fc5
Compare
d3b4859 to
8221c2e
Compare
6568fc5 to
1b8e97a
Compare
1b8e97a to
ca34ddd
Compare
|
@clawsweeper re-review Please review the current head 51545fd with the updated CI, native package build, and installed Codex evidence in the PR body. Fresh native Linux/arm64 live proof ran at descendant bdcbcab; a source comparison confirms the Codex adapter, shared harness owners, and plugin-SDK sources are unchanged between these heads. Ordinary Slack messages executed real Codex shell commands, retained exactly-once native call/result history, delivered final answers, and settled with no active run. Repeated history reads are identical. The package build compiled runtime, UI, and declarations; actual full plugin loading and dependency ownership were verified. The proof scope and remaining gaps are explicit in the body. The normalized observer did not capture a Codex command-output delta. These observations do not imply a command-streaming regression or claim unobserved streaming. This is a review request, without permission to apply logic changes. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…w#156187) * refactor(harness): share native output projection operations * style(harness): satisfy shared projection lint rules * test(agents): colocate native output formatting coverage * docs(harness): describe shared projection at its owner --------- Co-authored-by: Sarah Fortune <[email protected]>
* refactor(agents): simplify old runtime bookkeeping Use one catalog discovery pass, local-process stop promise, presentation completion path, diagnostic recovery batch, and generated-media rollback owner. Reuse directory parameter declarations and keep sandbox validation at its existing boundary without repeating the same blocked-path checks. Remove the duplicate full-map primary-probe prune. Trust JSON-normalized result previews and group identical session-export style declarations without changing their visibility or cascade rules. Keep auth/approval/sandbox policy, normal child and write settlement, transcript/user-data durability, public signatures and Phase E unchanged. Production reduction: 147 net lines across ten old-only files. Best-effort tradeoffs accepted - MCP list_changed during held sibling discovery: #138694 added a synthetic forced-overlap replay, not a cited human incident. The next load refreshes the catalog instead; retirement and execution authority remain enforced. - Competing catalog producer finalization: the same private owner forbids a replacement while its promise is present, so the identity recheck is an internal invariant, not a realistic concurrency boundary. - Local-service post-readiness exit: #154133 describes synthetic parallel qualification, not a human report requiring another health check. The following request reports an exit after readiness; normal shutdown still joins the child, streams and pending termination work. - Local-process stop identity: replacement starts only after the retained authoritative process finishes stopping. The duplicate process reference and identity comparisons cannot observe another production replacement; failed-stop retry and the retiring marker remain intact. - Synchronous presentation self-drain: #156187 extracted this reservation without a cited human incident. Production adapters drain after projection; callbacks return their own work instead of reserving it before invocation. - Quarantine recovery overlap: #161579 explicitly introduced per-key and generation fencing for synthetic before-dispatch/after-reply controls. Same-key overlap can leave a stale or missing status warning until a later failing run or existing TTL. Actual tool exclusion, logs/events, accepted writes, stored shapes and worker/SQL contracts remain unchanged. - Primary-probe cache insertion order: #82707 introduced duplicate pruning. Post-write expiry and capacity bounds remain; refreshing an expired key can retain an earlier insertion position and permit an earlier reprobe after capacity eviction. This is a bounded best-effort throttle cache. - Preview host-prototype pollution: #147278 added own-property gates as part of result retention, not a human inherited-property failure report; linked #147105 proposes the feature. The sole caller passes freshly parsed JSON. A polluted host Object.prototype can affect bounded descriptive samples; retained JSON, reference identity and execution authority remain unchanged. * test(agents): warm MCP sibling before held discovery The discovery/revocation fixture held HTTP tools/list while cold-starting its stdio sibling. Slow startup could exhaust the existing ten-second listing deadline before the test reached revocation, producing a timeout diagnostic or an empty healthy-tool list instead of exercising its overlap. Warm the non-held sibling through its actual runtime owner first, then hold the other server's discovery across revocation. Keep every assertion, deadline, runtime authority check, and cleanup path unchanged. The two affected cases pass through the production materialization path; focused lint, format, and the owning test type graph also pass. The earlier four short-deadline MCP runtime failures remain separately unattributed. * refactor(apple): simplify source resources and microphone permission Use cancellation of owned source-resource tasks instead of a revision counter. Use native async microphone permission APIs instead of manual authorization-state switches and callback continuations. Best-effort tradeoffs accepted: - Resource revision tracking (#148906, feature request #148850, not a human invalidation-race incident): invalidation between prepared context and favicon task admission may allow one lookup with that snapshot; later lookups rediscover. Live route authority and Gateway disabled-fetch policy remain enforced. No protocol, persisted shape, config, permission-prompt or signing changes. Net production reduction: 26 lines (+10/-36); no test changes. Phase E untouched. Pager/notification changes were excluded after #171772 made their files recent under the seven-day rule. BELOW-500 coordinator bundle. Remaining source is byte-identical to the independently reviewed checkpoint. macOS/iOS Simulator/watchOS Simulator arm64 platform builds passed. Actual production-package focused tests passed: 17 VoiceNote XCTest cases and 18 source-resource SwiftTesting declarations including parameters. SwiftFormat, SwiftLint, runtime/madge cycles (zero), lint-suppressions, native-state guard and localization verification passed. Broad check-changed is not green: one bounded reproduction retained ten 20-second artifact-fixture subprocess timeouts and one 120-second signing fixture timeout. Unchanged tooling paths do not run these Swift sources; these are unresolved local failures, not proven hosted-main-red. Intel execution, app-hosted native UI tests requiring an OS sandbox and live microphone effects are not proven. No release_gate or remote lease. * refactor(apple): consolidate activity refresh and watch connection paths * refactor(agents): retain recent MCP contracts in old-code bundle Keep the recently edited reload regression file and its current combined-catalog implementation unchanged from main. Preserve the final source-lane trees for quarantine and Live Activity while retaining newer main behavior. This supersedes the historical source-commit inventories and MCP/quarantine/activity timing tradeoffs. Final bundle: 162 production lines removed; 112 net lines removed including tests (+166/-278, 14 files). Credit source lanes q10, q01 and q02. Fresh final-index review found no actionable P0-P2 defects. Focused proof and exact-head PR CI remain the landing gates. * fix(test): synchronize MCP connection invalidation fixture Hold sibling initialization across client-observed catalog invalidation. Preserve the existing assertions and deadlines; isolate scenario setup so the oversized runtime test does not grow.
…aw#172002) * refactor(agents): simplify old runtime bookkeeping Use one catalog discovery pass, local-process stop promise, presentation completion path, diagnostic recovery batch, and generated-media rollback owner. Reuse directory parameter declarations and keep sandbox validation at its existing boundary without repeating the same blocked-path checks. Remove the duplicate full-map primary-probe prune. Trust JSON-normalized result previews and group identical session-export style declarations without changing their visibility or cascade rules. Keep auth/approval/sandbox policy, normal child and write settlement, transcript/user-data durability, public signatures and Phase E unchanged. Production reduction: 147 net lines across ten old-only files. Best-effort tradeoffs accepted - MCP list_changed during held sibling discovery: openclaw#138694 added a synthetic forced-overlap replay, not a cited human incident. The next load refreshes the catalog instead; retirement and execution authority remain enforced. - Competing catalog producer finalization: the same private owner forbids a replacement while its promise is present, so the identity recheck is an internal invariant, not a realistic concurrency boundary. - Local-service post-readiness exit: openclaw#154133 describes synthetic parallel qualification, not a human report requiring another health check. The following request reports an exit after readiness; normal shutdown still joins the child, streams and pending termination work. - Local-process stop identity: replacement starts only after the retained authoritative process finishes stopping. The duplicate process reference and identity comparisons cannot observe another production replacement; failed-stop retry and the retiring marker remain intact. - Synchronous presentation self-drain: openclaw#156187 extracted this reservation without a cited human incident. Production adapters drain after projection; callbacks return their own work instead of reserving it before invocation. - Quarantine recovery overlap: openclaw#161579 explicitly introduced per-key and generation fencing for synthetic before-dispatch/after-reply controls. Same-key overlap can leave a stale or missing status warning until a later failing run or existing TTL. Actual tool exclusion, logs/events, accepted writes, stored shapes and worker/SQL contracts remain unchanged. - Primary-probe cache insertion order: openclaw#82707 introduced duplicate pruning. Post-write expiry and capacity bounds remain; refreshing an expired key can retain an earlier insertion position and permit an earlier reprobe after capacity eviction. This is a bounded best-effort throttle cache. - Preview host-prototype pollution: openclaw#147278 added own-property gates as part of result retention, not a human inherited-property failure report; linked openclaw#147105 proposes the feature. The sole caller passes freshly parsed JSON. A polluted host Object.prototype can affect bounded descriptive samples; retained JSON, reference identity and execution authority remain unchanged. * test(agents): warm MCP sibling before held discovery The discovery/revocation fixture held HTTP tools/list while cold-starting its stdio sibling. Slow startup could exhaust the existing ten-second listing deadline before the test reached revocation, producing a timeout diagnostic or an empty healthy-tool list instead of exercising its overlap. Warm the non-held sibling through its actual runtime owner first, then hold the other server's discovery across revocation. Keep every assertion, deadline, runtime authority check, and cleanup path unchanged. The two affected cases pass through the production materialization path; focused lint, format, and the owning test type graph also pass. The earlier four short-deadline MCP runtime failures remain separately unattributed. * refactor(apple): simplify source resources and microphone permission Use cancellation of owned source-resource tasks instead of a revision counter. Use native async microphone permission APIs instead of manual authorization-state switches and callback continuations. Best-effort tradeoffs accepted: - Resource revision tracking (openclaw#148906, feature request openclaw#148850, not a human invalidation-race incident): invalidation between prepared context and favicon task admission may allow one lookup with that snapshot; later lookups rediscover. Live route authority and Gateway disabled-fetch policy remain enforced. No protocol, persisted shape, config, permission-prompt or signing changes. Net production reduction: 26 lines (+10/-36); no test changes. Phase E untouched. Pager/notification changes were excluded after openclaw#171772 made their files recent under the seven-day rule. BELOW-500 coordinator bundle. Remaining source is byte-identical to the independently reviewed checkpoint. macOS/iOS Simulator/watchOS Simulator arm64 platform builds passed. Actual production-package focused tests passed: 17 VoiceNote XCTest cases and 18 source-resource SwiftTesting declarations including parameters. SwiftFormat, SwiftLint, runtime/madge cycles (zero), lint-suppressions, native-state guard and localization verification passed. Broad check-changed is not green: one bounded reproduction retained ten 20-second artifact-fixture subprocess timeouts and one 120-second signing fixture timeout. Unchanged tooling paths do not run these Swift sources; these are unresolved local failures, not proven hosted-main-red. Intel execution, app-hosted native UI tests requiring an OS sandbox and live microphone effects are not proven. No release_gate or remote lease. * refactor(apple): consolidate activity refresh and watch connection paths * refactor(agents): retain recent MCP contracts in old-code bundle Keep the recently edited reload regression file and its current combined-catalog implementation unchanged from main. Preserve the final source-lane trees for quarantine and Live Activity while retaining newer main behavior. This supersedes the historical source-commit inventories and MCP/quarantine/activity timing tradeoffs. Final bundle: 162 production lines removed; 112 net lines removed including tests (+166/-278, 14 files). Credit source lanes q10, q01 and q02. Fresh final-index review found no actionable P0-P2 defects. Focused proof and exact-head PR CI remain the landing gates. * fix(test): synchronize MCP connection invalidation fixture Hold sibling initialization across client-observed catalog invalidation. Preserve the existing assertions and deadlines; isolate scenario setup so the oversized runtime test does not grow.
Why
OpenClaw now supports multiple external harnesses that need the same presentation and transcript operations. A shared owner keeps those operations consistent while each adapter retains its native protocol handling.
What Problem This Solves
The Codex harness owns reusable bounded output, attributed message construction, and presentation settlement code. Move that behavior into the existing agent-harness packages so the Agents API adapter can consume it through the official bundled-plugin boundary. This PR targets main and precedes #156182 and the later tools/file-transfer layers.
Changes
Evidence
Verified rebased head
51545fd53cb703a582200746556d6c2781b9b0d5:pnpm test src/agents/harness/projection-tool-output.test.ts --maxWorkers=1wall 3.99 seconds).Exact-head CI is green. The 103 Node test shards took 10 minutes 10 seconds from first start to last completion; their summed runtime was 6 hours 58 minutes 17 seconds. The longest shard took 9 minutes 58 seconds.
A fresh native Linux/arm64 image built runtime, UI, declarations, and bundled plugins successfully at descendant
bdcbcab846d5c18e91ed1a8953ab65dcc72e19c9. The Codex adapter, shared harness owners, and plugin-SDK sources are byte-identical between this PR head and that tested descendant. The packaged Slack plugin required its standalone package-local dependency layout; full plugin loading and dependency resolution passed after that packaging correction. This is descendant-source live proof, not a separately built image at this PR head.Through ordinary Slack messages, the installed Codex app-server executed two real shell commands, retained exactly one call/result pair per native item, delivered each final answer, and settled without an active run. Two consecutive history reads retained identical messages. The first real command's outer execution result contained both start and completion markers. The normalized observer did not capture a Codex command-output delta, so this evidence does not establish command stdout streaming.
Actual Slack presentation screenshots and their scoped result show the shared rolling commentary/final lifecycle. The full commentary-content case failed because model-written prose included exit/status metadata; that failure is retained. No nonempty reasoning or reconnect result is claimed.