Skip to content

feat: record a real session and replay it in the playground - #4

Merged
arko33 merged 1 commit into
mainfrom
feat/recorder
Oct 21, 2026
Merged

arko33 merged 1 commit into
mainfrom
feat/recorder

Conversation

@arko33

@arko33 arko33 commented Oct 21, 2026

Copy link
Copy Markdown
Owner

What

The landing page claimed Ghost records every change burst. It didn't — the collector and the metrics runner were implemented but nothing called them, and /playground always replayed the same fixture.

This closes the loop.

npm run dev
npm run record -- --repo . --health http://localhost:3000/api/health --duration 60

session.json → load session in /playground → the timeline, diff, 3D city and autopsy are built from your own repository.

How it stays honest

  • No writes to your repo. Each burst is staged into a throwaway index (GIT_INDEX_FILE in tmp) and written with commit-tree. HEAD, the branch and your real index are never touched.
  • Change detection compares tree hashes, not git status, so uncommitted work that predates the recording is part of the baseline instead of showing up as a fake turn on every tick.
  • Metrics come from /api/health, not from the agent's report. One warmup probe is discarded so a cold start doesn't register as a hang.
  • The upload validates shape and refuses a session with no turns.

Verified

A 14-second recording against the deployed app produced 2 turns with real diffs (src/__probe.ts), 7 metric samples, 2 snapshots, and no false anomaly. Earlier runs that showed 9 empty turns and a bogus hang were the two bugs above; both are fixed.

Test plan

  • npx tsc --noEmit ✅
  • npm run build ✅ (playground 10.4 kB)
  • TestSprite gate runs on this PR as usual

The recorder closes the loop the landing page was already claiming:

- src/collector/record.ts samples /api/health and snapshots every change burst
- shadow-git stages into a throwaway index and writes commit objects with
  commit-tree, so HEAD, the branch and the user's index are never touched
- npm run record writes session.json
- /playground accepts that file and replays it: timeline, diff, 3D city, autopsy

Verified locally: a 14s recording against the deployed app produced 2 turns with
real diffs and a clean metric stream.
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ghostinthecodebase Ready Ready Preview Oct 21, 2026 1:03am UTC

@arko33
arko33 merged commit 6f10ac0 into main Oct 21, 2026
3 checks passed
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