Skip to content

fix(code-mode): check automation and process result types - #147143

Merged
steipete merged 2 commits into
mainfrom
codex/code-mode-typed-composition
Sep 13, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/code-mode-typed-composition

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Related: #147105

What Problem This Solves

Code Mode cannot type-check composition of automation and process results, and compiler feedback exposes only one error per attempt.

User Impact

Agents can inspect accurate output declarations for automations and process and compose their results with strict TypeScript checks. Preflight reports up to five bounded diagnostics together and understands the existing nodes API. Command-specific node result payloads remain unknown.

Why This Change Was Made

Output schemas describe the existing producer results, including failure and control variants, and are shared by eager and lazy process tools. Automation contracts reuse canonical Gateway schemas. Large result unions remain available through API.read rather than being shortened into misleading quick-index hints. Runtime output validation uses the same contracts.

Evidence

  • Before/after regressions cover missing output declarations, multiple compiler errors, and typed node methods.
  • All 123 selected tests passed across nine files, including real child-process E2E, registered process lifecycle results, 17 automation output/declaration cases, typed node calls, and multiple-error preflight.
  • Independent review found no accepted P0–P2 findings.
  • The full changed gate and full fresh E2E build/postbuild passed.
  • A real OpenAI model against an isolated built Gateway observed both initial diagnostics, recovered with checked TypeScript, exercised process and nodes.list, and completed automation add/get/list/update/runs/status/remove through runtime output validation. All synthetic jobs were disabled and removed, preserving the initial heartbeat inventory. Node inventory was intentionally empty; this makes no hardware claim.

The original feature patch was rebased onto the main revision containing startup-budget repair #147164; git range-diff confirmed patch equivalence. Final review then caught an existing successful-removal variant: active automation jobs can return sessionCleanup: "pending" after durable deletion. The schema and canonical removal type now preserve that outcome, so Code Mode does not report failure after deleting the job. Both active isolated/current cases passed through the real CronService and Code Mode boundary with exactly one removal call; all 27 focused contract and cleanup tests passed, with a fresh clean P2 review.

@clawsweeper

clawsweeper Bot commented Sep 13, 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 docs Improvements or additions to documentation agents Agent runtime and tooling size: L maintainer Maintainer-authored PR labels Sep 13, 2026
@steipete
steipete marked this pull request as ready for review September 13, 2026 15:28
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 12:59 PM ET / 16:59 UTC (Revision 3).

ClawSweeper review

What this changes

Adds automation and process result declarations, types existing node methods, and reports up to five bounded TypeScript errors together in Code Mode.

Merge readiness

✅ Ready for maintainer review

The PR remains useful and the previous pending-cleanup finding is resolved. Producer contracts, registered-tool coverage, and the revised regression support clearing that blocker; no additional actionable defect was found.

Priority: P2
Reviewed head: 33bfa2680a08f205268733430a32437a2a55772b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-covered enhancement with the prior blocker repaired and no remaining correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository context identifies this as a maintainer-authored PR, so the external-contributor proof gate does not apply. The body reports an isolated Gateway run exercising diagnostics, process composition, node listing, and automation operations; the cleanup regression covers the real service/catalog boundary. No authority-bearing behavior changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository context identifies this as a maintainer-authored PR, so the external-contributor proof gate does not apply. The body reports an isolated Gateway run exercising diagnostics, process composition, node listing, and automation operations; the cleanup regression covers the real service/catalog boundary. No authority-bearing behavior changes.
Evidence reviewed 10 items Introduced scope verified: GitHub comparison independently confirms the supplied merge base and introduced file set. Base-only UI and session changes were excluded from patch ownership.
Previous blocker repaired: The latest commit adds optional sessionCleanup: pending to successful removal results and the canonical service return type. Its regression invokes Code Mode with real CronService removal for active isolated/current jobs, checks durable deletion, accepts the successful result, and requires exactly one removal call.
Removal producer and validation boundary: CronService returns pending cleanup after deleting an active job; the Gateway and automation tool forward that result. Existing catalog validation checks final details against outputSchema, explaining both the previous failure and why accepting this existing variant resolves it.
Findings None None.
Security None None.

How this fits together

Code Mode lets agents compose existing OpenClaw tools in JavaScript or TypeScript. Tool result schemas feed declaration discovery, optional compiler checks, and validation before results return to the running program.

flowchart TD
  A[Agent program] --> B[Optional TypeScript preflight]
  C[Tool result declarations] --> B
  B --> D[Existing tool dispatch]
  B --> E[Bounded compiler errors]
  D --> F[Automation and process results]
  C --> G[Result validation]
  F --> G
  G --> A
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +287, Tests +459, Docs +17. Total +763 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 8 298 11 +287
Tests 5 497 38 +459
Docs 3 21 4 +17
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 816 53 +763

Review metrics

Metric Value Why it matters
Production versus test growth production +287 net lines; tests +459 net lines Production growth supplies result contracts and bounded compiler feedback; tests exercise producer compatibility and composition.

Technical review

Best possible solution:

Keep accurate declarations with the existing tool owners and use the shared catalog validator and compiler to support safe composition without adding another execution path.

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

Not applicable as a feature enhancement; current-main source confirms the missing declarations and single-error feedback. The previous patch defect now has targeted regression coverage, inspected but not executed in this read-only review.

Is this the best way to solve the issue?

