Skip to content

Allow requesters to cancel unaccepted task results - #203

Merged
hsliuustc0106 merged 2 commits into
mainfrom
fix/result-ready-cancel
Oct 17, 2026
Merged

hsliuustc0106 merged 2 commits into
mainfrom
fix/result-ready-cancel

Conversation

@hsliuustc0106

@hsliuustc0106 hsliuustc0106 commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #202. Refs #198.

A returned task currently has only an acceptance path, so the requester cannot cancel an unwanted result. Allow result-ready → cancelled through the existing task-cancel endpoint. Preserve the returned summary and requester actor history, and keep accepted/cancelled/failed states terminal. This records task disposition, not confirmation that an external runtime stopped.

Five new channel regressions cover persistence, late transitions, forged/wrong/revoked actors, the requester of a granted Bot versus its owner, and acceptance racing cancellation. Update subsystem/design docs, the changelog fragment and generated patches. Independent of #201.

Verification at a07ed3b2f7ce1d8748093c02e84cc66e4dcc4038:

  • DSH_HARNESS=/workspace/FlyBot/core/dev/harness npm run verify: pass, 1,027 tests, 0 failed/skipped.
  • Pack, strict plugin API typecheck (TypeScript 5.9.3), actionlint 1.7.7, changelog and diff checks: pass.
  • Mock smoke: all 40 steps pass via dev/bench.sh task-cancel 3296 8896 reset with CONTEXT_WINDOW=100000 CHECK_RATIO=0.45, then node dev/smoke.mjs task-cancel 3296 in core/. DSH source pinned to tag dsh-v0.2.0-rc.2 (639ed015397290b3745d163aafe02ffee4aa3f84), built without source changes. Both bench processes stopped.
  • The cancellation regression failed before the fix with result-ready cannot become cancelled.
  • Not run: Desktop, real models or live OpenCode/Bot Social integration. External review will be arranged by the maintainer; no independent review agreement is claimed.

No new endpoint, runtime privilege, social friendship exception or team-mode enablement.

Smoke evidence at a07ed3b2f7ce1d8748093c02e84cc66e4dcc4038

The smoke evidence missing from the INC report is now available below. These are author-run results, not an independent review. The tip is unchanged, tests-ok is green, and independent review remains outstanding.

From core/, with the built DSH checkout at tag dsh-v0.2.0-rc.2 (639ed015397290b3745d163aafe02ffee4aa3f84):

DSH_HARNESS=/workspace/FlyBot-dsh-smoke CONTEXT_WINDOW=100000 CHECK_RATIO=0.45 dev/bench.sh task-cancel 3296 8896 reset
node dev/smoke.mjs task-cancel 3296
dev/bench.sh task-cancel 3296 8896 stop
Captured output: all 40 steps passed (mock model only)
ok   bootstrap: Chief waits for a model (2.9 s, 0 model calls)
ok   user picks a model; Chief greets and asks in its reply (3.5 s, 1 model calls)
ok   Chief creates Writer, who replies (7.4 s, 8 model calls)
ok   a Bot is not offered dsh's blocking question tool (5.3 s, 2 model calls)
ok   user creates Coder, who keeps the default model (3.3 s, 1 model calls)
ok   Chief creates a group (5.7 s, 3 model calls)
ok   user talks in the group (3.3 s, 1 model calls)
ok   admin calls everyone (4.5 s, 3 model calls)
ok   Chief posts to the group (5.7 s, 5 model calls)
ok   Chief sets the group notice (5.7 s, 3 model calls)
ok   Chief reads the group (5.7 s, 3 model calls)
ok   Writer writes long reply 1 (5.3 s, 2 model calls)
ok   Writer writes long reply 2 (5.3 s, 2 model calls)
ok   Writer writes long reply 3 (5.3 s, 4 model calls)
ok   Writer searches its own chat across parts (5.7 s, 3 model calls)
ok   earlier part pages load (2.9 s, 0 model calls)
ok   Writer keeps working 1 (5.3 s, 2 model calls)
ok   Writer keeps working 2 (5.3 s, 4 model calls)
ok   Writer keeps working 3 (5.3 s, 2 model calls)
ok   Writer condensed in place, not switched (2.9 s, 0 model calls)
ok   Writer finds a condensed message (5.7 s, 3 model calls)
ok   Writer wraps up 1 (5.3 s, 4 model calls)
ok   Writer wraps up 2 (5.3 s, 2 model calls)
ok   Writer wraps up 3 (5.4 s, 4 model calls)
ok   Writer wraps up 4 (5.4 s, 2 model calls)
ok   exchange log between Chief and Writer (2.9 s, 0 model calls)
ok   update Writer (2.9 s, 0 model calls)
ok   Coder works in a folder of its own (2.9 s, 0 model calls)
ok   Coder answers from its folder (5.3 s, 2 model calls)
ok   Coder goes back to the team workspace (2.8 s, 0 model calls)
ok   pin Coder (2.8 s, 0 model calls)
ok   make Coder a Main Bot and back (2.8 s, 0 model calls)
ok   duplicate Coder (3.3 s, 1 model calls)
ok   set prefs (2.9 s, 0 model calls)
ok   delete the group (2.9 s, 0 model calls)
ok   delete the copy (2.9 s, 0 model calls)
ok   Chief sees its attached MCP and skill (5.4 s, 2 model calls)
ok   Chief first group turn sees its attached MCP and skill (3.7 s, 1 model calls)
ok   Coder does not inherit Chief capabilities (5.3 s, 2 model calls)
ok   detached capabilities disappear from Chief (5.3 s, 2 model calls)

smoke: all 40 steps passed

Output SHA-256: c6f7db76d7d9508e4f34d510353d120a950fe10cb90561624dd19f43cea98ea1. Cleanup confirmed both mock and web processes stopped.

Yixuan Xu added 2 commits October 17, 2026 15:51
Fixes #202. Refs #198. Preserve the returned evidence and requester decision across restart; keep accepted, cancelled and failed tasks terminal.

@hsliuustc0106 hsliuustc0106 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verifier review — INC

Verdict: INC — no actionable findings and every check I ran is green, but the repo's own merge contract is not yet satisfied: this is a src/host/ change whose smoke test has not run, and no independent (Codex) review exists on this tip. Per the review-pr skill, one-side-only review cannot be PASS.

Tip SHA: a07ed3b2f7ce1d8748093c02e84cc66e4dcc4038
Ran (in a worktree at this tip, Node 22.17.0):
  - TZ=UTC npm run verify → pass (core 755, social 160, tree 56, .github scripts 56; oxlint + arch-docs "OK (7 changed file(s))"; build-client --check; ds-bot-patches check)
  - Fail-without-change: reverted only core/src/host/tasks.js to merge base a63309f, ran test/tasks.test.js → 2 of the 5 new tests fail with exactly "a task that is result-ready cannot become cancelled" (the transition tests); restored the tip file
  - Byte-compared core/src/host/tasks.js and core/test/tasks.test.js against patches/ds-bot/files/ counterparts → identical
Not run:
  - Smoke test — this is a src/host/ change, so AGENTS.md asks for it; the author deferred it pending the DSH dsh-v0.2.0-rc.2 build, and this machine has no ../deepseek-harness checkout to run the bench
  - Desktop, real-model steward, live OpenCode/Bot Social integration — out of scope for this change
  - Codex-side review — none exists on this tip yet
OpenCode↔Codex: only OpenCode
Verdict: INC

What the change is

The entire host change is one transition-table entry (result-ready: ['accepted', 'cancelled']) plus a rewritten comment at core/src/host/tasks.js:27. The task-cancel endpoint is untouched: authority still comes from the server-derived actor via requireRequester (body claims like requesterId/actorId are ignored, and the forged-actor test confirms bot/forbidden/bot/unauthorized), terminal states stay terminal, and transition() only mutates status/actors — so the returned summary and actor trail survive cancel and restart by construction. That matches issue #202's acceptance list point by point, including "task disposition, not runtime-stop confirmation," which the two doc updates state correctly.

Findings

No actionable findings. Notes, none blocking:

  • The other three new tests (forged/revoked actors, accept-vs-cancel race) also pass on the pre-change host — they pin pre-existing refusal behavior of the new pathway rather than the fix itself. The PR body's claim ("the cancellation regression failed… then passed") is accurate as written, so this is hardening, not dishonest coverage.
  • CI's tests-ok and the package job are green on this exact SHA.
  • Local-only wrinkle: plugins/social fails 3 face-room title tests on a UTC+8 machine; under TZ=UTC they pass 160/160. Environmental, unrelated to this PR.

Security fence / display names

Not in scope — the diff touches no delivery, fencing, or model-visible remote text. The task.result.summary storage (2,000-char cap) predates this PR; cancel adds no new model-visible surface. No secrets, no DSH patching, no hand-edited client.js, tests use the plugin's temp homes.

This report is a Verifier assessment only — not merge authority. To reach PASS the maintainer needs the smoke test (or a written waiver for it) and an independent review agreeing on this same tip SHA; if the tip moves, this review is void.

@hsliuustc0106
hsliuustc0106 added this pull request to the merge queue Oct 17, 2026
Merged via the queue into main with commit dd2dea4 Oct 17, 2026
6 checks passed
@hsliuustc0106
hsliuustc0106 deleted the fix/result-ready-cancel branch October 17, 2026 16:45
@hsliuustc0106 hsliuustc0106 added the status:done Scoped task completed and merged; does not imply parent acceptance is complete label Oct 17, 2026 — with ChatGPT Codex Connector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:done Scoped task completed and merged; does not imply parent acceptance is complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow requesters to cancel unaccepted task results

1 participant