Skip to content

improve(code-mode): call tools as global functions - #126262

Merged
steipete merged 5 commits into
mainfrom
steipete/compassionate-allen-19bb4e
Aug 20, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/compassionate-allen-19bb4e

Conversation

@steipete

@steipete steipete commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Code Mode taught models to invoke hidden tools through verbose internal routing syntax such as tools.callValue("openclaw:core:sessions_spawn", {...}). That spent prompt and output tokens on implementation details, exposed source-qualified catalog IDs, and gave Code Mode duplicate-name behavior that differed from the normal direct tool surface.

Why This Change Was Made

This hard-cuts the guest API to one simpler contract: authorized non-MCP tools are async global functions such as sessions_spawn({...}) and web_search({...}). One run-scoped catalog owns the effective winner, final callable name, provider-visible quick index, search view, bridge routing, snapshots, and replay checks—even after client tools append or prompt policy restricts the surface. Hidden exact identities remain host-only.

The old guest tools object, ALL_TOOLS, raw call envelopes, and exact-ID examples are removed rather than retained as runtime compatibility aliases. Callable discovery results serialize to bounded public metadata instead of null, without detached schema calls or arbitrary user toJSON execution. Every __openclaw* tool name is projected outside the worker-private namespace.

MCP remains under its namespace, but its generated contract now matches execution. Tool calls expose JSON-safe native content, structuredContent, and isError; resource and prompt operations expose their native result shapes. Top-level private _meta never enters guest or transcript output, nested content-block metadata is preserved, resolved MCP failures remain recoverable guest values while staying failed in lifecycle accounting, and every executable network MCP surface participates in external-content wrapping and turn tainting. Requester OAuth connect tools and MCP-annotated custom node commands follow the same guest contract without changing their direct result semantics.

The model guidance explicitly encourages same-program composition for declared outputs, raw-first handling for unknown outputs, and reserves restartSafe for explicit gateway-restart recovery. The concrete read tool supports explicit optional: true; missing canonical daily notes retain their shipped implicit not-found behavior, while arbitrary missing paths and real filesystem errors still reject. The existing five-variant sessions_send output schema is rendered as a complete quick-index hint instead of a false -> ?.

The runtime remains hard-cut to the new API, but stable-upgrade compatibility is handled at the storage owner. openclaw doctor --fix AST-migrates the documented v2026.7.1 persisted Cron trigger idiom from literal tools.call("exec", {...}) plus .result.details to canonical direct calls. Custom, dynamic, shadowed, or ambiguous legacy scripts remain byte-for-byte unchanged and are reported per job for manual remediation. Beta-only tools.callValue and standalone script payloads receive no compatibility path.

User Impact

Models can write shorter, ordinary JavaScript:

const child = await sessions_spawn({ task: "Investigate the failure" });
const [reader] = await catalog.search("read a local file");
return { child, file: await reader({ path: "README.md" }) };

Dependent calls remain sequential, independent calls remain composable with Promise.all, and nested calls use the same policy, approval, hooks, telemetry, network-content, and replay-safety boundaries. Optional reads can branch without exceptions:

const current = await read({ path: "maybe.txt", optional: true });
if (current.kind === "not_found") {
  await write({ path: "maybe.txt", content: "created" });
}

Output-hint audit: 141 statically known tools can enter the hidden catalog. This change brings complete hints from 19 to 20 by promoting the already-valid sessions_send schema. The remaining 121 -> ? tools consist of 120 tools without an owner-declared outputSchema plus the intentionally partial/open browser schema. Additional hints belong at each owning tool boundary; runtime inference from TypeScript or remote payloads remains intentionally absent.

AI-assisted implementation; adversarially reviewed and verified by the maintainer.

Evidence

  • Started from a conflict-free rebase onto 267ffc4754a08181f1a15ff7cfbd0f4d817ca25a; the four original commits remained patch-identical
  • Codex Next adversarial runtime review reproduced and drove repairs for final-catalog client collisions, search-limit starvation, shipped daily-memory regression, MCP tool/utility result mismatches, private metadata leakage, missing network provenance, requester OAuth results, custom node MCP commands, and catalog-wrapper lifecycle retention
  • Independent final skeptical replay: CLEAN; exact prior OAuth, node-command, metadata, network, registry-refresh, search, client-collision, snapshot, failure-classification, and daily-memory reproductions all passed
  • Final focused owner suites: 527 passed, 1 existing skip; lead reruns added 394 Code Mode/MCP/read tests and 45 final requester/node/registry tests, all green
  • Stable-upgrade SQLite proof: detects the documented trigger, does not persist preview mutations, rewrites and reloads canonical projections under doctor --fix, preserves unsupported/beta-only rows, and is idempotent
  • Real isolated Gateway + stdio MCP E2E: 2 provider requests, 1 exec, 6 MCP namespace calls, structured success, resolved failure, block metadata retention, top-level metadata stripping, all four resource/prompt operations, zero Tool Search pollution
  • Real OpenAI Responses API matrix: 7/7 scenarios passed—direct read, one-program dependent read/write/read, Promise.all, callable search+invoke, metadata serialization, unknown-output raw-first, and optional-read recovery; zero legacy APIs, exact IDs, tool failures, detached schema calls, or restartSafe: true
  • Historical full lint command passed, including removal of the two prior max-lines failures; guest tests split to 750/336 physical lines and session read contract extracted without new suppressions
  • node scripts/check-changed.mjs -- <30 changed files> passed all core/tests/extensions/scripts typechecks, format/lint, dead-export, security, database, schema-version, boundary, and import-cycle gates
  • pnpm build passed; only existing third-party dependency eval warnings
  • Docs validation passed across 777 MDX files and 6,524 internal links
  • Final Codex autoreview: clean, no accepted/actionable findings; TruffleHog secret scan clean
  • git diff --check passed

Production LOC: +1046/-334 (net +712) | Tooling/test support: +36/-7 | Tests: +2085/-807 | Docs: +155/-116

The positive production delta owns concrete capabilities rather than runtime fallbacks: deterministic catalog projection, MCP guest/transcript separation and network provenance, shipped Cron AST migration with SQLite repair/reporting, and extracted read contracts. The runtime has one canonical Code Mode API.

@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 19, 2026 08:31
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts agents Agent runtime and tooling extensions: qa-lab size: XL maintainer Maintainer-authored PR labels Aug 19, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. labels Aug 19, 2026
@clawsweeper

clawsweeper Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 3:01 PM ET / 19:01 UTC.

ClawSweeper review

What this changes

This PR replaces Code Mode’s hidden tool-routing object with direct async tool globals and callable catalog handles, while aligning MCP guest results and migrating one documented persisted Cron trigger pattern.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

The exact head addresses the prior MCP result-shape blocker and no new concrete correctness defect was found. This maintainer-owned PR remains necessary because current main still exposes the legacy tools/ALL_TOOLS guest API; merge should wait for the exact merge result and remaining required checks.

Priority: P1
Reviewed head: b18c626e9ccc3ab8eb3f0c29a30972608a84b7d9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a well-covered, coherent implementation of the intended Code Mode contract; final merge confidence depends on the refreshed exact-head merge checks.
Proof confidence 🌊 off-meta tidepool Not applicable: This is maintainer-authored work, so the external-contributor proof gate does not apply; the PR body nevertheless reports after-fix isolated Gateway/stdio-MCP and real OpenAI Responses runs.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is maintainer-authored work, so the external-contributor proof gate does not apply; the PR body nevertheless reports after-fix isolated Gateway/stdio-MCP and real OpenAI Responses runs.
Evidence reviewed 7 items Current-main behavior: Current main still documents guest invocation through tools.callValue and ALL_TOOLS, so the central direct-global behavior is not already implemented.
MCP guest contract: The final head stores a dedicated JSON-safe MCP guest projection containing native content, optional structured content, and error state while keeping the normal agent envelope separate.
Owner-boundary consumption: The bridge consumes that projection only for namespace MCP calls and rejects an MCP result that lacks an owned projection rather than leaking internal details.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/agents/code-mode.mcp.test.ts

Result: FAIL (partial) — step 2 expect_output Code Mode MCP namespace: expected terminal output was not visible within 30 seconds: "Code Mode MCP namespace"

