Skip to content

feat(agents): input/output token split display per active session row#448

Open
jaeko44 wants to merge 5 commits intomainfrom
task/e69d47108981-feat-agents-input-output-token-split-display-per
Open

feat(agents): input/output token split display per active session row#448
jaeko44 wants to merge 5 commits intomainfrom
task/e69d47108981-feat-agents-input-output-token-split-display-per

Conversation

@jaeko44
Copy link
Copy Markdown
Member

@jaeko44 jaeko44 commented Mar 26, 2026

Task-ID: e69d4710-8981-44c2-b6d8-641e638bfe4f\n\nAutomated PR for task e69d4710-8981-44c2-b6d8-641e638bfe4f\n\n---\n\nBosun-Origin: created

@jaeko44 jaeko44 added the bosun-attached Bosun PR attachment marker label Mar 26, 2026
Copilot AI review requested due to automatic review settings March 26, 2026 02:56
@github-actions github-actions bot added the bosun-pr-public PR observed by Bosun but not trusted for high-risk automation label Mar 26, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 26, 2026

Bosun CI signal: Bosun-created PR currently has failing checks.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds input/output token split visibility across the UI by extending session payloads and analytics trend data, then rendering new token split stats and a token-split trend chart in Telemetry plus a per-session-row token pill in Agents.

Changes:

  • Extend session insights normalization to recognize inputTokens/outputTokens/totalTokens shapes and meta wrappers (meta.tokenUsage, etc.).
  • Add split token totals + token-split trend series to usage analytics and expose split token fields in session list payloads (API + TUI bridge).
  • Render token split totals and a “Token Split Trend” chart in Telemetry; render an “In/Out” token split pill per active session row in Agents.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ui/tabs/telemetry.js Adds token split lifetime stats and a token split trend panel.
site/ui/tabs/telemetry.js Mirrors Telemetry token split UI additions for the site build.
ui/tabs/agents.js Adds token split helper/renderer and displays it per active session row.
site/ui/tabs/agents.js Adds the render call for token split in the mirrored Agents tab.
ui/styles/components.css Adds styles for the token split pill.
tests/ui-server.test.mjs Adds coverage ensuring session list payload includes split token fields; extends analytics expectations for split token trends.
lib/session-insights.mjs Expands token usage normalization to accept camelCase token keys and meta wrappers.
site/lib/session-insights.mjs Mirrors session insight normalization changes for the site build.
infra/tui-bridge.mjs Normalizes session token fields in TUI session updates/events and aligns tokenCount with totalTokens.
infra/session-tracker.mjs Includes split token fields in /api/sessions list entries from session insights.
server/ui-server.mjs Adds daily and total input/output token aggregation to usage analytics trend payloads.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +312 to +315
<span class="fleet-slot-token-split" aria-label=${`Input ${usage.inputTokens} Output ${usage.outputTokens}`}>
<span class="fleet-slot-token-segment"><strong>In</strong> ${formatCompactCount(usage.inputTokens)}</span>
<span class="fleet-slot-token-divider">/</span>
<span class="fleet-slot-token-segment"><strong>Out</strong> ${formatCompactCount(usage.outputTokens)}</span>
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

formatCompactCount is used here but isn’t defined or imported in this module, which will throw at runtime when the token split is rendered. Import it (e.g., from ../modules/session-insights.js) or switch to an already-in-scope formatter.

Copilot uses AI. Check for mistakes.
${s.taskId ? ` · ${s.taskId}` : ""}
${s.branch ? ` · ${s.branch}` : ""}
</div>
${renderFleetEntryTokenSplit({ session: s })}
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

This adds a call to renderFleetEntryTokenSplit, but site/ui/tabs/agents.js doesn’t define/import that helper (nor the related token-usage helpers). Since site/ui/* is a mirrored build, this will crash when rendering the Agents tab; port the helper(s) and required imports into the site copy as well.

Copilot uses AI. Check for mistakes.
Comment on lines +6408 to +6421
.fleet-slot-token-split {
display: inline-flex;
align-items: center;
gap: 4px;
max-width: 100%;
padding: 2px 6px;
border: 1px solid var(--border);
border-radius: 999px;
background: var(--surface-1);
color: var(--text-secondary);
font-size: 10px;
line-height: 1.2;
white-space: nowrap;
}
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

These new styles support the token split pill, but the repository keeps ui/ and site/ui/ in sync for the shipped UI. Please mirror the same CSS into site/ui/styles/components.css (currently missing .fleet-slot-token-split etc.) so the site build renders consistently.

Copilot uses AI. Check for mistakes.
@jaeko44 jaeko44 added bosun-needs-fix Attached PR with failing CI that Bosun should pick up for repair bosun-pr-bosun-created PR created by Bosun and eligible for Bosun automation and removed bosun-pr-public PR observed by Bosun but not trusted for high-risk automation labels Mar 26, 2026
@github-actions
Copy link
Copy Markdown

Bosun PR classification: Bosun-created.
This PR is tracked by Bosun attachment automation.

  • PR class label: bosun-pr-bosun-created
  • Attach label: bosun-attached (yes, because Bosun-created PRs remain attached regardless of human PR attach mode)
  • Attach mode policy: all
  • Trusted author: no
  • Bosun-created label present: yes
  • Automation scope: Eligible for Bosun repair and merge automation (Bosun-created PR).
  • CI failure signal label: bosun-needs-fix
  • CI failure marker:
  • Trigger: pull_request_target / synchronize

jaeko44 added 2 commits March 26, 2026 23:44
Co-authored-by: bosun-ve[bot] <262908237+bosun-ve[bot]@users.noreply.github.com>
Co-authored-by: bosun-ve[bot] <262908237+bosun-ve[bot]@users.noreply.github.com>
@jaeko44 jaeko44 enabled auto-merge March 26, 2026 15:45
@jaeko44 jaeko44 added bosun-needs-fix Attached PR with failing CI that Bosun should pick up for repair and removed bosun-needs-fix Attached PR with failing CI that Bosun should pick up for repair labels Mar 26, 2026
@jaeko44 jaeko44 added bosun-needs-fix Attached PR with failing CI that Bosun should pick up for repair and removed bosun-needs-fix Attached PR with failing CI that Bosun should pick up for repair labels Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bosun-attached Bosun PR attachment marker bosun-needs-fix Attached PR with failing CI that Bosun should pick up for repair bosun-pr-bosun-created PR created by Bosun and eligible for Bosun automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants