Repository navigation
fix: avoid extra heartbeat messages after visible child execs - #147432
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 October 2, 2026, 10:05 AM ET / 14:05 UTC (Revision 6). ClawSweeper reviewWhat this changesThe PR identifies visible child sessions before launching background commands, suppresses their extra completion heartbeats, and preserves command execution when the optional identity lookup fails. Merge readiness✅ Ready for maintainer review This remains a useful, distinct fix that current main and the latest release do not implement. The prior lookup-failure finding and runtime-proof gap are resolved; no actionable introduced defect remains. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s exec tool launches commands and retains background results for process polling. Its completion notifications can also request a heartbeat turn, while child sessions already report through their separate announcement flow. flowchart TD
A[Agent command] --> B[Exec preparation]
C[Saved child session identity] --> B
B --> D[Background process]
D --> E[Retained completion result]
E --> F[Process polling]
E --> G{Child session?}
G -->|Yes| H[Existing child announcement flow]
G -->|No| I[Completion heartbeat]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +60, Tests +245. Total +305 across 9 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Use the existing persisted child classifier to keep child completions with polling and announcements while retaining ordinary-session notifications and resilient command startup. Do we have a high-confidence way to reproduce the issue? Yes: a visible dashboard child can start an unpolled background command that exits after its announcement; current main’s key-only guard still requests the extra wake. Source establishes the path, and the PR records a real Telegram base/candidate comparison; this review did not execute it. Is this the best way to solve the issue? Yes: extending the existing child-ownership classification at exec startup is narrower than disabling notifications broadly or changing heartbeat scheduling, and the failure fallback preserves existing execution behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a1903fca5bdb. 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)
|
|
Related but not superseded: #153795 (23462b4) suppresses completion events for explicitly canceled background commands, except cleanup failures. It does not implement the persisted visible-child ownership guard proposed here, and ordinary non-canceled child completions are unaffected. This PR and #147326 remain separate from the landed cancellation fix. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
# Conflicts: # src/agents/bash-tools.exec-host-gateway.test.ts # src/agents/bash-tools.exec-run.ts # test/vitest/vitest.database-worker-core-paths.mjs
|
@clawsweeper review Updated head f27ff34 preserves the contributor commits, resolves the main conflicts, and fixes the rejecting/cached session-worker lookup. The PR body now records real Telegram base/candidate proof, the direct-background and lookup-failure controls, and the exact-head gpt-5-mini live gate. Please review this head. |
|
🦞👀 Re-review progress:
|
|
Maintainer override on head Red CI (run 37016491922) comes from
Proof: the real Telegram Test Server.
|
CI failure attributionThe two tooling failures are inherited from the newer main used by CI, not caused by this PR's notification imports. Same command in secretless Docker, Node 24.16.0, unchanged frozen-lockfile dependencies:
The small-6 checkout log identifies the tested source as On that exact main parent, the relative-ESM wrapper test fails for The identical missing entries are: Main commit CI run completed with these two failing tooling jobs and their aggregate |
…aw#147432) * fix: avoid extra heartbeat messages after visible child execs * fix(agents): skip child session lookup when exec cannot notify * fix(agents): fall back when exec child identity lookup fails --------- Co-authored-by: Tosko4 <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #147326
What problem this solves
A visible child uses a dashboard session key. Its background exec completion therefore bypassed the hidden-subagent key guard and could send a second heartbeat notification to the parent's chat after the child's result announcement.
Fix
Retains Tosko4's persisted-envelope classification (
spawnedBy/spawnDepth) through exec settlement. Results remain available to process polling, and ordinary background commands still notify. Classification uses the existing read-only session worker only when background notifications are possible; execution authority is rechecked after the await.The review follow-up makes this optional identity lookup fail open for notification routing, not command execution: a rejected lookup falls back to the previous key-based behavior, clears the cached promise, and permits the next command to retry classification. A transient worker failure cannot prevent the command from starting or poison the tool instance.
No config, schema, migration, permission, or heartbeat schedule change. Thanks to @Tosko4 for the report and original fix. No overlap with Pash/Sarah changes.
Evidence
Candidate:
f27ff343d9618a4f696287e68ebaa7267a312da3. Integratedmainatfc17c21ad7d4039bcee593552eb83b86b1ea2cb2only to resolve actual conflicts, preserving contributor commits.sessions_spawnwithvisible: true, the dashboard child starts realsleep 20; exit 1in the background and returns its launch result, and the parent announces it. The process remains unpolled and finishes after the child announcement. The model choreography is deterministic; spawn, persistence, subprocess, heartbeat scheduling, and Telegram delivery are real.gpt-5-minithrough a forward-only proxy and deliveredP147326_LIVE_OKto the leased Telegram Test Server DM at 7.003 s. One request reached OpenAI and returned HTTP 200; one auxiliary request for a different model was rejected locally without forwarding. The proxy enforced a six-attempt cap. No synthetic provider response was used for this gate. Lease, key file, Gateway, and live container were removed after each run.Known local baseline failures
bash-tools.exec-host-gateway.test.tshas the same 3 failed / 37 passed on the candidate and the reverted notification-production baseline:allow-always.These are allowlist planning/trust cases. This PR only relocates an unchanged notification-output import in that gateway owner; the classification catch is outside
processGatewayAllowlist. Candidate and baseline timings are 33.11 s and 33.35 s respectively. These are local baseline-equivalence results, not a claim that hosted CI is green.