Skip to content

feat(playwright): unwrap report.json suite + reasoning-driven screen capsule#4

Merged
drewstone merged 1 commit into
mainfrom
feat/playwright-suite-and-reasoning
Jun 21, 2026
Merged

feat(playwright): unwrap report.json suite + reasoning-driven screen capsule#4
drewstone merged 1 commit into
mainfrom
feat/playwright-suite-and-reasoning

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

Why

run-capsule --playwright report.json silently produced an empty video for @tangle-network/browser-agent-driver (bad) runs. Two gaps:

  1. Suite wrapper. spansFromPlaywrightResult read .agentResult / .turns, but the driver's canonical on-disk artifact is a TestSuiteResult ({ results: TestResult[] }). Neither key existed at the top level → turns = [] → 0 spans → blank capsule.
  2. Reasoning dropped. The driver records per-turn agent reasoning on attributes.reasoning, but the screen capsule only captioned the action + URL — so a browser run never rendered as the "thinking-driven" screencast it could be.

What

  • Adapter (adapters/playwright.ts): accept the suite shape and map results[0] (first case by default; multi-case selection stays a CLI concern). Bare Turn[], single TestResult, and agentResult inputs are unchanged.
  • Screen capsule (renderers/screen-capsule.ts): thread reasoning from attributes.reasoning (fallbacks: attributes.thought, result.reasoning) through ScreenStep into the caption as a 💭 line (whitespace-collapsed, clamped to 280 chars + 2 CSS lines).

Verification

End-to-end against real bad report.json files (not fixtures):

  • 2-turn run → screen.mp4 (1280×720, 6.3s) + replay.mp4 — real product frames, action captions.
  • 24-turn Variant run → screen capsule with the 💭 reasoning line over each real frame (e.g. "Fixed the script syntax by wrapping it in an IIFE. This will properly set the input value…"), step "7/24".

Gate: pnpm typecheck clean, pnpm test 43/43 pass (2 new: suite-unwrap, reasoning-on-step).

Scope

Additive and backward-compatible — no field removed or renamed; every previously-accepted input shape still maps identically.

… capsule

The agent-browser-driver adapter read .agentResult/.turns, but the driver's
canonical on-disk artifact is a TestSuiteResult ({ results: TestResult[] }) —
so spansFromPlaywrightResult(report.json) returned zero spans and rendered an
empty video. Accept the suite shape and map results[0] (first case; multi-case
selection stays a CLI concern).

The driver records per-turn reasoning on attributes.reasoning, but the screen
capsule dropped it. Thread it through ScreenStep into the caption as a 💭
thinking line, so a browser run renders as a reasoning-driven screencast.
@drewstone drewstone merged commit 2aac48e into main Jun 21, 2026
1 check passed
drewstone added a commit to tangle-network/browser-agent-driver that referenced this pull request Jun 21, 2026
A run's report.json already carries per-turn screenshot + action + reasoning,
so it renders directly into a screen/replay video via run-capsule with no extra
capture step. Documents the one-liner under Session Viewer, the screenshot
(vision-on) requirement, and the dependency on the suite-aware adapter
(tangle-network/run-capsule#4).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant