Skip to content

Cover completed background tasks in the Lead's inbox poller, and mark when teammates finish (#46)#429

Merged
Bill-Billion merged 1 commit into
shareAI-lab:mainfrom
Bill-Billion:feat/s15-poller-background-results
Jun 25, 2026
Merged

Cover completed background tasks in the Lead's inbox poller, and mark when teammates finish (#46)#429
Bill-Billion merged 1 commit into
shareAI-lab:mainfrom
Bill-Billion:feat/s15-poller-background-results

Conversation

@Bill-Billion

Copy link
Copy Markdown
Collaborator

Follow-up to #428 (now merged), which added the Lead's inbox poller for #291. That poller delivers teammate inbox messages, but a completed background task still strands its result, and there is no signal once every teammate has finished.

A completed background task does not wake the Lead, and collect_background_results() runs only inside the tool-use branch, so a plain-text turn never picks it up. This is the same stranding as #46, in s15.

Change (only s15_agent_teams/code.py), extending the same poller rather than adding a second path:

  • has_pending_background() reports, without consuming, whether any background task has completed.
  • The poller wakes on unread inbox messages or a completed background task.
  • The wake handler drains both the inbox and collect_background_results() before the turn, so background results become new turns without user input, the same way teammate results already do.
  • A single "[all teammates done]" marker prints once the last teammate finishes and its output is drained.

Verification with the real API, sending no user input between the task prompt and quit:

  • a teammate's result is delivered by the poller, then "[all teammates done]" prints;
  • a background bash job (sleep 6) is delivered by the poller ~6s later as a new turn ([wake: 0 inbox + 1 background]).

Out of scope: terminal prompt/output still interleaves (needs a TUI; real Claude Code uses Ink). Three-language README not updated.

… when teammates finish (shareAI-lab#46)

The inbox poller added in shareAI-lab#291 wakes the Lead on teammate inbox messages, but a
completed background task still strands its result: nothing wakes the Lead for it,
and collect_background_results() runs only inside the tool-use branch, so a
plain-text turn never picks it up. There is also no signal once every teammate has
finished.

Extend the same poller instead of adding a second path. has_pending_background()
reports, without consuming, whether any background task has completed. The poller
now wakes on unread inbox messages or a completed background task, and the wake
handler drains both the inbox and collect_background_results() before running the
turn, so background results become new turns without user input, the same way
teammate results already do. When the last teammate finishes and its output has
been drained, a single "[all teammates done]" marker is printed.
@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

@Bill-Billion is attempting to deploy a commit to the crazyboym's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Bill-Billion Bill-Billion merged commit ab2cf01 into shareAI-lab:main Jun 25, 2026
3 of 5 checks passed
@Bill-Billion Bill-Billion deleted the feat/s15-poller-background-results branch June 26, 2026 03:35
Bill-Billion added a commit to Bill-Billion/learn-claude-code that referenced this pull request Jun 26, 2026
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