sync: port upstream native subagent & workflow observability (#5219) - #214
Conversation
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com> (cherry picked from commit a2ca89a)
Keep fork provider catalog/rate-limit surfaces and RuntimeEventRaw coverage while formatting the merged providerRuntime test imports. Co-authored-by: aaditagrawal <aaditagrawal@users.noreply.github.com>
…ility) Co-authored-by: aaditagrawal <aaditagrawal@users.noreply.github.com>
|
Warning Review limit reached
Next review available in: 51 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (46)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1dbfe4850d
ℹ️ 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".
| export function classifyTaskAgentKind(input: { | ||
| readonly taskType?: string | undefined; | ||
| readonly agentId?: string | undefined; | ||
| }): "agent" | "background" { | ||
| const { taskType, agentId } = input; | ||
| const nonAgentType = | ||
| taskType !== undefined && (MONITOR_TASK_TYPES.has(taskType) || INERT_TASK_TYPES.has(taskType)); | ||
| if (agentId !== undefined && agentId.trim().length > 0) { | ||
| return taskType === undefined || nonAgentType ? "background" : "agent"; | ||
| } | ||
| return nonAgentType ? "background" : "agent"; |
There was a problem hiding this comment.
Keep executable classification out of the contracts package
Move classifyTaskAgentKind and its mutable classification sets into a runtime package such as @t3tools/shared; adding executable provider-classification logic here breaks the repository's explicit requirement that packages/contracts remain schema-only and makes consumers load application behavior from the contract boundary.
AGENTS.md reference: AGENTS.md:L75-L75
Useful? React with 👍 / 👎.
| } | ||
| const truncated = stat.size > SCRIPT_BYTE_CAP; | ||
| const buffer = Buffer.alloc(Math.min(stat.size, SCRIPT_BYTE_CAP)); | ||
| const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0); |
There was a problem hiding this comment.
Read until the requested script bytes are filled
When the script resides on a filesystem that returns a short positional read, FileHandle.read may report fewer bytes than the requested buffer without reaching EOF. This single call then returns incomplete script contents while truncated remains false, so the viewer silently presents a partial file; loop until the buffer is filled or EOF is reached.
Useful? React with 👍 / 👎.
| roster = roster | ||
| .slice() | ||
| .sort((a, b) => rank(a) - rank(b) || b.updatedAt.localeCompare(a.updatedAt)) | ||
| .slice(0, ROSTER_LIMIT); |
There was a problem hiding this comment.
Preserve workflow coordinators when capping the roster
A supported 100-member Claude workflow produces 101 roster entries once its coordinator is included. Because the coordinator progress row is processed before the synthesized member rows, this active-only timestamp sort typically makes the coordinator the oldest entry and slices it out; deriveAgentPanelModel then has no workflow ID to group against, so all members appear as orphaned direct agents and the phase/script workflow UI disappears. Preserve coordinators or apply the cap only to leaf agents.
Useful? React with 👍 / 👎.
| settledCount, | ||
| totalTokens, | ||
| hasAgents: true, | ||
| liveCount: runningCount + waitingCount, |
There was a problem hiding this comment.
Exclude workflow coordinators from displayed agent counts
For every live workflow, this total counts both the coordinator task and each member as an agent. ChatView uses liveCount to render “N agents working,” so a five-member workflow is reported as six agents, and the panel footer is inflated the same way; derive agent counts from direct and workflow-member rows while tracking coordinator liveness separately.
Useful? React with 👍 / 👎.
| // don't slide. | ||
| return; | ||
| } | ||
| if ((wasTerminal || agent.status === "idle") && (status === "running" || status === "pending")) { |
There was a problem hiding this comment.
Treat waiting as a new agent activation
When an idle Codex child is resumed and its first thread/status/changed patch reports waitingOnApproval or waitingOnUserInput, the adapter emits waiting before turn/started; this condition does not treat that transition as reactivation. The following running patch also misses because the prior status is now waiting, leaving the new activation with the previous run's count, timer, result, and error. Include waiting in the active reactivation path.
Useful? React with 👍 / 👎.
| case "task_notification": { | ||
| context.liveTaskIds.delete(message.task_id); |
There was a problem hiding this comment.
Release completed Claude task bookkeeping
In a long-lived Claude session, every completed subagent remains in taskAgents, and every workflow slot remains in workflowMemberFingerprints; only liveTaskIds is cleared here. Repeated turns therefore grow these maps without bound, while each attributed stream block also linearly scans all historical taskAgents, causing steadily increasing memory use and attribution latency. Prune terminal task metadata and its workflow fingerprints after emitting the final event, or maintain bounded/reverse indexes.
Useful? React with 👍 / 👎.
Catch-up after upstream moved during the
v0.0.32release.What lands
subagentRuntime, web Agents panel + timeline integration, thread background livenessFork deviations preserved
rateLimitThreadsalongside newagentPanelModelPROVIDER_OPTIONSwhile adding upstream subagent coverageRuntimeEventRawhelpers with upstreamclassifyTaskAgentKindAncestry
Includes
git merge -s ours upstream/mainsoupstream/mainis again an ancestor (0 unique commits behind).Verification
vp checkandvp run typecheckpass; focused suites 134/134.