Skip to content

Stop showing a work as waiting once its reply has arrived - #17

Merged
neotechnet merged 3 commits into
stack/installed-0.3.2from
fix/phantom-handoff-waiting
Nov 10, 2026
Merged

neotechnet merged 3 commits into
stack/installed-0.3.2from
fix/phantom-handoff-waiting

Conversation

@neotechnet

@neotechnet neotechnet commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Issue

No repo issue. This is defect phantom-handoff-ledger-20261110 from the internal register, shipped on Igor's order of 2026-11-10.

Base is stack/installed-0.3.2, not dev. The code that produces this label exists only on the local installed stack: origin/dev and origin/main do not carry onItTest, sentOnOwn or the live-only wait filter. A PR against dev would patch code that is not there.

What changed

ds-bot/src/host/handoffs.js

  1. A handoff closes when its reply is written. closeWork() now clears the parent's open id in the same save that attaches the result, instead of leaving the row open until the asking Bot read the answer. The row therefore never reads open with its result already attached.
  2. A failed delivery re-opens the wait. When a reply never reaches the asker, answerMissed() marks the result and puts the open id back, so the wait holds until the notice carrying the answer is read. This is what follow-through.test.js already pinned.
  3. The waiting label is live. held() drops an open id whose reply is already on the work and drops a Bot hand-off past a 24 hour ceiling with no result. Subagent runs are exempt, having no Bot to hand back. An ask sent outside any work marks its sender waiting only while it is recent, so an old unanswered ask cannot label an idle Bot for days.
  4. subWorkRun() now finds a settled run by its result as well as its open id, since a settled run is no longer open.

ds-bot/test/handoff-results.test.js: five tests, two of which reproduce today's behaviour.

Changelog

A handoff now reads closed as soon as its reply arrives, and a Bot no longer shows other Bots "waiting for X to hand back work" or "waiting for X to answer" on work whose answer already came back.

How I checked it

  • npm test: 2 failures, both pre-existing and reproduced on this branch with the change reverted (connectors-gateway.test.js, local-agents.test.js env sanitization)
  • node scripts/build-client.mjs --check (rc 0)
  • npm run lint (0 errors, 76 pre-existing warnings)
  • coding_job_verify.py --base stack/installed-0.3.2: 7 passed, 0 failed
  • Smoke test: not run. Install and bench are Steve's step for this job
  • Screenshot: no interface change

Reproducer: a handoff reads closed as soon as its reply arrives. Run against the unfixed file it fails on the work reads closed when the reply arrives, because open still held the answered child. The other reproducer, a work whose reply already arrived does not show as waiting, fails with actual: 'waiting for Tester to hand back work, for Chief'.

Read back from the module after the fix:

label before reply : waiting for Tester to hand back work, for Chief
label after reply  : idle
work row after     : {"open":[],"results":["child"]}
fresh ask, waitingView keys : ["a"]
old ask, waitingView keys   : []

Checklist

  • One issue, one subject
  • src/client/ not changed, so client.js is untouched
  • No keys, tokens or personal data
  • No AI tool as author or Co-authored-by

The status line other Bots read named a hand-off as still open whenever the work kept an open id, even after that reply had come back. Nothing cleared the id when the answer arrived by another route, so an idle Bot looked loaded on work that had ended days before, and every job watch chased it.

A work now stops counting as waiting when the reply for an open id is already on it, and when it has sat past a day with no result at all. A fresh work with no reply still shows as waiting.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T21:07:52.932749Z ab627b5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab627b546e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ds-bot/src/host/handoffs.js Outdated
.map(([id, work]) => ({
id,
work,
out: (forgotten(work) ? [] : work.open.filter(childId => !arrived(work, childId)))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the give-up action for expired waits

When a work exceeds 24 hours without a result, clearing out also removes its entries from waitingView(), which supplies the “Give up waiting” actions in src/client/context-menu.js:77. However, the child remains in work.open, so waitsWork() still returns true and src/host/turns.js:1206 continues holding the parent's answer. If the reply is actually lost, the parent remains blocked while the user loses the recovery action designed for precisely that situation. Preserve the actionable wait even if its status label is suppressed; the handoff design in docs/plans/2026-10-16-bot-handoffs.md explicitly requires user-controlled abandonment and excludes automatic TTLs.

AGENTS.md reference: AGENTS.md:L53-L53

Useful? React with 👍 / 👎.

The ceiling first applied to every open id, so a work holding a subagent run for more than a day dropped that wait and took the whole entry out of the wait view, which is the view a restart relies on. A subagent run has no Bot to hand back, so the arrived and ceiling rules now apply only to Bot hand-offs.
A work kept the open id until the Bot that asked got round to reading the answer, so a row read open with its result already attached and every watch saw a phantom handoff. Writing the reply now clears the open id in the same save that attaches the result.

A reply that never reaches the asker opens the wait again until the notice carrying it is read, which is the case the follow-through tests already pinned.

An ask sent outside any work now marks its sender waiting only while it is recent, so an old unanswered ask cannot label an idle Bot for days.
@neotechnet
neotechnet merged commit 8b8e198 into stack/installed-0.3.2 Nov 10, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant