Skip to content

[Impl] Make diff view explain slower or costlier runs#155

Merged
luoyuctl merged 1 commit into
masterfrom
parser/147-diff-explains-change
May 4, 2026
Merged

[Impl] Make diff view explain slower or costlier runs#155
luoyuctl merged 1 commit into
masterfrom
parser/147-diff-explains-change

Conversation

@luoyuctl

@luoyuctl luoyuctl commented May 4, 2026

Copy link
Copy Markdown
Owner

Closes #147

Summary

  • Adds a primary diff verdict that explains the likely driver: duration, cost, failures, tokens/context, tool count, model change, or health drop.
  • Adds direction-aware delta chips for cost, tokens, duration, turns, tools, failures, and health.
  • Keeps the side-by-side diff panels below the explanation so raw metrics remain available.

User value

Users no longer have to infer why one run is slower, costlier, or lower quality from raw fields; the diff view now states the likely reason first and backs it with deltas.

Scope

  • TUI diff view narrative and delta presentation.
  • Adds token count as a diff field for context-pressure comparison.
  • English/Chinese labels for verdicts and token deltas.

Changed files

  • internal/engine/engine.go
  • internal/tui/insights.go
  • internal/tui/tui.go
  • internal/tui/tui_test.go
  • internal/i18n/i18n.go

Test plan

  • go test ./internal/tui ./internal/engine
  • go test ./...
  • go build -o /tmp/agenttrace-parser-check ./cmd/agenttrace
  • /tmp/agenttrace-parser-check --doctor || true
  • /tmp/agenttrace-parser-check --demo --overview -f json
  • go test ./internal/tui -run 'TestDiffRendersWinnerInsight|TestWideDiffUsesFullComparisonLayout' -count=1 -v

Fixture/privacy note

No real user session data, prompts, logs, tokens, or secrets were added. Tests use existing synthetic in-memory TUI fixtures. Local doctor validation saw 4264 session files, but no local session content was committed.

Risk

Medium-low. This adds a token diff field and changes TUI diff ordering/copy. Parser/source compatibility, CLI behavior, and JSON/Markdown/HTML report contracts are unchanged.

Non-goals

  • No parser/source changes.
  • No report contract changes.
  • No README/docs asset changes.
  • No release, package, install, or launch-kit changes.

Blackboard events

Release impact

patch; affects TUI visible behavior only. Parser/source compatibility: no. CLI behavior: no. JSON/Markdown/HTML report contract: no. Install/package docs: no.

Handoff suggestion: Growth

Suggested release note: Diff view now explains why one run is slower, costlier, or lower quality, with direction-aware deltas for the key fields.

@luoyuctl luoyuctl added lane/product Product experience and user journey work status/ready-for-review Ready for review labels May 4, 2026
@luoyuctl

luoyuctl commented May 4, 2026

Copy link
Copy Markdown
Owner Author

Quality Gatekeeper Review

Verdict: PASS
Risk: Medium
Lane: product

Checks:

  • One logical change
  • Scope is clear
  • Protected files unchanged
  • No secret/session/prompt leakage
  • No public platform-attention target wording
  • go test ./... passed
  • go build passed
  • doctor/demo overview passed
  • TUI focused regression tests passed
  • Output CI scripts passed

GitHub state:

Changed-files risk:

  • Medium. TUI diff presentation, insight copy, and a token diff field changed across internal/tui/*, internal/i18n/i18n.go, and internal/engine/engine.go.
  • No parser/source compatibility, CLI behavior, README/docs assets, release, package, or report contract files changed.

Commands run:

  • git fetch origin pull/155/head:pr-155
  • git worktree add ../agenttrace-review-pr-155 pr-155
  • git diff --stat origin/master...HEAD && git diff --check origin/master...HEAD
  • git diff origin/master...HEAD -- internal/engine/engine.go internal/tui/insights.go internal/tui/tui.go internal/tui/tui_test.go internal/i18n/i18n.go
  • go test ./internal/tui ./internal/engine
  • go test ./internal/tui -run 'TestDiffRendersWinnerInsight|TestWideDiffUsesFullComparisonLayout' -count=1 -v
  • go test ./...
  • go build -o /tmp/agenttrace-review-pr-155 ./cmd/agenttrace
  • /tmp/agenttrace-review-pr-155 --doctor || true
  • /tmp/agenttrace-review-pr-155 --demo --overview -f json >/tmp/agenttrace-review-pr-155-demo.json
  • AGENTTRACE_BIN=/tmp/agenttrace-review-pr-155 AGENTTRACE_CI_OUT=/tmp/agenttrace-review-pr-155-ci scripts/ci/check-output-contract.sh
  • AGENTTRACE_BIN=/tmp/agenttrace-review-pr-155 AGENTTRACE_CI_OUT=/tmp/agenttrace-review-pr-155-ci scripts/ci/check-deterministic-output.sh
  • AGENTTRACE_BIN=/tmp/agenttrace-review-pr-155 AGENTTRACE_CI_OUT=/tmp/agenttrace-review-pr-155-ci scripts/ci/check-report-semantics.sh

Decision: PASS. Auto-merge eligible.

Label action after merge: status/auto-merged; remove status/ready-for-review.

Handoff to: Growth
Release-note candidate: Diff view now explains why one run is slower, costlier, or lower quality with direction-aware deltas.

@luoyuctl luoyuctl merged commit 428a6c1 into master May 4, 2026
1 check passed
@luoyuctl luoyuctl deleted the parser/147-diff-explains-change branch May 4, 2026 14:29
@luoyuctl luoyuctl added status/auto-merged and removed status/ready-for-review Ready for review labels May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lane/product Product experience and user journey work status/auto-merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TUI] Make diff view explain why one run is slower or costlier

1 participant