Repository navigation
Conversation
Add an independent terminal viewer for invocation relationships, explicit waits, and retained agent results from local CLI event logs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the list view with Graph (default) and Timeline tabs that use Copilot CLI's tab bar, query chips, key-hint footer, detail dialog and Primer theme modes. Record wait history, main-session turns, launch mode, prompts and follow-up links; keep tool calls hidden until toggled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Lifecycle and attribution: - session.resume after session.shutdown makes the session live again. - subagent.completed/failed settle the agent's open execution instead of rewriting its first one; recorded outcomes are never overwritten. - cancelled: true is shown as its own "cancelled" status, not done/failed. - Only phase-less or final_answer messages count as results; "replied" requires a final answer in the current model turn. - Rejected or blocked session.task_complete requests no longer complete an agent. - Tool arguments of unexpected types no longer stop the viewer. Rendering: - Later turns of a reused agent sit under its first turn (bounded depth); Timeline indentation is capped. - Graph cards narrow to fit wide fan-outs before scrolling; off-screen content is skipped; edge labels use the free space on their row. - Timeline tick labels keep a gap from the now marker; header chips stay readable at 80 columns; the inspector splits at 100 columns as documented and shows tool calls in single-column mode; relationship overflow is reported; wrapped text is cached; wide characters at the right edge no longer widen a row. - Main tool count reports the total, not the 200-entry buffer. Tests cover each fix plus reader offsets across polls/64 KB chunks, the lazy-load race, reset, display names and graph scrolling. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Graph and Timeline captures from a fictional demo session, linked from the README. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Ink delivers ordinary keys that arrive together (a held key while a frame renders, buffered input) as one string, so the viewer dropped them. Apply each key in order, rebuilding the tree per key so a filter change followed by navigation in the same chunk stays consistent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unsanitized launch IDs can trigger clipboard-changing terminal sequences on exit, while uncleaned display text can overflow reserved UI fields.
13 open issues
Strip terminal control characters from source diagnostics · New Sanitize all displayed text before measuring and rendering · New Surface task-prompt load failures · New Prevent text reuse across source generations · New Prioritize current warnings over reset notices · New Wrap error diagnostics to the available column width · New Copy the remaining tail to release consumed buffer memory · New Close the open main turn when shutting down · New Settle superseded running executions as unknown · New Check outstanding waits before labeling a session idle · New Backfill unresolved waits when matching launch evidence arrives · New Allow chart tick steps to grow for multi-day windows · New Cache predecessor-chain resolution during tree rebuilds · New
1 file not reviewed
tools/agent-monitor/package-lock.json: Generated file
What changed in this PR
Adds a standalone, read-only terminal monitor for one explicitly selected local Copilot CLI session. It provides agent-execution visibility related to #1783 without changing the CLI runtime or built-in /tasks interface.
Changes:
- Adds Graph and Timeline views for recorded launches, waits, execution outcomes, and reused-agent turns.
- Implements incremental log replay and live following, on-demand text loading, and source diagnostics.
- Provides themed, responsive layouts, keyboard controls, synthetic tests, and setup documentation.
| File | Description |
|---|---|
tools/agent-monitor/tsconfig.json |
Configures strict TypeScript checking. |
tools/agent-monitor/tsconfig.build.json |
Configures source compilation into dist. |
tools/agent-monitor/test/tree.test.ts |
Tests hierarchy, filtering, layout, and activity spans. |
tools/agent-monitor/test/model.test.ts |
Tests lifecycle, outcomes, relationships, and follow-ups. |
tools/agent-monitor/test/fixture.ts |
Supplies synthetic session events. |
tools/agent-monitor/test/events.test.ts |
Tests incremental reads, lazy text loading, resets, and malformed records. |
tools/agent-monitor/test/App.test.tsx |
Tests views, controls, responsive layouts, and asynchronous loading. |
tools/agent-monitor/src/tree.ts |
Builds filtered execution trees and shared status/time labels. |
tools/agent-monitor/src/timeline.ts |
Draws execution lanes, waits, time axes, zoom, and pan. |
tools/agent-monitor/src/theme.ts |
Defines five semantic color palettes. |
tools/agent-monitor/src/screen.ts |
Implements styled terminal cells, clipping, and text helpers. |
tools/agent-monitor/src/model.ts |
Reconstructs agent executions, lifecycle states, and recorded relationships. |
tools/agent-monitor/src/graph.ts |
Draws adaptive spawn trees with wait labels and scrolling. |
tools/agent-monitor/src/events.ts |
Reads JSONL incrementally and loads recorded text on demand. |
tools/agent-monitor/src/cli.tsx |
Adds session selection, theme options, and terminal startup/cleanup. |
tools/agent-monitor/src/chrome.ts |
Draws tabs, hints, and the detail inspector. |
tools/agent-monitor/src/App.tsx |
Coordinates live following, selection, input, and rendering. |
tools/agent-monitor/README.md |
Documents setup, controls, compatibility, and limitations. |
tools/agent-monitor/package.json |
Defines standalone dependencies and development scripts. |
tools/agent-monitor/package-lock.json |
Locks package dependencies. |
tools/agent-monitor/.gitignore |
Excludes dependencies and generated build output. |
Review effort: Max (auto)
- Clean terminal control sequences in every drawn, measured or fitted string, and in the error printed after the alternate screen is restored. - Report task-prompt read failures, wrap read errors to the message column, show current warnings ahead of an informational reset notice, and only reuse loaded text within the same source generation. - Close the open main turn on session.shutdown; mark an execution superseded by an idle follow-up as unknown; show the main session as waiting whenever it has an outstanding blocking read; attach waits recorded before their target was known to its first execution. - Let timeline ticks grow in whole days for long windows. - Copy the unconsumed reader tail instead of retaining the whole buffer, and resolve first turns once per tree build (2,000-turn chain: 219 ms to 5 ms per build). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- extension/extension.mjs: experimental Copilot CLI extension adding /agent-monitor [graph|timeline|text]. It prints the session's agent tree in the conversation and opens the interactive view beside the CLI in a Windows Terminal or tmux split pane (otherwise it prints the command). - src/summary.ts: the plain-text agent tree, built from the same model. - --view graph|timeline, and v as a second key for switching views. - Treat 1.0.105 session logs as verified (local 1.0.105 sessions replay without errors). - docs/: mockups of the two views as an Agents tab in Copilot CLI's own tab bar, for discussing a built-in version. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Nov 4, 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.


Summary
Add an independent, read-only terminal viewer under
tools/agent-monitorfor one explicitly selected local Copilot CLI session, styled with Copilot CLI's own interface language. It answers the questions in the feature request: which agent launched which, who waited on whom and for how long, and what each finished execution produced.Related: #1783
This is a standalone sidecar TUI, not a change to the Copilot CLI runtime or its built-in
/tasksinterface.Screenshots
From a fictional demo session (synthetic events, no real transcript).
Graph (default view): spawn tree with launch modes and recorded wait durations; the dialog shows the selected agent's task, result and relationships.
Graph, selecting an agent that is blocked on the sync agent it launched:
Timeline: one swimlane per execution plus the main session's turns, waiting segments (
╍), wait connectors (▾), a later turn of a reused agent, and thenowcursor.Open it from Copilot CLI
tools/agent-monitor/extensionis an experimental Copilot CLI extension that adds/agent-monitor [graph|timeline|text]to the session you are working in. It prints the session's agent tree in the conversation, then opens the interactive Graph or Timeline beside the CLI as a Windows Terminal (or tmux) split pane:Proposal: a built-in Agents tab
The extension API has no way to add a tab to Copilot CLI's own tab bar, so the views open beside it. Built into the CLI, they could be one more tab next to Current and Sessions, with Graph and Timeline as sub-views:
What changed
·-separated key hints, bordered detail dialog, and Primer semantic colors for the/thememodes (--theme default|light|dim|high-contrast|colorblind).bg/syncplus recorded wait durations, naming the waiter when it is not the edge's parent. A reused agent's later turns sit side by side under its first turn. Cards narrow to fit a wide fan-out; beyond that the graph scrolls with the selection.nowcursor, and zoom/pan. The default window focuses on agent activity.tis pressed. Below 100 columns the dialog uses one column.done,failed,cancelled(recordedcancelled: true, not a failure),replied(final answer and turn end recorded without a lifecycle event), and last-observedrunning/waiting./agent-monitor [graph|timeline|text]prints the agent tree in the conversation and opens the interactive view beside the CLI; the viewer also takes--view graph|timeline.Review
Reviewed adversarially by two opposing agent groups, each with a separate production-code and test-code reviewer: one group argued for defects, the other challenged each claim against the event schema, synthetic reproductions, and aggregate counts from local logs. Confirmed findings were fixed in e40bc24. All 13 findings from the automated Copilot review on this PR were confirmed and fixed in f1b635c (control-sequence cleaning for every drawn string, read-failure reporting, shutdown/resume and superseded-turn lifecycle cases, early waits, multi-day timeline ticks, and tree-build cost).
Findings and resolutions
session.resumeaftersession.shutdownleft the sessionendedwith a frozen clockcancelled: truewas shown as donecancelledstatus (+test)phase: commentary) messages became results; stalerepliedstate and end timefinal_answerreplies count;repliedneeds a final answer in the current turn (+test)session.task_completewould show as doneread_agenttargets are read (+test)now; a wide character at the right edge widened a row+N moreline, generation-aware key, frozen clockValidation
npm run typecheckand the strict unused-code check (--noUnusedLocals --noUnusedParameters) pass.npm test: 37/37 pass. The 10 tests for the review fixes fail on the previous commit; each of the 5 new guard tests fails when its guard is removed; the 8 tests added for the automated review findings fail without f1b635c.npm run buildpasses; built--helpverified.cancelled); 8 arrive after the agent had already completed with no follow-up turn and now keepcompletedinstead of moving its end time to the cancellation. One CLI 1.0.21 log is rejected with an explicit diagnostic.session.shutdown(ended) andsession.resume(followingagain), quit with exit code 0 and alternate-screen restore, the source log left byte-for-byte unchanged, and a malformed record stopping the source with exit code 1. The run also found that keys arriving in one input chunk (a held key during a slow render) were dropped; fixed in e021792 with a test.--experimentalunder ConPTY:/extensions managelistsagent-monitoras running, and/agent-monitor textprints the tree in the conversation. The split-pane launch was checked in Windows Terminal: the pane's process received the viewer arguments intact, including a Node.js path containing spaces.Local preview
Requires Node.js 22+ and a truecolor terminal (Windows Terminal works). In a separate terminal tab:
Keys:
j/kselect, Tab orvswitches Graph/Timeline,ffilters,ttoggles tool calls, Page Up/Down scrolls the result,+/-and←/→zoom and pan the Timeline,qquits. To use it from inside Copilot CLI, see the extension section of the README.Limitations
not recordedrather than inferred.copilotexecutable.