Repository navigation
Native chat: read one saved row per subagent (part 1 of 2) - #27914
Conversation
Adds the singular `subagent` journal block (one row per child, revised in place, with a plain-text twin for older clients) and teaches every reader to draw it: desktop and phone fold a turn's sibling rows into the existing "Ran N subagents" row, the client and off-page rosters name children from their own rows, the reopen pass settles a row a dead host left working, and the phone and worker-transcript wires bound it. No producer writes the block yet; that switch lands in the follow-up.
…page window skips subagent rows - background is an open boolean so a later build's value never fails a chat load - a helper's own helpers fold under a groupId of their own, so the phone opens them apart - each subagent's own row rides along with the page window instead of counting as conversation
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to Nothing changes for users in this PR because the writer lands separately. Two small follow-ups are worth doing before the writer ships: align the Pre-merge checks |
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
8e16c100-48db-4d1e-976e-489336b8c5ab
📒 Files selected for processing (21)
mobile/src/session/mobile-native-chat-render-data.test.tsmobile/src/session/mobile-native-chat-render-data.tssrc/main/native-chat/agent-session-journal/journal-subagent-item.test.tssrc/main/native-chat/agent-session-journal/journal-subagent-item.tssrc/main/native-chat/agent-session-journal/journal-subagent-liveness.tssrc/main/native-chat/agent-session-wire/agent-session-history-conversation-window.test.tssrc/main/native-chat/agent-session-wire/agent-session-history-page.tssrc/main/native-chat/agent-session-wire/agent-session-history-subagent-roster.tssrc/main/runtime/orchestration/worker-transcript-activity-block-bounds.tssrc/main/runtime/orchestration/worker-transcript-payload.tssrc/main/runtime/rpc/methods/native-chat-rpc-block-sanitize.test.tssrc/main/runtime/rpc/methods/native-chat-rpc-block-sanitize.tssrc/renderer/src/components/native-chat/native-chat-subagent-sections.test.tssrc/shared/agent-session-journal-schemas.tssrc/shared/native-chat-subagent-items.test.tssrc/shared/native-chat-subagent-items.tssrc/shared/native-chat-transcript-projection.tssrc/shared/native-chat-types.tssrc/shared/structured-agent-session-subagent-roster.test.tssrc/shared/structured-agent-session-subagent-roster.tssrc/shared/worker-transcript-text.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
| if (repeated.has(label) && claimed.has(label)) { | ||
| for (let ordinal = 2; taken.has(label) || claimed.has(label); ordinal++) { | ||
| label = `${block.label} ${ordinal}` | ||
| } |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
Advance the ordinal search for repeated labels.
If a group contains many siblings named Audit, each sibling searches again from Audit 2. Ten thousand such siblings cause roughly fifty million candidate checks during transcript folding. Keep the next available ordinal per original label, while continuing to skip names in taken.
| * reported its own end; that run's own ending may still replace it. */ | ||
| outcomeBasis?: 'stop-acknowledged' | ||
| /** Told to outlive the turn that spawned it. */ | ||
| background?: true |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Allow both saved background values in the type.
The journal schema accepts background: false, but NativeChatSubagentBlock permits only true. A writer cannot assign that valid saved value without a type error. Change this field to background?: boolean so the shared type matches the saved-row contract.
|
Review summary (part 1 of 2; part 2 is #27947, stacked on this PR) What this PR is: Orca can now read and draw one saved record per subagent. The "Ran N subagents" grouping and numbering are worked out when the chat is drawn, and older grouped rows still read. Nothing the agents send changes yet, so nothing looks different until #27947 switches Claude, Codex and Grok over. Review: this PR was reviewed together with #27947, including a reviewer dedicated to the code that reads and draws subagent records.
Checked on its own against current main (c345741): this PR merges first and stays on main alone until #27947 lands, so it was checked that way. Merged cleanly, then:
Open items:
Merge order: this PR first, then point #27947 at main and merge it. |
…27914) * feat(chat): read one saved row per subagent Adds the singular `subagent` journal block (one row per child, revised in place, with a plain-text twin for older clients) and teaches every reader to draw it: desktop and phone fold a turn's sibling rows into the existing "Ran N subagents" row, the client and off-page rosters name children from their own rows, the reopen pass settles a row a dead host left working, and the phone and worker-transcript wires bound it. No producer writes the block yet; that switch lands in the follow-up. * fix(chat): open subagent background flag, separate nested group ids, page window skips subagent rows - background is an open boolean so a later build's value never fails a chat load - a helper's own helpers fold under a groupId of their own, so the phone opens them apart - each subagent's own row rides along with the page window instead of counting as conversation * refactor(chat): a subagent's group entry as one object (cherry picked from commit fe1f022)
* feat(chat): read one saved row per subagent Adds the singular `subagent` journal block (one row per child, revised in place, with a plain-text twin for older clients) and teaches every reader to draw it: desktop and phone fold a turn's sibling rows into the existing "Ran N subagents" row, the client and off-page rosters name children from their own rows, the reopen pass settles a row a dead host left working, and the phone and worker-transcript wires bound it. No producer writes the block yet; that switch lands in the follow-up. * fix(chat): open subagent background flag, separate nested group ids, page window skips subagent rows - background is an open boolean so a later build's value never fails a chat load - a helper's own helpers fold under a groupId of their own, so the phone opens them apart - each subagent's own row rides along with the page window instead of counting as conversation * refactor(chat): a subagent's group entry as one object (cherry picked from commit fe1f022)
ELI5
When an agent in a native chat starts helpers (subagents), Orca saves a "Ran N subagents" row in the chat. Today that row is one saved record for the whole turn, rewritten every time any helper changes. That design forced hidden limits (64 helpers per row, 32 rows, 256 per chat): a helper past the 64th vanished from the saved chat while it was still running, and Claude's saved row could say a helper finished while the running-tasks strip still showed it working.
This PR is the first of two. It teaches Orca to read a new, simpler saved shape: one saved row per helper, updated in place. Nothing writes that shape yet, so nothing changes on screen with this PR alone. The follow-up PR, #27947, switches Claude, Codex and Grok to write it and deletes the old grouped machinery.
What Changed
subagentrow per helper, saved where the helper was started and revised in place for every later change and run. It records the helper's id, name, state, the run its state describes, who started it, and, for a stop, whether the stop came from the agent accepting Orca's Stop (stop-acknowledged) rather than the helper reporting its own end. Beside it sits a plain sentence ("Kicked off subagent Audit" / "Ran subagent Audit (failed)") that older apps show instead.User-facing: none yet. Old grouped rows still render exactly as before and stay readable.
Why
Three architects reviewed the closed #27585 and agreed the grouped row was the wrong saved model: every cap and most of #27585's bookkeeping existed only because siblings shared one row. One row per helper removes those caps, makes one helper's update write one helper-sized row instead of copying all its siblings, and gives the strip, sidebar, Stop and chat one record to agree on. The grouping the user sees stays, but is computed when drawing.
Splitting readers first means the follow-up switches the writers and deletes the old path in one step, with no release where a writer produces rows a reader can't draw. This PR is marked ready only when the follow-up (#27947) is reviewable, and should merge only together with it.
Differences from the common pattern, labelled:
Linked Issue
Replaces #27585 (closed).
Visual Proof
N/A for this PR alone: no producer writes the new row yet, so nothing on screen changes. #27947 carries the before/after.
Testing
New focused tests:
src/shared/native-chat-subagent-items.test.ts(grouping at the first helper's place, per turn and spawner, ordinals, stable rows while nothing changed, old rows untouched, tool runs not split, fallback text),journal-subagent-item.test.ts(one key per helper, schema, bounds, keyed read-back, revision keeps the spawn position, reopen marks a dead host's helper unverifiable).Added cases to the client roster, off-page history roster, phone payload bounds, desktop sections (helper sections open under the derived row), and phone fold tests.
pnpm tc:node,tc:web,tc:clipass; lint and code-quality gates pass viaorca-ci-checks(its bun typecheck step fails locally on a tooling error, CI covers it). Phone tests need the phone app's own dependencies and run in CI.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Reviewed together with #27947 in four rounds, a readiness pass and live QA with real Claude, Codex and Grok; the review summary is on #27947. Fixes to this PR from the review: the saved
backgroundflag accepts any boolean (a fixedtruewould have made a later build'sfalseunreadable), nested groups get their own id, and history pages stop counting helper rows.Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)