Skip to content

feat(trace): always-on client-side tracing with admin trace-review page#14

Merged
albanm merged 12 commits into
mainfrom
feat-trace-share
Jun 5, 2026
Merged

feat(trace): always-on client-side tracing with admin trace-review page#14
albanm merged 12 commits into
mainfrom
feat-trace-share

Conversation

@albanm
Copy link
Copy Markdown
Member

@albanm albanm commented Jun 5, 2026

Rework agent-chat tracing to be always-on, client-only, and ephemeral, and add an admin trace-review workflow.

What changed:

  • Every chat session now records a full in-memory SessionRecorder trace (no opt-in flag, no server persistence).
  • The admin chat dialog is renamed "Debug" → "Info" and gains Download (trace JSON) and Open review actions.
  • New admin page /{type}/{id}/trace-review: a TraceView panel beside an AI evaluator chat, fed by JSON upload or a transient localStorage handoff (consumed once, quota-fallback to download).
  • Trace rendering extracted into a reusable TraceView.vue; trace lines de-duplicated (type chip + distinguishing label + inline truncated content preview; full content on expand).
  • The in-chat "Evaluation" tab is removed in favor of the review page.
  • Merged main: its moderation trace entry is integrated into the new TraceView renderer.

Why: keep the trace footprint bounded and avoid privacy/storage decisions — tracing stays in the browser, shared only via explicit download/upload or a one-shot handoff. Single source of truth for entry labels (also de-duplicates the evaluator's overview).

Regression risks:

  • The recorder now runs for every session, not just admins behind a flag — full trace held in memory regardless of role. Verify memory cost on long sessions (only admins can view it, everyone records it).
  • debug prop renamed to isAdmin across AgentChat and dev pages; an external caller passing :debug would break (all in-repo call sites updated).
  • In-chat evaluator tab removed — admins use the new review page instead.
  • trace-review route guard is client-side only (redirect in onMounted); the page exposes no server data.

Verified: type-check, lint, and the trace + moderation test suites pass (27 specs).

albanm and others added 12 commits June 5, 2026 09:56
…review page

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…te revival

Adds serializeTrace, reviveTraceDates (revives ISO strings to Date recursively),
and SessionRecorder.fromTrace static factory for round-tripping traces as JSON.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…o dialog

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…at evaluator tab

- Extract EVALUATOR_PROMPT to ui/src/traces/evaluator-prompt.ts (shared module for future use)
- SessionRecorder is now always instantiated (no sessionStorage flag required)
- Remove evaluator tab, evaluatorChat instance, and all active* computed proxies
- Rename debug prop to isAdmin across AgentChat, AgentChatHeader, and chat.vue
- AgentChatHeader: replace evaluation tabs + bug icon with plain title + info icon (admin-gated)
- Fix AgentChatDebugDialog binding: add :is-admin, :account-type, :account-id; drop :tracing-enabled

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Carries the Task 4 rename into the _dev harness pages (which pass the prop
to AgentChat) and the e2e specs that click the renamed header button.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…load validation

Final-review cleanups: remove the now-unused `debug` option from useAgentChat
and the dead `agent-chat--debug` class binding; require toolChanges/toolSnapshots
arrays in the trace-review upload validator so a malformed file is rejected
cleanly instead of crashing buildCache.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The collapsed trace line repeated the entry type (chip + title) and the
expanded panel showed the preview twice (flat, then JSON-escaped). Now:

- recorder labels carry only the distinguishing detail (tool name, model
  role, sub-agent name), not a type prefix the chip already shows; plain
  type-only entries get an empty label. Single source of truth, so the
  evaluator overview is de-duplicated too.
- collapsed line shows chip + optional label + the content's first chars
  as a truncated text-label-small muted caption + time.
- expanded panel drops the duplicated preview; string content renders
  as-is (real newlines) via formatContent instead of JSON-escaped.

Tests updated for the new label semantics.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts:
#	ui/src/components/agent-chat/AgentChatDebugDialog.vue
@albanm albanm merged commit d57689b into main Jun 5, 2026
4 checks passed
@albanm albanm deleted the feat-trace-share branch June 5, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant