Skip to content

Give every helper its own chat, with no time limit in your chats - #885

Open
sambitcreate wants to merge 28 commits into
mainfrom
claude/subagent-helper-chat
Open

sambitcreate wants to merge 28 commits into
mainfrom
claude/subagent-helper-chat

Conversation

@sambitcreate

@sambitcreate sambitcreate commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Problem

Helpers (subagents) were hard to follow and got cut off too soon.

  • Every helper in a chat shared one 10-minute clock for the whole reply, so long helpers were reported as "Timed out" or "deadline elapsed before admission".
  • When a helper stopped or failed, the main chat lost its work and could say "no subagent ran" when one had.
  • Clicking a helper only opened the Subagents inspector. There was no way to read what the helper actually said and did.

Change

This PR implements docs/plans/subagent-helper-chat-plan.md in three phases. Each phase was reviewed separately.

Phase 1: time limits and bug fixes

  • Time limits.
    • Helpers in attended chats have no clock: they run until they finish, fail or you press Stop. A 24-hour safety net stays in place, because the safety grant keeps its 24-hour ceiling.
    • Bot helpers get 60 minutes per reply, counted from the first launch.
    • Waiting in the queue costs no time in chats.
  • Stopped and failed helpers hand their last message and the files they changed back to the main chat.
  • Task text shows in full again, even with a JSON: block in it.
  • Result no longer repeats the warning.
  • A stuck helper shows Stop right in its "No recent update" notice.

Phase 2: saved helper conversations

  • Each helper's task, messages and steps are recorded while it runs:
    • saves are throttled to 250 ms and retried on failure;
    • the data is stored under userData/subagent-runs-v2/transcripts/;
    • it is deleted with the chat and counted in Storage.
  • Live updates stream on chat:subagent-transcript. Saved transcripts are merged with gap detection and capped at 2 MB, 600 entries and 200k characters per entry.
  • A best-effort credential filter hides secrets in a helper's words before they are saved.

Phase 3: the helper chat

  • Opening it. Clicking a helper anywhere opens its chat in the side panel: a row in the chat card, the pill's tray (Open helper chat / Review / View result), or the Subagents list.
  • Layout. The chat shows the task, every step, then the answer, and updates live. The footer holds the model, Stop, Expand and Close. Expand shows the helper full size in place of the main chat; Back (Esc) returns to the main chat.
  • One set of status words: Queued, Running, Waiting on you, Done, Failed, Stopped.
  • Errors. Failures show one plain sentence, with Ask the main chat to retry.
  • Approvals.
    • The main chat's approval card stays the canonical one.
    • When the expanded helper is waiting on the main chat, a soft warning bar offers Go to approval or Answer question. This focuses the card container (never Approve or Deny), scrolls to it, and briefly tints it. Under Reduce Motion the tint holds still.
    • The side panel says "Needs your approval in the main chat." and adds "after N other requests" (with Go to main chat) when other requests are queued ahead.
  • ChatApprovalCard keeps one stable screen-reader status line across consecutive approvals, so each new approval is announced. Its choices reset for each approval.
  • Hover cards and tooltips stay hidden while the expanded helper covers the main chat. Dialogs, alert dialogs and popovers opened over it are not affected.
  • Onboarding. The feature-gallery tile is renamed Helpers and gets a code-drawn helper-chat slice that fits every tile width.
  • Docs. README, the plan, the plans index and .memory/ are updated.

Scope

This implements the approved plan in docs/plans/subagent-helper-chat-plan.md (option (a) for the 24-hour question).

Phones: no protocol change. iOS and Android already know Stopped and Failed, and "Timed out" stays for old helpers and Bots.

Screenshots

Before and after, light and dark, at 2x with Reduce Motion on. These are hosted on claude/subagent-helper-chat-screenshots.

Before After
Running (light)
Running (dark)
Done with steps (light)
Done with steps (dark)
Failed (light)
Failed (dark)
Stopped (light)
Waiting (light)
Narrow panel (light)
Tray (light)

These states are new, so there is no before image:

Light Dark
Expanded helper chat
Waiting on the main chat
Saved transcript unavailable
Onboarding Helpers tile (1000px window)
Onboarding gallery (561px window)

Verification

All run locally on the merged head (a262f9e), on macOS:

  • npx tsc --noEmit -p . and npm run type-check:e2e: clean. eslint clean on touched files.
  • npm run test:ci-policy: 123 passed.
  • npm run test:subagents: all groups passed, 0 failures.
  • npm run test:onboarding: 78 passed. npm run test:tool-approval-card: 55 passed.
  • Focused suites: 252 passed across 13 files. These cover generation-stream, ipc-stream, chat-terminal-sync, chat-approval-card, environment-panel-focus, message-list-settle, agent-steps, the subagent-helper-chat component, state and store, chat-transition, and the motion contracts. Further suites from the review rounds also passed: focus-return, scroll-area-follow, bot-chat-pane, remote-chat-view and subagent-transcript-reader.
  • Electron E2E in a Cua Space (npm run test:e2e:space): subagent-helper-chat.spec.ts and bot-access-requests.spec.ts passed. Screenshot captures ran there too.

Review: after each phase, two independent reviewers (logic/tests and design/accessibility) checked the work, and fixes looped until both were clean. Phase 3 took seven rounds; round 7 was clean on both.

Known gaps and follow-ups

  • Approval wording. "Waiting for approval" in agent-steps.ts and in the iOS and Android strings is unchanged. Aligning it with "Waiting on you" is a copy change across all clients, so it is left for later.
  • Repeated text. The main chat still says "waiting on you" in the group summary, the row and the working line.
  • Button font size. The global unlayered button, input, textarea { font: inherit; } rule overrides text-* on buttons across the app. This PR works around it by setting text-small on the containers.
  • Other windows.
    • "Waiting on you" is worked out only in the window running the chat.
    • Other windows re-read the saved transcript rather than receiving the live stream.
  • Screen-reader edge case (also on main). If one approval is replaced in a single render by another with identical status text, the stable status line's text doesn't change and the second approval isn't announced.
  • CI flake (unrelated to this PR). renderer/server-visuals test "installed browser draws a chart" timed out after 15 s waiting for headless Chrome to render, in Desktop tests (renderer-other) on c0ce6e0: https://github.com/sambitcreate/aiden-agent/actions/runs/45141669928/job/137581496965. The next push re-ran the job; no code here touches server visuals.
  • Non-blocking Xcode 27 iOS job (unrelated to this PR). AidenSandboxedHTMLTests.testAPreviewPageMakesNoNetworkConnections timed out after 30 s waiting for the sandboxed page to finish loading on the iOS 27.2 simulator, on d749a2d: https://github.com/sambitcreate/aiden-agent/actions/runs/45145391635/job/137595998863. This PR changes no iOS code; the required iOS job runs the same suite on release Xcode.
  • Required iOS job flake (unrelated to this PR). AidenChatTests.testPreparationSurvivesTheChatComposerGivingWayToAQuestionCard failed after 58.5 s, then xcodebuild crashed (exit 134) and the result bundle was unreadable, on 5b10579: https://github.com/sambitcreate/aiden-agent/actions/runs/45150225985/job/137610078188. This PR changes no iOS code. The job was rerun once (https://github.com/sambitcreate/aiden-agent/actions/runs/45150225985/job/137669263184), but the rerun was cancelled from outside about three minutes into the tests (12:08 UTC, well inside its 50-minute limit), so it produced no result.
  • Non-blocking Xcode 27 iOS job, second failure (unrelated to this PR). AidenChatTests.testAssistantMarkdownKeepsTheFirstGlyphInsideItsRenderedBounds failed after 16 s ("The reply never rendered") on the iOS 27.2 simulator, on 5b10579: https://github.com/sambitcreate/aiden-agent/actions/runs/45150225985/job/137610078022. It failed again on its single rerun: https://github.com/sambitcreate/aiden-agent/actions/runs/45150225985/job/137669263290.
  • Required iOS job, attempts 2 and 3 (unrelated to this PR, which changes nothing under ios/ or android/). Attempt 2 was cancelled from outside the job about 3 minutes into the tests, so it gave no result: https://github.com/sambitcreate/aiden-agent/actions/runs/45150225985/job/137669263184. Attempt 3 failed on a different test, AidenSandboxedHTMLTests.testAPreviewPageMakesNoNetworkConnections (109 s, the same sandboxed-page load that timed out on Xcode 27): https://github.com/sambitcreate/aiden-agent/actions/runs/45150225985/job/137691833283. The same XCTest step also failed on main at ed53724 (run 45086015387).
  • Existing compaction leak. The main chat's compaction path can keep the second line of a multi-line PASSWORD: block. This is a separate fix.
  • Credential filter limits.
    • The helper credential filter is a best-effort heuristic. A secret wrapped onto a line that reads as a capitalised word, such as Done., is kept.
    • Filtering is per message, so a secret split across two messages is not caught.
    • MCP tools show their generic label in saved conversations.

AI disclosure

This PR was written by a coding agent (Claude Code), with separate agent reviewers after each phase.

Checklist

  • I tested these changes locally and reviewed the diff myself
  • Related docs / tests are updated where behavior, settings, or contracts changed
  • No unrelated refactors or changes are included

The privacy filter no longer swallows the line break after an indented
block, treats bare all-caps labels such as JSON: and TASK: as labels,
and re-runs until the text settles before hiding everything. The panel's
single-line task preview joins those labels with a dash so it survives
the stricter snapshot check.
Chat helpers get a 24-hour safety net and a Bot reply's helpers share
60 minutes from the first launch, after which further launches are
refused. Stopped, failed and timed-out helpers hand the parent their
settled messages and changed files, marked incomplete and unverified.
The Result no longer repeats the warning, and a stuck helper's Stop
button sits inside its No recent update notice.
Keep secret-named colon blocks hidden in both filters, hand over partial work safely, prefer a child's result only when it finished before a stop, give CLI durable Bots one helper clock per turn, pass a stopped CLI helper's filtered streamed text, and widen the settlement seal past the drain grace.
Record each helper's task, messages and tool steps while it runs, using
the main chat's step builder and its credential filter (keys hidden,
file paths kept). Each helper's conversation is saved atomically beside
the chat's helper records, capped at 2 MB with the oldest steps dropped
first, and removed when the chat is deleted, including after a restart
mid-delete.

The existing history read returns the saved copy once the run is proven
to belong to the chat, and a new live stream sends changed entries to the
owning window, with a merge helper for a reader that joins mid-run. Bot
helpers on the desktop and under aiden serve save the same way. Phones
receive nothing yet, and there is no UI in this change.
Hide private key blocks (whole or cut off), same-line secret-named values
such as OTP, PIN, PASSCODE, CVV and SEED, and keys in every step field of a
saved helper conversation. Hold back an unfinished word or an open key block
while a message streams.

Save each revision before streaming it, keep one save in flight, retry a
failed save with backoff and bounded final attempts, and apply size trims to
the recorder so dropped content stays dropped. Hand the helper's result back
without waiting for the final save, settle recorders from the supervisor's
seal, and map timed-out helpers to cancelled.

Record tool events as the main chat does, including pending tool calls and
activity anchors, and carry edit line counts from the helper's file tools on
the desktop and under aiden serve. Guard the CLI's recorder calls, remove
stale temporary files left by a crashed save, and update the plan, README and
project notes.
Hide wrapped secret tails and recovery phrases in helper transcripts, keep
ordinary prose and settings readable, and hide same-line secret values in
the panel too. Report a run of failed transcript saves once and pause
retries after five, unref the final save's retry wait, and cap how long a
finished chat reply waits for its helpers' final saves. Show refused helper
tools as blocked and tools ending during a stop as cancelled, as in the
main chat. Test the transcript path through the real supervisor, and
correct the ownership wording in the plan and notes.
The Subagents panel now opens a helper chat when a transcript exists:
the task as a bubble, the helper's messages and steps, approvals inside
the chat, a soft problem box with Ask main chat to retry, Technical
details, Jump to latest and a Stop / Expand / Back bar. Expand replaces
the main messages until Esc or Back. Status words are unified as
Queued, Running, Waiting on you, Done, Failed and Stopped, and the tray
button reads Open helper chat.
Render tests cover a running helper (task, steps, Stop), a stopped one
(problem box, no Stop), the summary fallback when nothing is saved,
retry staging the request without sending it, Expand with Esc and Back
returning focus to the opener, a late-joining window's merge, and the
status announcement. Store and state tests cover the merge rules,
chat-switch reset, approval routing and plain-language problem text.
The chat pane's body replacement sat inside the hidden, inert transcript
wrapper, so Expand showed an empty pane. It now renders beside that wrapper.
A ScrollArea test covers the replacement staying reachable, and a Playwright
test opens a helper from its chat card row, expands it, returns with Esc and
sees it finish.
…he helper chat

Every subagent surface now uses the same six status words: Queued, Running,
Waiting on you, Done, Failed and Stopped. The chat card summary, the
composer pill, the side panel's groups and summaries, the activity marks
and the onboarding art all read from them, and the panel files an unknown
helper under Stopped.

While a helper's write request is waiting for an answer, its helper chat
says "Waiting on you", uses the waiting tone and shows the question inside
the chat, so it can be answered there.

Also map the new helper chat E2E spec in the CI spec-to-source map, update
the quick view test for the renamed Done group, and bring the README, plan
status, busy-controls, activity-marks and UI inspiration docs and the
project memory up to date.
- Expanded helper chat: a bar says when the main chat waits on something
  else (a question or another approval); its Back returns to the main chat
  and focuses what waits. The side panel shows "Showing in the main chat"
  while a helper is expanded.
- Late join: a running helper with no saved transcript is fetched once;
  gaps refetch from the saved copy, and refetch keys clear on failure, on an
  empty answer and on a chat change.
- The helper chat uses the shared chat column, shows the model's display
  name (effort left out when off), groups runs of tool-only steps, and uses
  plain copy. Retrying twice puts the request in the message box once.
- Only the shared announcer speaks status; the helper chat's own live
  region is gone. Sticky headers use the popover surface in the side panel.
- Technical details is a toggle that scrolls into view and takes focus.
  Selectors and memoised transcripts keep other helpers' tokens from
  redrawing the view; the side panel reads only the selected helper.
- On a chat switch the old chat's live updates and approvals are never
  taken as the new chat's, whichever sync runs first.
- Stop / Stop all, Close in the side panel and Back when expanded, a
  working row, refresh error with Try again, keyed views per run.
- Docs: README, plan, plan index and project memory updated.
- Plain failure sentences, one Back in the expanded footer, and a
  waiting bar (soft note, one polite announcement) whose button reads
  Go to approval or Answer question and focuses that card or questionnaire.
- The main approval card is canonical: the side panel shows a compact
  "Waiting on your approval in the main chat" row; the full card only
  when expanded. Focus skips the helper's own approvals.
- A non-owner window re-reads the saved copy when the run's status or
  revision changes, including terminal; a failed late-join read shows
  the refresh row with Try again.
- Closing the expanded chat focuses the side panel's new Expand button.
- A helper row's model card is not rendered while a helper chat is
  expanded, so a stuck hidden card can no longer swallow Esc.
- Hover card shows the model name, hides Effort when off; Stop all only
  with active children; "Writing its report"; onboarding art updated.
- Docs, plan and project memory updated; tests extended.
- Only a rejected transcript read shows Couldn't load; reads are
  coalesced per helper (one in flight, at most one a second).
- Go to approval focuses the main approval card itself; the compact row
  says how many other requests come first.
- Hover cards and tooltips render nothing while their surface is covered
  (the expanded helper chat, or the narrow side panel floating over the
  transcript), replacing the chips' special case.
- Wording: turn-limit reasons, Ask the main chat to retry, Waiting on you
  for the main working line, Back to main chat (Esc).
- One label rule for the waiting overlay, judged against every helper.
- Closing the expanded chat falls back to the same helper's Expand button.
- Docs and project memory updated.
- Dialog and AlertDialog reset the covered-surface context inside the
  Radix Content again, so the portal keeps the ref Presence needs and the
  exit animation plays; a focus-return test checks that a closing dialog
  stays mounted until animationend.
- The Go to approval tint eases with the decelerate token and, under
  Reduce Motion, holds still for the same 1.2 s instead of being skipped.
- ChatApprovalCard is keyed by approvalId.
- The environment panel sets its failure flag from each failures updater.
- Onboarding Helpers tile: in narrow tiles the raised chat sits under the
  selected row and runs off the right edge, and the narrowest tiles hide
  the status word; the one-column layout is unchanged.
- README, plan and project memory updated.
- Helpers onboarding tile: below a 260 px tile the raised chat opens under
  the selected row and runs off the right edge (top 60, left 16); its header
  More icon is hidden there, and status words are hidden wherever they would
  be cut (below 160 px and 260-305 px).
- ChatApprovalCard keeps one stable status line and LiveGuard outside a body
  keyed by approvalId, so each approval is announced on the same live region
  and starts with fresh choices; callers no longer key the card and
  ComputerUseAccessApproval drops its duplicate wrappers.
- Covered-surface reset test now covers Dialog and AlertDialog.
- Bot chat and bot-access-requests E2E query the requester-prefixed card name.
…appers

The first-approval-card test from main looked for a region named
"Review before …"; approval regions now lead with "Request from <Bot>:".
The component sink now lists SurfaceCovered and DismissHoverSurfaces as
context wrappers that render no element.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

Two lifecycle gaps can leave saved helper chats permanently incomplete in other windows and restart a Bot reply's advertised 60-minute helper limit.

Reviewed changes across the complete initial diff, including helper scheduling, persistence, IPC, renderer state, approvals, storage cleanup, desktop/CLI Bot parity, and user-facing helper-chat behavior.

  • Helper execution limits — replaces the shared short deadline with attended-chat safety behavior and a per-Bot-reply 60-minute clock while preserving partial work on non-success outcomes.
  • Saved helper conversations — records, redacts, bounds, persists, streams, reloads, merges, and deletes helper transcripts with their owning chats.
  • Helper chat interface — adds side-panel and expanded transcript views, normalized statuses, Stop/retry controls, model details, focus restoration, and approval/question navigation.
  • Cross-surface integration — extends desktop and CLI Bot runtimes, IPC/preload contracts, shutdown flushing, storage accounting, onboarding, docs, and focused/E2E coverage.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏

… reply's helper clock

Another window reading a finished helper could settle on an empty or
unfinished saved copy written before the final save landed, and then never
read again. A finished helper's read now re-reads with growing gaps until
the final copy arrives (bounded), and the detail read no longer counts a
pre-final copy as read.

The per-claim helper clock map dropped its oldest entry past 256 claims,
which could hand a still-running reply a fresh 60 minutes. The cap is gone;
every claim already ends in a release signal or its Bot's removal.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The terminal transcript retry still accepts one stale persisted shape as final, so another window can permanently miss a fast helper's conversation.

Reviewed changes since the prior Pullfrog review at a262f9e8, covering the two follow-up commits and their lifecycle tests.

  • Preserved active Bot clocks — Removed capacity eviction so a running claim retains its original 60-minute helper budget through rebuilt tools.
  • Retried terminal transcript reads — Added terminal refetch reasons, final-copy classification, bounded polling, and detail-read coordination for non-owner windows.
  • Updated affected tests — Adjusted approval-card and component-sink expectations after the Phase 3 UI restructuring.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes since the prior Pullfrog review at d749a2d7, covering the terminal-transcript fix and its formatting-only follow-up.

  • Rejected task-only terminal copies — Required a saved helper conversation to contain at least one message before it can satisfy terminal finality, preserving bounded polling through the initial-save race.
  • Updated lifecycle coverage — Changed the focused state test to assert that the recorder's initial task-only save is inconclusive while closed messages remain final.
  • Restored source formatting — Returned the touched state module to its original formatting without changing behavior.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes since the prior Pullfrog review at 5b10579e, covering the merge from main and its overlapping helper-chat integrations.

  • Merged current main — Retained the helper-chat documentation and test registration while incorporating the release and proactive-chat changes now on the base branch.
  • Preserved transcript finality — Kept the task-only transcript guard and bounded terminal-read behavior intact through the merge and formatting reconciliation.
  • Combined chat-pane behavior — Preserved helper status overlays and hover-surface dismissal while also passing upstream lead-chat labels to the resolved MessageList.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏

This branch has not been deployed

No deployments
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