Skip to content

fix: preserve Code Mode collector replay during argument coercion - #200679

Merged
vincentkoc merged 1 commit into
mainfrom
fix/ci-code-mode-invocation-validation-20261117
Nov 17, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/ci-code-mode-invocation-validation-20261117

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Code Mode collector launches lose their replay identity when tool arguments pass through the coercion added in #193200. A resumed invocation can no longer find its existing collector. The same change made an old negative test input valid because numbers are intentionally coerced to strings.

User Impact

Collector calls retain their replay identity through argument coercion. Public arguments still follow the existing normalization and validation rules; no configuration or protocol changes are required.

Why This Change Was Made

The coercion adapter now preserves own Symbol property descriptors after validating the public JSON fields. It does not restore unvalidated string properties or change the live collector guard. The existing headless negative test now supplies a genuinely noncoercible object instead of a number.

Related: #193200

Evidence

  • Exact hourly failure: run 44114293866, job 134149004341, head 20248a9ec7c38fc70751bcd31223684657f4621e.
  • Both unchanged failing cases reproduced locally before the repair. With the repair, the existing collector test completes both invocations and verifies one spawn; the headless test rejects the invalid value before execution.
  • All 113 tests passed across the existing headless, swarm, tool-search-runtime, harness/tool-invocation and before-tool-call parameter suites. The four runtime files took 17.53 seconds together; the two parameter tests took 9.25 seconds including setup.
  • Targeted formatting, type-aware lint and the agents-tools typecheck passed. Fresh independent full-context review found no P0–P3 issues.

Local proof used macOS and the pinned OpenClaw Bun fork, with matched owner/test inputs overlaid on an existing qualified native checkout. It is not a full-current-tree or live Gateway result; PR CI supplies broader coverage. All temporary source overlays were restored.

Exact-head PR CI run 44121186351 completed with five independently attributed baseline failures: four jobs stopped before tests because the Git PPA returned HTTP 503, and core lint rejected the existing _warning identifier in subagent-result-owed.expiry-discard.test.ts. Security passed. The actual tested merge has unchanged failing owners relative to its main baseline. These failures remain recorded; the scoped inherited-failure landing exception does not claim green CI or broaden the Code Mode fix.

@vincentkoc vincentkoc self-assigned this Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Nov 17, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 17, 2026 16:02
@vincentkoc
vincentkoc enabled auto-merge (squash) November 17, 2026 16:03
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserve private Symbol metadata during tool-argument coercion and repair an outdated invalid-input test.

Example: Code Mode executes agents.run("Research") twice with the same invocation identity.

  • Before: Coercion drops the collector replay key and fingerprint before registration, preventing reliable reuse.
  • After: Both invocations retain their replay identity and can reuse one registered collector.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch is source-correct and backed by reported regression runs, with confidence limited by harness-only behavior evidence and unresolved exact-head CI.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the contributor proof gate; its supplied proof exercises existing in-process suites with mocked collector persistence and spawning, rather than a live Gateway.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Replayed Code Mode collector invocations cannot reliably locate their previously launched collector after argument coercion.
Reason: The maintainer-authored direction restores existing replay behavior without adding configuration, changing public contracts, or undoing intentional scalar coercion.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR narrowly repairs a source-confirmed collector replay regression still present on main; no introduced correctness defect was found.

Priority: P2
Reviewed head: 61d44795b23eb0c7b7b3eb1ca6b85503c99e38c7

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not demonstrate collector replay through a shipped Gateway with real collector registration.
Agent review details

How this fits together

The shared coercion adapter normalizes OpenClaw tool arguments before runtime or harness execution; the collector bridge also supplies private metadata needed to identify replayed launches.

flowchart LR
  A[Code Mode agents.run] --> B[Collector bridge]
  B --> C[Tool search runtime]
  C --> D[Argument coercion]
  D --> E[Native sessions_spawn]
  E --> F[Collector registry]
  F --> B
Loading

Technical review

Best possible solution:

Keep the existing coercion owner, preserve host Symbol descriptors on its validated result, and retain the existing collector replay regression.

Do we have a high-confidence way to reproduce the issue?