Yes. The patch extends the existing output-schema and preflight mechanisms, shares the process schema across constructors, and preserves existing automation result variants.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 00c540f16bb7.

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: The supplied repository context identifies this as a maintainer-authored PR, so the external-contributor proof gate does not apply. The body reports an isolated Gateway run exercising diagnostics, process composition, node listing, and automation operations; the cleanup regression covers the real service/catalog boundary. No authority-bearing behavior changes.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded improvement to Code Mode composition and repair feedback, with no demonstrated urgent user outage.
  • 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: The supplied repository context identifies this as a maintainer-authored PR, so the external-contributor proof gate does not apply. The body reports an isolated Gateway run exercising diagnostics, process composition, node listing, and automation operations; the cleanup regression covers the real service/catalog boundary. No authority-bearing behavior changes.

Evidence

What I checked:

  • Introduced scope verified: GitHub comparison independently confirms the supplied merge base and introduced file set. Base-only UI and session changes were excluded from patch ownership. (33bfa2680a08)
  • Previous blocker repaired: The latest commit adds optional sessionCleanup: pending to successful removal results and the canonical service return type. Its regression invokes Code Mode with real CronService removal for active isolated/current jobs, checks durable deletion, accepts the successful result, and requires exactly one removal call. (src/agents/tools/cron-tool.output-contract.test.ts:146, 33bfa2680a08)
  • Removal producer and validation boundary: CronService returns pending cleanup after deleting an active job; the Gateway and automation tool forward that result. Existing catalog validation checks final details against outputSchema, explaining both the previous failure and why accepting this existing variant resolves it. (src/cron/service/ops-mutations.ts:680, 33bfa2680a08)
  • Shared process contract: Eager and lazy process construction share the same schema. Its variants match listing, polling, logs, input acknowledgments, terminal outcomes, and errors; existing child-process E2E coverage now checks selected actual results against it. (src/agents/bash-tools.process-schema.ts:34, 33bfa2680a08)
  • Automation compatibility coverage: The schema reuses Gateway job, creation, delivery-preview, and history contracts. Tests retain older full-inventory fallback, restricted status/list projections, paced proposals, generated declarations, and pending-cleanup success. (src/agents/tools/cron-tool-output-schema.ts:132, 33bfa2680a08)
  • Current main still lacks the improvement: Fetched main still selects only the first compiler error, and its node global remains unknown. Tree checks found neither new result-schema file on fetched main nor v2026.9.4; no merged replacement for this work is established. (src/agents/code-mode-typecheck.ts:71, 00c540f16bb7)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • RoboClaw: Raw commit ce8fb53 adds src/agents/code-mode-typecheck.ts:12 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ce8fb5328d34; files: src/agents/code-mode-typecheck.ts)

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 (2 earlier review cycles)
  • reviewed 2026-09-13T15:36:54.991Z sha a50b221e27c2353bfe5b64f17f74ed934d1d3b60 :: blocked before merge. :: [P2] [P2] Include pending session cleanup in removal results
  • reviewed 2026-09-13T16:33:40.827Z sha fd9a5f4 :: blocked before merge. :: [P2] [P2] Include pending session cleanup in removal results

Declare automation and process results for schema discovery, strict TypeScript composition, and runtime output validation. Reuse canonical automation job and history contracts, describe node handles, and return up to five bounded compiler diagnostics per repair attempt.

Related: #147105
@steipete
steipete force-pushed the codex/code-mode-typed-composition branch from a50b221 to fd9a5f4 Compare September 13, 2026 16:22
Successful removal of an active isolated or current automation can defer base-session cleanup. Preserve that existing pending result in the closed output schema and canonical service type so Code Mode does not report failure after deleting the job.

Verify both targets through the real cron service and Code Mode catalog with one removal invocation and no retry.
@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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 13, 2026
@steipete
steipete merged commit 710fed6 into main Sep 13, 2026
190 of 192 checks passed
@steipete
steipete deleted the codex/code-mode-typed-composition branch September 13, 2026 17:06
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '201f11afefdb19a9c75e9d3542bf7425c80df7a7': (141 commits)
  fix: keep catalog discovery scoped and execution lazy (#147159)
  fix: serialize reclamation worker shutdown with foreground writes (#147178)
  test(sessions): cover abrupt committed transcript recovery (#143984)
  fix: stop transcript storms during context overflow recovery (#147202)
  fix: reduce CPU overhead for small history and usage reads (#147205)
  fix: resume tasks after tools finish and the model times out (#147203)
  refactor(scripts): share SQLite reliability message waits (#146900)
  feat(exec): configure approval reviewer thinking and fastMode (#147192)
  test: remove redundant Bonjour module headers (#146981)
  refactor: share streaming media tail boundary update (#146989)
  refactor(tui): classify resume candidates once (#146983)
  improve: skip unused toast dismissal work (#147196)
  fix(linux): recover saved remote connections without replacing active sessions (#146047)
  fix: doctor stays silent when Windows state dir is under OneDrive (#123720)
  feat: announce successful Daybreak retries (#147146)
  feat(code-mode): reuse results across code cells (#147154)
  refactor(test): reuse CLI plugin fixture writer (#147186)
  test: skip unused compiler setup in routing fixtures (#147194)
  test: reuse LINE webhook runtime fixture (#146710)
  fix(code-mode): check automation and process result types (#147143)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…47143)

* feat(code-mode): improve typed composition and repair feedback

Declare automation and process results for schema discovery, strict TypeScript composition, and runtime output validation. Reuse canonical automation job and history contracts, describe node handles, and return up to five bounded compiler diagnostics per repair attempt.

Related: openclaw#147105

* fix(code-mode): accept pending automation session cleanup

Successful removal of an active isolated or current automation can defer base-session cleanup. Preserve that existing pending result in the closed output schema and canonical service type so Code Mode does not report failure after deleting the job.

Verify both targets through the real cron service and Code Mode catalog with one removal invocation and no retry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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