Skip to content

refactor(auto-reply): share closed execution outcome reporting - #138127

Merged
steipete merged 2 commits into
mainfrom
codex/automation-outcome-settlement
Sep 4, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/automation-outcome-settlement

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Related: #135933

What Problem This Solves

Heartbeat and ordinary reply execution classify the same closed agent result in separate places. That duplication makes it easier for later scheduler changes to confuse failed execution with a successful run that intentionally delivered no message.

Why This Change Was Made

Use one dependency-free execution classifier for the invocation-owned reply receipt, terminal callback, and existing message-tool outcome recorder. Keep the delivery fact independent: a failed run can already have delivered a message, and a completed run can intentionally remain silent. The recorder keeps its existing callback ordering and persisted values.

User Impact

Behavior-preserving prerequisite for the heartbeat/cron split. No SQLite schema, migration, stored representation, config/default, Gateway protocol, scheduling, or retry changes. Production code shrinks by 4 lines (+28/−32); tests grow by 27 (+54/−27), excluding the pure file rename.

Evidence

  • 283 tests pass across six affected execution, ownership, and heartbeat suites; the baseline passed 138 tests across three suites.
  • Existing message-tool tests now assert completed-without-send, failed-before-send, failed-after-send, and thrown preflight outcomes independently of delivery.
  • Independent Codex review found no actionable P0–P2 findings; static module-cycle check passed.
  • Final test-only relocation passed 40 tests across both affected suites. Production/core-test types, type-aware lint, static/runtime import-cycle checks and the remaining changed guards passed. The initial whole-check wrapper failed only the test file line limit; the unchanged case move fixes it.
  • Real-provider Gateway proof passed on exact source 892f83902d8a62fee5b1f77fc4202dcd26f4d866 in an isolated Testbox. OpenClaw and Codex each executed one side effect once and recorded the existing completed execution / mute message-tool outcome with periodic heartbeat disabled. Codex used gateway_exec. The task-only proof snapshot matched that source outside the two proof scripts; the lease is stopped.
  • The direct-turn intentional-silence probe fails identically on baseline and candidate: host finalization emits one fallback diagnostic after NO_REPLY. This PR preserves that behavior; mute describes message-tool evidence, not total downstream delivery. Fixing the host finalization policy is a follow-up for the broader cutover.
  • Exact-head CI completed twice: 129 checks passed, 43 skipped; only production dependency audit and its dependent aggregate failed. Both audit attempts exhausted npm advisory request timeouts without a result. The maintainer explicitly waived this availability failure and dependent gate for landing. No audit clearance or clean vulnerability result is claimed.

@steipete steipete self-assigned this Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 4, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 6:04 AM ET / 10:04 UTC.

ClawSweeper review

What this changes

The PR centralizes closed auto-reply execution status reporting so terminal callbacks, reply-operation receipts, and message-tool outcome records use one classifier while retaining separate delivery evidence.

Merge readiness

✅ Ready for maintainer review

Keep open. The small refactor preserves the existing terminal callback and message-tool record ordering while replacing two identical status projections with one shared helper; no blocking correctness or security defect was found.

Priority: P3
Reviewed head: 892f83902d8a62fee5b1f77fc4202dcd26f4d866

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A clean, bounded refactor with focused outcome coverage and no actionable review finding.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable to the external-contributor proof gate because repository state identifies a MEMBER author; the supplied body nevertheless links an exact-head isolated Gateway run consistent with the affected execution-reporting boundary.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable to the external-contributor proof gate because repository state identifies a MEMBER author; the supplied body nevertheless links an exact-head isolated Gateway run consistent with the affected execution-reporting boundary.
Evidence reviewed 5 items Shared status projection: The introduced helper maps settled success/failure, rejection, and abort outcomes to the same three execution states used by both reporting owners; delivery evidence is evaluated separately afterward.
Execution boundary and persistence owner: The execution entrypoint invokes the combined reporter after a closed result or thrown preflight failure; the storage owner still accepts the same completed, errored, and aborted values and delivery outcomes.
Current main remains unrefactored: Fetched current main still contains the separate terminal-callback classification and message-tool reporter, so the central cleanup is not already implemented upstream.
Findings None None.
Security None None.

How this fits together

Auto-reply executes an agent turn, then reports its terminal result to lifecycle owners and—when a message tool owns delivery—records whether a reply was sent. The shared classifier feeds those post-execution reporting paths while delivery evidence remains independent.

flowchart LR
  A[Incoming reply turn] --> B[Agent execution]
  B --> C[Closed execution result]
  C --> D[Shared status classifier]
  D --> E[Lifecycle callback]
  D --> F[Reply-operation receipt]
  C --> G[Message-tool delivery record]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -4, Tests +27. Total +23 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 4 28 32 -4
Tests 2 54 27 +27
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 82 59 +23

Review metrics

Metric Value Why it matters
Production vs test LOC production +28/-32 (net -4); tests +54/-27 (net +27) The helper replaces duplicated production classification while the added test cases cover its distinct callback and delivery combinations.

Technical review

Best possible solution:

Keep the single dependency-free execution-status projection at the auto-reply boundary and retain message delivery as an independent persisted fact.

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

Not applicable: this is a behavior-preserving refactor rather than a report of a user-visible defect; focused tests exercise the changed terminal and delivery outcome combinations.

Is this the best way to solve the issue?

Yes. A small shared classifier removes duplicate outcome mapping at both existing owners, while the message-tool recorder continues to derive delivery independently from the embedded-run result.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a bounded behavior-preserving internal refactor with low user-impact urgency.
  • 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: Not applicable to the external-contributor proof gate because repository state identifies a MEMBER author; the supplied body nevertheless links an exact-head isolated Gateway run consistent with the affected execution-reporting boundary.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (1 earlier review cycle)
  • reviewed 2026-09-04T09:42:44.105Z sha 892f839 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 64eb197 into main Sep 4, 2026
313 of 318 checks passed
@steipete
steipete deleted the codex/automation-outcome-settlement branch September 4, 2026 10:33
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
…law#138127)

Share one closed execution-status projection across terminal callbacks, invocation-owned reply receipts and message-tool reporting. Preserve independent delivery evidence, callback ordering, abort handling and persisted status values.

Production LOC: -4. No database, config, protocol or scheduler changes.

Validation: 283 focused candidate tests; 40 tests after the unchanged case move; production/core-test types, lint and repository guards. Independent Codex reviews found no actionable findings. Exact-source isolated real-provider Gateway parity passed on OpenClaw and Codex: https://github.com/openclaw/openclaw/actions/runs/33858740814. The pre-existing NO_REPLY fallback diagnostic remains a named follow-up.

Exact-head CI: 129 checks passed and 43 skipped. Two production audit attempts exhausted npm advisory-service request timeouts; security-fast and its aggregate are the only failures. The maintainer explicitly waived this availability failure and dependent gate. Native prepare validated review artifacts, then rejected the failed aggregate; no green gate stamp or audit clearance is claimed. Landing uses that narrow maintainer-authorized exception.

Related: openclaw#135933
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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