node scripts/run-vitest.mjs src/agents/code-mode.mcp.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-126262-jWYqsH/target$ node scripts/run-vitest.mjs src/agents/code-mode.mcp.test.ts
node scripts/run-vitest.mjs src/agents/code-mode.mcp.test.ts
[test] starting test/vitest/vitest.agents-core.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-126262-jWYqsH/target

 ✓  agents-core  src/agents/code-mode.mcp.test.ts (10 tests) 5253ms
     ✓ exposes MCP tools only through the MCP namespace  1163ms
     ✓ preserves native MCP results through bundled materialization and the guest namespace  1728ms
     ✓ rejects MCP namespace results without an owned guest projection  437ms
     ✓ renames MCP namespace identifiers that would be unsafe path segments  442ms

 Test Files  1 passed (1)
      Tests  10 passed (10)
   Start at  19:02:44
   Duration  22.45s (transform 13.81s, setup 984ms, import 15.85s, tests 5.25s, environment 0ms)

[test] passed 1 Vitest shard in 28.37s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-126262-jWYqsH/target$ node scripts/run-vitest.mjs src/agents/code-mode.mcp.test.ts
[test] starting test/vitest/vitest.agents-core.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-126262-jWYqsH/target




























Assertions:

  • FAIL expect_output: Code Mode MCP namespace

How this fits together

Code Mode executes model-authored JavaScript in an isolated worker and routes authorized calls through a run-scoped tool catalog. MCP tools, resources, and prompts enter through provider runtimes and are projected back to guest code and transcript output.

flowchart LR
  Model[Model-authored program] --> Worker[Isolated Code Mode worker]
  Worker --> Catalog[Run-scoped callable catalog]
  Catalog --> Bridge[Policy-checked execution bridge]
  Bridge --> MCP[MCP tool and utility runtimes]
  MCP --> Projection[Guest-result projection]
  Projection --> Output[Guest value and transcript output]
Loading

Before merge

  • Resolve merge risk (P1) - The PR is behind current main and required checks are still in progress, so merge should use a refreshed exact merge result rather than prior branch-only evidence.
  • Resolve merge risk (P1) - The hard cut removes the documented guest API; Doctor safely migrates only the recognized Cron trigger idiom, leaving custom or ambiguous persisted scripts for explicit manual remediation.
  • Complete next step (P2) - This protected maintainer PR has no identified mechanical repair; it needs exact-merge validation and normal maintainer merge handling.
Agent review details

Security

None.

PR surface

Source +712, Tests +1278, Docs +39, Other +29. Total +2058 across 75 files.

View PR surface stats
Area Files Added Removed Net
Source 34 1046 334 +712
Tests 33 2085 807 +1278
Docs 3 155 116 +39
Config 0 0 0 0
Generated 0 0 0 0
Other 5 36 7 +29
Total 75 3322 1264 +2058

Review metrics

Metric Value Why it matters
Production versus validation LOC production +1,029/-324; tests +2,085/-807; test support +53/-17; docs +155/-116 The feature adds a substantial catalog and migration boundary, with more than twice as many test-line additions as production additions.
Compatibility transition 1 guest API hard cut; 1 Doctor migration family Existing documented Cron trigger scripts have a bounded upgrade path, while unsupported legacy forms require explicit remediation.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor/cron/index.test.ts, migration/backfill/repair: src/commands/doctor/cron/index.ts, migration/backfill/repair: src/commands/doctor/cron/legacy-repair.ts, migration/backfill/repair: src/commands/doctor/cron/store-migration.ts, migration/backfill/repair: src/commands/doctor/cron/trigger-script-migration.ts, serialized state: src/agents/agent-bundle-mcp-manager.requester-connect.test.ts, and 20 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Refresh the merge proof (recommended)
    Verify the clean merge result against current main, including the documented Gateway/MCP E2E and Cron Doctor migration, before merging.
  2. Accept the bounded manual-migration path
    Merge with the documented decision that custom or ambiguous legacy trigger scripts remain unchanged and are reported for manual conversion.

Technical review

Best possible solution:

Rebase or verify the clean merge result, rerun the documented Code Mode/MCP and Doctor migration proof on that exact head, then land the single canonical direct-global API with its bounded Doctor migration.

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

Not applicable as a bug reproduction: this is a new Code Mode contract. The PR body supplies after-fix Gateway/MCP and OpenAI execution evidence, while source and focused tests cover the resulting boundary.

Is this the best way to solve the issue?

Yes. A single run-scoped projection supplies prompt names, guest globals, catalog handles, bridge routing, and replay checks; the Doctor-owned migration is the correct place to repair the documented persisted trigger shape.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 231405930acc.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is maintainer-authored work, so the external-contributor proof gate does not apply; the PR body nevertheless reports after-fix isolated Gateway/stdio-MCP and real OpenAI Responses runs.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: This changes the core agent tool-execution path and the persisted Cron trigger experience for active Code Mode users.
  • merge-risk: 🚨 compatibility: The PR removes the prior guest API and changes persisted trigger scripts through a deliberately narrow migration.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is maintainer-authored work, so the external-contributor proof gate does not apply; the PR body nevertheless reports after-fix isolated Gateway/stdio-MCP and real OpenAI Responses runs.

Evidence

What I checked:

  • Current-main behavior: Current main still documents guest invocation through tools.callValue and ALL_TOOLS, so the central direct-global behavior is not already implemented. Public docs: docs/tools/code-mode.md. (docs/tools/code-mode.md:37, 231405930acc)
  • MCP guest contract: The final head stores a dedicated JSON-safe MCP guest projection containing native content, optional structured content, and error state while keeping the normal agent envelope separate. (src/agents/mcp-content.ts:155, b18c626e9ccc)
  • Owner-boundary consumption: The bridge consumes that projection only for namespace MCP calls and rejects an MCP result that lacks an owned projection rather than leaking internal details. (src/agents/code-mode-bridge.ts:492, b18c626e9ccc)
  • Boundary coverage: Focused coverage exercises bundled MCP tools, native resource/prompt shapes, resolved failures, metadata stripping, transcript ownership transfer, and external-content framing. (src/agents/code-mode.mcp.test.ts:153, b18c626e9ccc)
  • Implementation boundary: The updated documentation explicitly distinguishes OpenClaw’s QuickJS-WASI Code Mode from Codex Code Mode; this PR does not depend on the Codex runtime or protocol. Public docs: docs/tools/code-mode.md. (docs/tools/code-mode.md:20, b18c626e9ccc)
  • History and ownership: Feature history shows sustained Code Mode and MCP work by Peter Steinberger, with earlier Code Mode recovery work by Vincent Koc and requester-scoped MCP work by Ayaan Zaidi. (src/agents/code-mode.ts:1, b18c626e9ccc)

Likely related people:

  • steipete: Authored the exact-head MCP contract repair and is the dominant contributor in the sampled Code Mode/MCP history. (role: feature owner and recent area contributor; confidence: high; commits: b18c626e9ccc, e6ca5266afe1, 2d6f8a79c431; files: src/agents/code-mode.ts, src/agents/code-mode-bridge.ts, src/agents/mcp-content.ts)
  • Vincent Koc: History identifies prior work on Code Mode restart recovery and its operator contract. (role: historic Code Mode recovery contributor; confidence: medium; commits: 32036c473dec, 44aaa2f91680; files: src/agents/code-mode-state.ts, src/agents/code-mode.ts)
  • Ayaan Zaidi: Prior requester-scoped MCP work is directly adjacent to the materialization path changed here. (role: adjacent MCP runtime contributor; confidence: medium; commits: 6a4a54659329, 7d99de8e32d3; files: src/agents/agent-bundle-mcp-materialize.ts, src/agents/agent-bundle-mcp-manager.requester-connect.test.ts)

Rank-up moves

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

  • Rebase or inspect the clean merge result and wait for all required checks on the exact head.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-08-19T10:00:18.268Z sha 99a9578 :: found issues before merge. :: [P2] Reserve worker-private global names
  • reviewed 2026-08-19T11:07:43.234Z sha 99a9578 :: found issues before merge. :: [P2] Reserve every worker-private global name
  • reviewed 2026-08-19T18:38:17.987Z sha 453d0fd :: found issues before merge. :: [P2] Reserve every worker-private global name | [P1] Migrate stored scripts before removing their guest API
  • reviewed 2026-08-20T06:39:38.668Z sha 7bd4b2d :: found issues before merge. :: [P1] Project MCP calls to their declared result shape | [P1] Migrate stored scripts before removing the guest API | [P2] Reserve every worker-private global name
  • reviewed 2026-08-20T08:54:36.626Z sha 10eb392 :: found issues before merge. :: [P1] Project MCP calls to their declared result shape
  • reviewed 2026-08-20T14:37:59.136Z sha e83ca73 :: needs changes before merge. :: [P1] Materialize MCP calls as their declared result type

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 19, 2026
@steipete
steipete force-pushed the steipete/compassionate-allen-19bb4e branch from 99a9578 to 453d0fd Compare August 19, 2026 15:57
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. P2 Normal backlog priority with limited blast radius. labels Aug 19, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Blocking contract finding before landing this rewrite: the generated McpToolResult API promises top-level content, structuredContent, and isError, but the current bridge returns the internal AgentToolResult envelope instead (structuredContent under details and failures only as details.status: "error"). The installed MCP SDK and Codex Code Mode both preserve the advertised top-level shape, including resolved isError: true tool failures.

The existing MCP integration fixture does not cross the raw MCP materializer boundary, so its green result misses this mismatch. A production-boundary reproduction returns only content and details; the checked-in structured-content parsing pattern then fails against the actual materialized text.

The clean owner is the Code Mode MCP guest projection, not the shared MCP materializer or Tool Search. Project the final value to { content, structuredContent?, isError? }, derive failure through the canonical tool-result classifier, and keep MCP failures as resolved values so guest code can recover. This needs to be resolved together with the existing persisted Cron-script compatibility/migration decision; removing .details without that decision is a shipped compatibility change.

Required proof before merge: real-materializer success and isError: true cases, no leaked internal metadata, unchanged Tool Search failure accounting, and one Gateway Code Mode MCP E2E for structured success plus resolved tool failure. Current head is also conflicting with main, so prior green checks do not establish a mergeable final result.

@steipete
steipete force-pushed the steipete/compassionate-allen-19bb4e branch from 334c94b to 7bd4b2d Compare August 20, 2026 06:33
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 20, 2026
@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label Aug 20, 2026
@steipete

steipete commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed both findings on behavior head cf0c895b997b15266b4ceacefa39c2f586d1bc67; a subsequent conflict-only rebase onto current main produced exact PR head 10eb39224e2a3fdf7f495e4c340c84f598353d81:

  • Code Mode now projects every __openclaw* tool name outside the worker-private namespace, with guest-boundary coverage across result, settlement, serialization, output, and resumed execution.
  • The runtime remains hard-cut to direct callable globals. openclaw doctor --fix now AST-migrates the stable v2026.7.1 persisted Cron trigger idiom (tools.call("exec", {...}) plus .result.details) at the SQLite storage owner. Unsupported custom legacy forms remain unchanged and receive per-job remediation guidance; beta-only tools.callValue and standalone script payloads are intentionally not migrated.

Proof is refreshed in the PR body: 312 focused boundary tests, final changed-file gates, final build, clean autoreview/secret scan, and a real OpenAI Code Mode matrix passing 7/7 scenarios with no legacy API, exact IDs, tool failures, detached schema calls, or restartSafe: true. The conflict-only rebase preserved upstream read-cursor work alongside optional: true; 207 focused read/tool tests passed on the exact new head.

@clawsweeper

clawsweeper Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete force-pushed the steipete/compassionate-allen-19bb4e branch from cf0c895 to 10eb392 Compare August 20, 2026 08:17
@clawsweeper

clawsweeper Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 20, 2026
@steipete

steipete commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Land-ready maintainer proof for exact reviewed head b18c626e9ccc3ab8eb3f0c29a30972608a84b7d9.

The canonical run-scoped callable projection now owns direct async tool globals, collision resolution, callable catalog discovery, hidden exact IDs, and policy-checked host dispatch. MCP remains in its namespace with native content, structuredContent, and resolved isError results; bundled, requester, and node execution preserve one-shot result ownership, approvals, lifecycle, external-content protection, and private top-level metadata stripping. openclaw doctor --fix conservatively migrates the documented stable Cron trigger idiom at its SQLite owner; unsupported custom scripts remain unchanged with explicit per-job remediation. Optional reads preserve ordinary errors and existing daily-memory behavior.

Validation:

  • Exact-head CI run 32405712814: completed successfully; all 238 checks completed with no failures.
  • Focused implementation evidence: 527+ passing tests with one existing skip; independent lead reruns: 394 and 45 passing. The isolated ClawSweeper run node scripts/run-vitest.mjs src/agents/code-mode.mcp.test.ts itself passed all 10 tests.
  • Real isolated Gateway/stdin MCP E2E: two provider requests, one exec, six MCP namespace calls; structured success, resolved failure, native resources/prompts, metadata and network protection; zero generic Tool Search pollution.
  • Real OpenAI Responses API matrix: 7/7 direct, dependent, parallel, search/invoke, metadata, raw-first unknown-output, and optional-recovery scenarios; no legacy guest API, exact IDs, tool failures, or restartSafe misuse.
  • Historical full core/plugin lint and max-lines, final changed-file gates, pnpm build, pnpm docs:list, pnpm docs:check-mdx, fresh independent Codex review, adversarial verification, and TruffleHog: all clean.
  • Final measured change: production +1,046/-334 (net +712); tests +2,085/-807 (net +1,278); docs +155/-116; tooling +36/-7. Production growth implements the canonical callable owner, MCP security/projection boundaries, and the conservative stable Doctor/SQLite upgrade; no runtime legacy fallback or schema bump was added.

ClawSweeper: the durable review initially lagged on an older head, but the exact-head re-review has now published with no actionable findings; the prior private-global, stable-upgrade, and MCP-projection findings were all fixed and independently reproduced. Its display harness marked a partial failure because an expected terminal string was not observed, although its captured Vitest run explicitly reports 10/10 passing. The optional request to rebase is intentionally skipped: current main drift is advisory, GitHub reports MERGEABLE with no conflict, exact-head CI is green, and the repository-native prepare/merge guards validate the landing without changing the proven head. ClawSweeper run: https://github.com/openclaw/clawsweeper/actions/runs/32405834950.

@clawsweeper

clawsweeper Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 20, 2026
@steipete
steipete merged commit 4249df3 into main Aug 20, 2026
245 checks passed
@steipete
steipete deleted the steipete/compassionate-allen-19bb4e branch August 20, 2026 19:18
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 21, 2026
* feat(code-mode): expose tools as global functions

* fix(code-mode): harden callable tool composition

* fix(code-mode): reserve private guest globals

* fix(cron): migrate legacy code-mode triggers

* fix(code-mode): align final tool result contracts
santhiprakash added a commit to santhiprakash/openclaw that referenced this pull request Aug 24, 2026
….call API

The browser-automation skill's Code Mode Loop still taught the guest
`tools.call(browserTool, input)` API that openclaw#126262 removed, together with
the `.result.details`/`.result.content` envelope reads. Rewrite the loop
for the current contract: call the `browser(...)` async global directly,
receive the tool's structured details (targetId, url, newElements, stats,
blockedByDialog), and diff url/new-element counts between cells instead of
filtering snapshot text, since rendered page text is no longer
guest-visible in code mode.
steipete pushed a commit that referenced this pull request Aug 25, 2026
… removed tools.call API (#128456)

* docs(browser): teach the code-mode global call, not the removed tools.call API

The browser-automation skill's Code Mode Loop still taught the guest
`tools.call(browserTool, input)` API that #126262 removed, together with
the `.result.details`/`.result.content` envelope reads. Rewrite the loop
for the current contract: call the `browser(...)` async global directly,
receive the tool's structured details (targetId, url, newElements, stats,
blockedByDialog), and diff url/new-element counts between cells instead of
filtering snapshot text, since rendered page text is no longer
guest-visible in code mode.

* docs(browser): resolve callable from quick index and read via targeted evaluate

* docs(browser): call the search-resolved handle and carry cell state explicitly
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 26, 2026
… removed tools.call API (openclaw#128456)

* docs(browser): teach the code-mode global call, not the removed tools.call API

The browser-automation skill's Code Mode Loop still taught the guest
`tools.call(browserTool, input)` API that openclaw#126262 removed, together with
the `.result.details`/`.result.content` envelope reads. Rewrite the loop
for the current contract: call the `browser(...)` async global directly,
receive the tool's structured details (targetId, url, newElements, stats,
blockedByDialog), and diff url/new-element counts between cells instead of
filtering snapshot text, since rendered page text is no longer
guest-visible in code mode.

* docs(browser): resolve callable from quick index and read via targeted evaluate

* docs(browser): call the search-resolved handle and carry cell state explicitly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations docs Improvements or additions to documentation extensions: qa-lab maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL 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