The source establishes the failure: the bridge attaches replay Symbols, the shared validator clones arguments without those Symbols, and sessions_spawn reads the missing metadata; no target code was executed during this review.

Is this the best way to solve the issue?

This is the smallest complete repair at the shared adapter: preserve private metadata while leaving public normalization, validation, and collector authorization with their existing owners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 3777fda157ff.

Provenance checked

  • Shared tool-argument coercion keeps the original intent (40437fa: Align validated OpenClaw tool routes with direct-call scalar coercion while preserving route-specific validation errors.)
  • Headless invalid-input test keeps the original intent (a6768d9: Protect rejection of schema-invalid input before headless tool execution; later test consolidation retained that contract.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Verified PR scope: The pinned introduction diff changes only Symbol descriptor preservation in the existing adapter and the headless negative-test input; no competing owner or new configuration is added. (src/agents/agent-tools.execution-validation.ts:67, 61d44795b23e)
  • Current-main failure path: Main returns validateToolArguments directly; that validator starts with structuredClone, which discards Symbol properties, while the collector bridge attaches its replay key and fingerprint as non-enumerable Symbols. (src/agents/agent-tools.execution-validation.ts:67, 3777fda157ff)
  • Existing behavioral regression coverage: The retained collector test executes the same Research invocation twice, requires replay metadata to reach spawn, and checks completion with one spawn; the registry lookup and spawn transport are mocked. (src/agents/code-mode-swarm.test.ts:679, 61d44795b23e)
  • Original coercion intent: Merged fix: coerce quoted tool arguments on tool_call, Code Mode and Codex dynamic tools #193200 intentionally aligned OpenClaw tool routes with direct-call scalar coercion; this repair preserves that behavior and leaves MCP and client arguments unchanged. (src/agents/agent-tools.execution-validation.ts:58, 40437fa48861)
  • Supplied validation and its limits: The full PR body reports both original failures reproduced before repair and 113 focused tests passing afterward on macOS with the pinned Bun fork; it explicitly identifies source overlays and excludes a live Gateway or full-current-tree result. (61d44795b23e)
  • Exact-head CI remains unresolved: The CI gate is pending. Lint annotations identify file-length failures outside the diff; test annotations provide only exit codes. GitHub log downloads redirect to blocked Azure hosts, so the failed checks cannot all be attributed and are not asserted to be PR defects. (61d44795b23e)

Likely related people:

  • Ayaan Gazali: Raw commit 40437fa adds src/agents/agent-tools.execution-validation.ts:58 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 40437fa48861; files: src/agents/agent-tools.execution-validation.ts)
  • Vincent Koc: Raw commit d24375e adds src/agents/code-mode-headless.test.ts:337 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d24375e47684; files: src/agents/code-mode-headless.test.ts)
  • Peter Steinberger: Raw commit a6768d9 adds src/agents/code-mode-headless.test.ts:95 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a6768d9de567; files: src/agents/code-mode-headless.test.ts)

PR surface

Source +7, Tests +4. Total +11 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 8 1 +7
Tests 1 7 3 +4
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 15 4 +11

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: The regression affects Code Mode collector replay on current main, with a focused repair and limited demonstrated scope.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The regression affects Code Mode collector replay on current main, with a focused repair and limited demonstrated scope.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Inspect the failed exact-head test jobs once their logs are accessible and determine whether any failure is caused by this patch.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 17, 2026, 11:16 AM ET / 16:16 UTC.

@vincentkoc
vincentkoc disabled auto-merge November 17, 2026 16:21
@vincentkoc
vincentkoc merged commit 7a55c60 into main Nov 17, 2026
212 of 219 checks passed
@vincentkoc
vincentkoc deleted the fix/ci-code-mode-invocation-validation-20261117 branch November 17, 2026 16:23
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 18, 2026
RomneyDa pushed a commit that referenced this pull request Nov 19, 2026
…00679)

(cherry picked from commit 7a55c60)

Backport review: Required companion to #193200; retain private host invocation symbols across argument coercion so Code Mode collector replay remains functional.
Co-authored-by: RomneyDa <[email protected]>

(cherry picked from commit b0e18e92d74deb8b334a6210595d045c7222e8ab)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant