Skip to content

Re-carry: close a handoff when its reply arrives - #27

Merged
neotechnet merged 1 commit into
stack/installed-0.3.5from
fix/recarry-phantom-handoff-035
Nov 17, 2026
Merged

neotechnet merged 1 commit into
stack/installed-0.3.5from
fix/recarry-phantom-handoff-035

Conversation

@neotechnet

Copy link
Copy Markdown
Owner

Job LE-20261111-042 (list_bots 'waiting for' label that does not clear).

The fix was built and merged as #17 into stack/installed-0.3.2 on 2026-11-10 (merge 8b8e198). When the stack moved to 0.3.5 it was not carried: ds-bot/src/host/handoffs.js on stack/installed-0.3.5 is still the pre-fix blob 4054b0d3, which is exactly the base #17 was written against. So the fix is not in the running app.

This PR applies the #17 content unchanged (git cherry-pick -m 1 8b8e198, clean apply). Scope: ds-bot/src/host/handoffs.js, ds-bot/test/handoff-results.test.js. Intended to ride the same rebuilt patch as #26 so Steve restarts once.

PR #17 merged into stack/installed-0.3.2 on 11-10, but the 0.3.5 stack was carried without it: its handoffs.js is still the pre-fix blob 4054b0d. So list_bots still shows Bots waiting on work whose reply already arrived. This applies the #17 content unchanged (cherry-picked from 8b8e198 with -m 1).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 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-16T21:38:12.591494Z ca71fe2 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: ca71fe2665

ℹ️ 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 on lines +154 to +156
const results = work.results ?? []
// A settled run is no longer open, so the results name it too.
const ids = new Set([...(work.open ?? []), ...results.map(result => result.id)])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Exclude consumed results when matching subagent notices

When a subagent is continued while its earlier parent work still exists, this search keeps selecting the first run even after its settlement notice was read. takenWork() only removes IDs from work.open; it does not remove entries from work.results, which are now searched unconditionally. Consequently, turns.js routes subsequent settlement notices to the earlier parent instead of the work owning the new run. This is reproducible by settling and taking r1 under p1, then settling r2 for the same child under p2: subWorkRun() still returns r1/p1. Track which results have been consumed separately so each notice advances to the correct run.

Useful? React with 👍 / 👎.

Comment on lines +306 to +308
const pastCeiling = work => Date.now() - (work.at ?? 0) > WAIT_CEILING_MS
const forgotten = work => (work.results ?? []).length === 0 && pastCeiling(work)
const stillOwed = (work, childId, child) => child.to === undefined || (!arrived(work, childId) && !forgotten(work))

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 recovery controls for aged outstanding handoffs

When a parent work is over 24 hours old and has no results, this filter hides all its Bot handoffs even if the recipient is still running or waiting for approval. It also uses the parent's age, so a newly dispatched child can disappear immediately. The underlying IDs remain in work.open, and waitsWork() still prevents the parent from answering, but waitingView() no longer exposes those waits. Since src/client/context-menu.js builds the give-up actions from waitingView().waits, the user loses the recovery action for precisely these outstanding handoffs. Keep actionable outstanding waits visible, or explicitly settle them rather than only filtering their presentation.

Useful? React with 👍 / 👎.

Comment on lines +368 to +370
// An ask sent on its own marks its sender waiting only while it is recent: one
// whose answer never closed it must not label an idle Bot for days.
for (const work of sentOnOwn()) if (onIt(work.to) && !pastCeiling(work)) add((view[work.from] ??= { bots: [], rooms: [], for: [] }).bots, work.to)

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 Apply the standalone-ask filter to the status text too

For an unanswered standalone ask older than 24 hours whose recipient is active, this change clears the sender from waitingView() but leaves statusOf() reporting waiting for … to answer. The latter still builds its sent list using only work.from === botId && onIt(work.to), without the new age check. Thus the stale waiting label remains in the status returned to other Bots through list_bots, despite the new test passing for the sidebar projection. Apply the same eligibility predicate to both projections so the reported status actually clears.

Useful? React with 👍 / 👎.

@neotechnet
neotechnet merged commit 33b9633 into stack/installed-0.3.5 Nov 17, 2026
14 checks passed
@neotechnet
neotechnet deleted the fix/recarry-phantom-handoff-035 branch November 17, 2026 12:16
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