Skip to content

fix: bound oversized background task completion notices - #151012

Closed
Jackten wants to merge 1 commit into
openclaw:mainfrom
Jackten:fix/bounded-task-notifications-20260917
Closed

Jackten wants to merge 1 commit into
openclaw:mainfrom
Jackten:fix/bounded-task-notifications-20260917

Conversation

@Jackten

@Jackten Jackten commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Closes #151006

What Problem This Solves

Fixes oversized background-task completion notices when a backend returns a long diagnostic or terminal summary.

User Impact

Terminal and blocked-follow-up notices now contain a detail preview of at most 120 characters, ending in an ellipsis when shortened. Short actionable errors stay visible; full task diagnostics remain stored. Information beyond the preview still requires inspecting the task or child session.

Why This Change Was Made

Reuse the existing task-status sanitizer and compact-detail limit at terminal formatting sites. This preserves current sanitization, delivery routing, parent-review instructions, and diagnostic storage without a new setting or API.

Evidence

On public base a1cc9b38c1c89a0d1d41d71a4160a7b14cd04d02, the real ACP error formatter → lifecycle event → registry path produces a 1,801-character notification on both direct and parent-session routes. The fix produces 168 characters for that fixture, including its title/run label. Both route tests assert that the full stored error is unchanged.

  • Six new bound checks fail on the unmodified base; all seven new cases pass with the fix, including short Error:-prefixed prose.
  • 192 tests pass across the four selected suites below.
  • Complete build, core types, task-containing test type shard, focused lint, formatting, and diff checks pass.
  • Repository autoreview: scoped-clean through P2. External transport/model calls and the full repository check/test matrix were not run; tests use scratch state and one fork worker under host limits.
Validation commands
node scripts/run-vitest.mjs run --config test/vitest/vitest.tasks.config.ts src/tasks/task-executor-policy.test.ts --maxWorkers=1 --pool=forks
node scripts/run-vitest.mjs run --config test/vitest/vitest.infra.config.ts src/tasks/task-registry.test.ts --maxWorkers=1 --pool=forks
node scripts/run-vitest.mjs run --config test/vitest/vitest.unit-fast.config.ts src/tasks/task-status.test.ts --maxWorkers=1 --pool=forks
node scripts/run-vitest.mjs run --config test/vitest/vitest.acp.config.ts src/acp/control-plane/manager.background-task.test.ts --maxWorkers=1 --pool=forks
pnpm build
pnpm tsgo:core
node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.other.json --incremental
node scripts/run-oxlint.mjs src/tasks/task-executor-policy.ts src/tasks/task-executor-policy.test.ts src/tasks/task-registry.test.ts
pnpm exec oxfmt --check src/tasks/task-executor-policy.ts src/tasks/task-executor-policy.test.ts src/tasks/task-registry.test.ts
git diff --check

macOS 26.5.2, Node.js 24.21.0, locked source install. OPENCLAW_STATE_DIR and OPENCLAW_CONFIG_PATH point to scratch paths for every test invocation.

@clawsweeper

clawsweeper Bot commented Sep 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.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 29, 2026, 9:34 PM ET / September 30, 2026, 01:34 UTC (Revision 2).

ClawSweeper review

What this changes

The branch limits background-task terminal and blocked-follow-up notice details to 120 characters and adds formatter and delivery-route regression tests.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this PR open. PR close coverage proof kept this PR open against #151120: model PR close coverage proof was incomplete: PR B carries the useful notice fix and is the merged place to assess it. PR A’s additional truncation of successful results is not material remaining work according to its durable report.

Priority: P2
Reviewed head: a5e457a50e773925fb0ae8a981e66209ba7af71c

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused regression coverage is useful, but this branch lacks real behavior proof and its broader success truncation was superseded by a more selective merged fix.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The branch's task formatter is exercised through synthetic ACP lifecycle events and mocked delivery, with shorter notices and intact stored errors asserted; its own reviewed snapshot supplies no after-fix real-setup observation. The merged replacement's separate Gateway and CLI proof supports supersession but is not proof for this branch. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The branch's task formatter is exercised through synthetic ACP lifecycle events and mocked delivery, with shorter notices and intact stored errors asserted; its own reviewed snapshot supplies no after-fix real-setup observation. The merged replacement's separate Gateway and CLI proof supports supersession but is not proof for this branch. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items PR close coverage proof: PR close coverage proof kept this PR open against #151120: model PR close coverage proof was incomplete: PR B carries the useful notice fix and is the merged place to assess it. PR A’s additional truncation of successful results is not material remaining work according to its durable report.
Introduced formatter change: The pinned PR delta adds the 120-character limit to success, failure, lost, and blocked notice formatting.
Canonical replacement: GitHub context identifies #151120 as merged on 2026-09-19, formally closing the same reported issue, #151006. Its recorded real Gateway and CLI proof shows bounded failure and blocked notices, unchanged full task errors, and intact long successful results.
Findings None None.
Security None None.

How this fits together

The former Tasks runtime received ACP lifecycle results, stored task diagnostics, and formatted notices for direct delivery or a parent session. The proposed change sits in that notice formatter, between stored task results and user-facing messages.

flowchart LR
  A[ACP lifecycle result] --> B[Task record]
  B --> C[Notice formatter]
  C --> D{Delivery route}
  D --> E[Direct notice]
  D --> F[Parent session event]
  B --> G[Full diagnostic]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The branch's task formatter is exercised through synthetic ACP lifecycle events and mocked delivery, with shorter notices and intact stored errors asserted; its own reviewed snapshot supplies no after-fix real-setup observation. The merged replacement's separate Gateway and CLI proof supports supersession but is not proof for this branch. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Complete close-coverage proof - Complete the pull request close-coverage proof before merge.
Agent review details

Security

None.

PR surface

Source +13, Tests +91. Total +104 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 18 5 +13
Tests 2 91 0 +91
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 109 5 +104

Review metrics

None.

Root-cause cluster

Relationship: superseded
Canonical: #151120
Summary: The merged replacement addresses the same reported ACP notice failure and retains the useful regression coverage.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep this PR open until a linked canonical PR proves it covers this PR's unique work, or a maintainer confirms closure.

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

Yes, for the historical bug: the pinned source and registry tests describe the ACP lifecycle-to-notice path and its oversized output. I did not execute that path in this read-only review; current main has removed it.

Is this the best way to solve the issue?

No. The merged replacement covers the failure and blocked-notice problem while preserving successful result content, and the branch's former runtime is no longer on main.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against da46de9d54bd; fix evidence: release v2026.9.6.

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P2: The reported oversized ACP notices were a limited-blast-radius user-facing bug.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The branch's task formatter is exercised through synthetic ACP lifecycle events and mocked delivery, with shorter notices and intact stored errors asserted; its own reviewed snapshot supplies no after-fix real-setup observation. The merged replacement's separate Gateway and CLI proof supports supersession but is not proof for this branch. No stored-data contract changes. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. A task completion notice delivered through Telegram would visibly change, although this branch is being closed as superseded.

Evidence

What I checked:

  • PR close coverage proof: PR close coverage proof kept this PR open against fix(tasks): bound ACP terminal notification details #151120: model PR close coverage proof was incomplete: PR B carries the useful notice fix and is the merged place to assess it. PR A’s additional truncation of successful results is not material remaining work according to its durable report.
  • Introduced formatter change: The pinned PR delta adds the 120-character limit to success, failure, lost, and blocked notice formatting. (src/tasks/task-executor-policy.ts:38, a5e457a50e77)
  • Canonical replacement: GitHub context identifies fix(tasks): bound ACP terminal notification details #151120 as merged on 2026-09-19, formally closing the same reported issue, [Bug]: ACP task failure notices include unbounded diagnostics #151006. Its recorded real Gateway and CLI proof shows bounded failure and blocked notices, unchanged full task errors, and intact long successful results. (506c6556a5be)
  • Merged-fix history: The repository records the replacement's merge commit as the ACP terminal-notification fix. (506c6556a5be)
  • Release provenance: The merged replacement commit is contained in release tag v2026.9.6. (506c6556a5be)
  • Current-main runtime removal: Current main no longer contains src/tasks; its last change to the proposed formatter path is the Tasks and TaskFlow removal. Some older blobs could not be read from this partial checkout because its promisor fetch returned HTTP 403, so the replacement's detailed behavior is grounded in the supplied GitHub PR record rather than a local read of its historical blob. (src/tasks/task-executor-policy.ts, 6652f7eac8d9)

Likely related people:

  • Bartok: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: 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-17T17:12:18.310Z sha a5e457a :: needs real behavior proof before merge. :: none

obviyus added a commit that referenced this pull request Sep 19, 2026
Closes #151006

## What Problem This Solves

Fixes oversized ACP background-task failure notices when a backend returns a long diagnostic chain.

## User Impact

Failure, lost-task, and blocked-task notifications show a sanitized detail preview of at most 120 characters. Short actionable errors remain visible, and full diagnostics stay in the task record for `openclaw tasks show`.

Successful completion summaries remain intact, including parent-review messages. Delivery policy, routing, and persistence are unchanged. No new setting or public API is introduced.

## Why This Change Was Made

Terminal notices used the existing sanitizer without its display bound. Failed and lost notices now reuse the canonical task-status detail formatter; blocked notices and their follow-ups use the same existing limit. The fix does not truncate the producer's error or successful result.

The registered-lifecycle regression from #151012 is retained with contributor credit and strengthened with a real SQLite reset/reload. Notification tests and their existing fixture are separated from the oversized registry test file without dropping coverage. This PR preserves the original contributor commit.

## Evidence

Reproduced on pinned main `d879b3f61d11` and verified on this PR through the shipped CLI and an isolated Gateway: `gateway call agent` → real HTTP model response invoking `sessions_spawn(runtime=acp)` → registered ACP backend → task notification dispatch. A registered channel adapter delivered direct notices over loopback HTTP; queued notices were observed in the actual parent model's HTTP requests.

| Scenario | Main | This PR |
| --- | --- | --- |
| Failed task, direct channel and parent-model routes | 1,801-character notice | 168-character notice with the actionable sign-in error and ellipsis |
| Public `openclaw tasks show --json` | Complete 1,753-character canonical error | Same complete error |
| Actual permission-denied task | Full blocked diagnostic in the notice | Bounded notice; the complete file path remains available through `tasks show` |
| Follow-up after inspecting the blocked task | Completed | Completed and wrote the requested artifact using the recovered full path |
| Successful completion received by parent model | Complete 420-character result | Same complete result, not truncated |

The registered-lifecycle regression separately verifies that the full diagnostic survives resetting the task registry and reloading from SQLite.

Final focused verification: **197 tests passed across five files**, including registered direct/queued delivery, long successful results, blocked follow-ups, short actionable errors, task status, and ACP task ownership. Four-file type-aware lint reported zero warnings/errors. Formatting, whitespace, and the changed-file line-cap ratchet passed.

```sh
node scripts/run-vitest.mjs \
  src/tasks/task-registry.notifications.test.ts \
  src/tasks/task-registry.test.ts \
  src/tasks/task-executor-policy.test.ts \
  src/tasks/task-status.test.ts \
  src/acp/control-plane/manager.background-task.test.ts
```

The ACP backend, model, and channel adapters are synthetic public-SDK plugins, running with private state and loopback HTTP only. No external provider, Telegram client, live Telegram delivery, operator Gateway, or full local repository test matrix was exercised. No production test seam or direct lifecycle injection was used in the CLI proof.

Co-authored-by: Jackten <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 20, 2026
Closes openclaw#151006

## What Problem This Solves

Fixes oversized ACP background-task failure notices when a backend returns a long diagnostic chain.

## User Impact

Failure, lost-task, and blocked-task notifications show a sanitized detail preview of at most 120 characters. Short actionable errors remain visible, and full diagnostics stay in the task record for `openclaw tasks show`.

Successful completion summaries remain intact, including parent-review messages. Delivery policy, routing, and persistence are unchanged. No new setting or public API is introduced.

## Why This Change Was Made

Terminal notices used the existing sanitizer without its display bound. Failed and lost notices now reuse the canonical task-status detail formatter; blocked notices and their follow-ups use the same existing limit. The fix does not truncate the producer's error or successful result.

The registered-lifecycle regression from openclaw#151012 is retained with contributor credit and strengthened with a real SQLite reset/reload. Notification tests and their existing fixture are separated from the oversized registry test file without dropping coverage. This PR preserves the original contributor commit.

## Evidence

Reproduced on pinned main `89380978922b` and verified on this PR through the shipped CLI and an isolated Gateway: `gateway call agent` → real HTTP model response invoking `sessions_spawn(runtime=acp)` → registered ACP backend → task notification dispatch. A registered channel adapter delivered direct notices over loopback HTTP; queued notices were observed in the actual parent model's HTTP requests.

| Scenario | Main | This PR |
| --- | --- | --- |
| Failed task, direct channel and parent-model routes | 1,801-character notice | 168-character notice with the actionable sign-in error and ellipsis |
| Public `openclaw tasks show --json` | Complete 1,753-character canonical error | Same complete error |
| Actual permission-denied task | Full blocked diagnostic in the notice | Bounded notice; the complete file path remains available through `tasks show` |
| Follow-up after inspecting the blocked task | Completed | Completed and wrote the requested artifact using the recovered full path |
| Successful completion received by parent model | Complete 420-character result | Same complete result, not truncated |

The registered-lifecycle regression separately verifies that the full diagnostic survives resetting the task registry and reloading from SQLite.

Final focused verification: **197 tests passed across five files**, including registered direct/queued delivery, long successful results, blocked follow-ups, short actionable errors, task status, and ACP task ownership. Four-file type-aware lint reported zero warnings/errors. Formatting, whitespace, and the changed-file line-cap ratchet passed.

```sh
node scripts/run-vitest.mjs \
  src/tasks/task-registry.notifications.test.ts \
  src/tasks/task-registry.test.ts \
  src/tasks/task-executor-policy.test.ts \
  src/tasks/task-status.test.ts \
  src/acp/control-plane/manager.background-task.test.ts
```

The ACP backend, model, and channel adapters are synthetic public-SDK plugins, running with private state and loopback HTTP only. No external provider, Telegram client, live Telegram delivery, operator Gateway, or full local repository test matrix was exercised. No production test seam or direct lifecycle injection was used in the CLI proof.

Co-authored-by: Jackten <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
@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 Sep 30, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Oct 14, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ACP task failure notices include unbounded diagnostics

1 participant