Repository navigation
fix(agent-bus): deliver subagent messages while they're current - #338
Merged
Merged
Conversation
nixuuu
marked this pull request as ready for review
November 7, 2026 13:23
nixuuu
added a commit
that referenced
this pull request
Nov 8, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 8, 2026
Report inputs could appear after newer answers, leave empty cancelled work, and repeat for the same child result. Desktop and phone could retain different projections after consumption or reconnect. This keeps report delivery unique per recipient and child turn and preserves the loaded timeline window across recovery. ### Causes and evidence 1. In the supplied recording, repeated purple reports with 4-hop and 2-hop badges sit beside empty cancelled work while newer 03:33 and 03:35 turns appear below during scrolling. Web appended turns without transcript elements after all event-backed rows. Those turns now keep their canonical ordinal position; transcript/background events retain event sequence order. 2. A spawn and subsequent admitted steers can share a target turn. Completion previously notified once per call: the gateway/worker reproduction produced three reports for one result. Delivery now claims the result once per recipient under its existing thread lock. Different hop counts are consistent with distinct calls; the original call IDs are unavailable, so the recording alone cannot establish the precise relay path. 3. Consuming pending bus inputs cancelled them without withdrawing their timeline rows or broadcasting the changed projections. Consumption now withdraws them and publishes turn/steer updates. Migration 0096 repairs historical consumed inputs while preserving started/dispatched work and genuine cancellations. Explicit-message consumption was introduced by #338; per-call completion notifications and the empty-turn layout predate it. 4. Real-browser paging exposed another jump: report-bearing threads conservatively fall back to a full snapshot on reconnect, replacing an expanded window with its last 24 turns. Additive UI field `from_turn_id` preserves the inclusive oldest loaded turn on both clients, with authoritative reset for invalid history. Late old turn updates stay outside a loaded tail. Fork ancestry keeps chain order. `nightly.100` includes #350 and was published at 00:21:46 Warsaw on November 8, before the reported 03:33 observation. Installation on the reporting Mac is unconfirmed. These paths reproduce on a base containing #350 and explain persistence either way. No linked-computer topology is needed. ### Validation - Gateway↔scripted-worker/Postgres regressions cover admitted steers, fallback/consumption, wait_threads progress, idle report delivery, distinct results with identical text, repeated sweeps, late old projections, disk-cache restore, expanded history, and gateway restart. A paired mobile client uses Connect over pinned Network access with the same device credential after restart; its projection matches the BFF-coalesced desktop path. Before the fix, duplicate delivery was 3 instead of 1 and consumed inputs never updated live. - Migration upgrade regression preserves genuine, started and dispatched cancellations. History integration covers full-snapshot resume and invalid window/version resets. - Gates passed: `bun install`, `bun run gen:check`, `bun run typecheck` (including mobile), `bun run lint`, `bun run format:check`, and the web build. The complete `bun run check:tmp` ran in four sequential native shards (`--shard=1/4` through `4/4`, `--timeout 30000`): **1780 pass, 161 skip, 0 fail across all 320 files**, with a clean test temp directory after each shard. Two monolithic attempts were interrupted by SIGTERM, so sharding completed the full gate. The existing steering regression now expects one shared-result report instead of two. - Real browser: light/dark at 1280×800 and 390×844, long labels, older-page loading/reconnect, genuine cancellation placement, consumed-report removal, jump to latest, and composer reply also observed by the paired mobile client. Test servers and tabs were closed. Packaged macOS/iPhone apps and the optional Android emulator were not run. The isolated fixture lacks linked-computer runtime, producing an unrelated `/api/computers` 409. - Copy audit (§8): no UI strings added or changed; consumed inputs no longer render misleading empty cancelled work. Existing cancellation copy remains for real cancellations. CI: static checks, all four CI test shards, and Web/Linux builds passed on this head. Windows packaging reached the prepared runtime and electron-builder, then failed with HTTP 504; its failed job was retried once. No external review yet; inline self-review found no outstanding issues. Fixes: #338 Related: #350
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Child
send_messagecalls defaulted to a separate parent turn. While the parent was waiting or testing, those turns accumulated behind its work and repeated information it had already read from the child or its completion report.wait_threadsreceives messages in its result and returns early.ask_user. Polish bus, architecture and data-model docs describe the semantics and additive migration 0095. No proto or UI changes.Validation:
bun install,bun run gen:check,bun run typecheck,bun run lint,bun run format:checkand the web build pass locally. All 16 new scripted-worker regressions pass, covering wait delivery, default ancestor steer, idle/explicit queue timing, fallback, final-report deduplication, covered reads, cancellation and restart/replay. Existing bus, notification and provider/tree tests also pass. Opt-in live coverage was extended but not run.Full CI is green: static checks, all four test shards with temp-directory checks, web/Linux builds and the aggregate check. The local full
check:tmp --timeout 30000run had 1742 passes, 161 skips and one unrelated linked-composer failure (Studio B disconnected); that file passed its isolated rerun, with a clean temp-directory check. The local full run also confirmed no leftover test temp directories.Copy audit (docs/copy.md §8): model-facing text is English, short and factual. Delivery notes identify the sender and give an explicit UTC time; busy context describes why a message waited. Tool guidance states what happens next and when to use
send_messageorask_user. No promotional language, personality copy or visual-only cues. UI layout, responsive-name checks and browser review are not applicable because no UI text or components changed.This corrects long-standing default delivery behavior; no recent introducing PR was identified.