Skip to content

feat(live): make live sessions recoverable#125

Merged
pbakaus merged 13 commits intopbakaus:mainfrom
nqh-packages:feat/live-session-recovery
May 4, 2026
Merged

feat(live): make live sessions recoverable#125
pbakaus merged 13 commits intopbakaus:mainfrom
nqh-packages:feat/live-session-recovery

Conversation

@nqh-packages
Copy link
Copy Markdown
Contributor

@nqh-packages nqh-packages commented Apr 29, 2026

feat: recover live sessions after missed agent/browser handoffs

Why

live mode could lose the plot if the browser moved ahead while the agent was not polling.
accept, discard, reload, helper restart: all of those had enough state in different places, but no single durable trail to resume from.

this makes the workflow less fragile. browser state is no longer just vibes in localStorage and chat history.

What changed

  • Added a durable .impeccable-live/sessions JSONL journal with rebuildable snapshots.
  • Added browser checkpoint events for visible variant, phase, and parameter values.
  • Changed /poll delivery to lease events until the agent acknowledges them.
  • Replays unacknowledged pending events after helper server restart.
  • Added live-status.mjs, live-resume.mjs, and live-complete.mjs for recovery.
  • Split browser session persistence into live-browser-session.js so it can be tested without booting the full overlay.
  • Hardened accept/discard semantics so accept shows SAVING until the server receives it.
  • Fixed Astro live CSS preview mode with astro-global-prefixed output and E2E coverage.
  • Added packageManager: bun@1.3.11 and a Bun-native audit script.

How to verify

  • node --test tests/live-wrap.test.mjs
  • node --test tests/live-session-store.test.mjs
  • node --test tests/live-browser-session.test.mjs
  • node --test tests/live-recovery-commands.test.mjs
  • node --test tests/live-server.test.mjs
  • bun run build
  • PATH="/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" GIT_CONFIG_GLOBAL=/dev/null bun run test
  • PATH="/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" GIT_CONFIG_GLOBAL=/dev/null IMPECCABLE_E2E_ONLY=astro-vite7 bun run test:live-e2e

Known follow-up

bun run audit now runs against the real Bun lockfile, but it currently fails on transitive advisories from archiver and optional puppeteer. I left that honest instead of adding ignores before deciding whether to replace those dependency paths.


Note

Medium Risk
Refactors live-mode session lifecycle (polling, accept/discard, and state persistence) and adds a new durable journal/recovery commands, which could affect in-progress sessions and cleanup flows if edge cases are missed.

Overview
Live mode sessions are now durably recoverable: the helper persists an append-only journal under .impeccable/live/sessions/, replays unacknowledged work after restart, and poll delivery now uses leased events that require an explicit agent acknowledgement.

The browser overlay now emits periodic checkpoint events (variant/phase/param values), preserves local session state across transient server loss, and hardens accept/discard by showing a SAVING state and only marking sessions handled after the helper confirms receipt.

Adds recovery tooling (live-status.mjs, live-resume.mjs, live-complete.mjs) plus shared path helpers in impeccable-paths.mjs, updates the design sidecar location to .impeccable/design.json (with legacy fallbacks), and enhances live-wrap.mjs to return per-file CSS authoring mode (including an Astro astro-global-prefixed preview mode).

Reviewed by Cursor Bugbot for commit 1064bfd. Bugbot is set up for automated code reviews on this repo. Configure here.

@nqh-packages nqh-packages requested a review from pbakaus as a code owner April 29, 2026 02:10
Comment thread .agents/skills/impeccable/scripts/live-session-store.mjs
Comment thread .agents/skills/impeccable/scripts/live-poll.mjs Outdated
@nqh-packages
Copy link
Copy Markdown
Contributor Author

Pls take a look, I spent 10% of my weekly session on it  🥹

Comment thread .agents/skills/impeccable/scripts/live-server.mjs
Comment thread .agents/skills/impeccable/scripts/live-session-store.mjs Outdated
Comment thread .agents/skills/impeccable/scripts/live-completion.mjs
Comment thread .agents/skills/impeccable/scripts/live-browser.js Outdated
Comment thread .agents/skills/impeccable/scripts/live-completion.mjs
Comment thread .agents/skills/impeccable/scripts/live-poll.mjs Outdated
Comment thread .agents/skills/impeccable/scripts/live-browser.js Outdated
Comment thread .agents/skills/impeccable/scripts/live-session-store.mjs
Comment thread .agents/skills/impeccable/scripts/live-server.mjs
Comment thread .agents/skills/impeccable/scripts/live-browser.js
Comment thread .agents/skills/impeccable/scripts/live-session-store.mjs
Copy link
Copy Markdown
Contributor Author

@nqh-packages nqh-packages left a comment

Choose a reason for hiding this comment

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

Hi, all the bugs are fixed. Please take a look. Thanks!

nqh-packages and others added 7 commits May 3, 2026 11:22
tired of live mode losing the plot when the browser moved faster than the agent.
now the state is boring: journal it, resume it, finish it.

---
- add durable live-session journal, checkpoint events, and status/resume/complete commands
- split browser session storage into a testable helper and harden accept/discard completion
- fix Astro live CSS preview mode and add recovery/live E2E coverage
- declare Bun as the package manager and add a Bun-native audit script
@pbakaus pbakaus force-pushed the feat/live-session-recovery branch from 4a0dc7d to 21617e8 Compare May 3, 2026 18:30
Comment thread .agents/skills/impeccable/scripts/live-server.mjs
@pbakaus
Copy link
Copy Markdown
Owner

pbakaus commented May 3, 2026

I have some plans for a new .impeccable directory, so making some changes directly to this branch to align with it. Stay tuned! this is solid work, I'll get it merged soon, thanks for your contribution 🙏

Comment thread .agents/skills/impeccable/scripts/live-browser.js Outdated
Comment thread .agents/skills/impeccable/scripts/live-session-store.mjs
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 16c207b. Configure here.

Comment thread .agents/skills/impeccable/scripts/live-completion.mjs
@pbakaus pbakaus merged commit d874af0 into pbakaus:main May 4, 2026
2 checks passed
pbakaus pushed a commit that referenced this pull request May 4, 2026
- Detector: italic-serif display heroes and hero eyebrow chips
  (#129, contributed by @vinaypokharkar).
- Live mode: durable session journal, status/resume/complete
  commands (#125, contributed by @nqh-packages).
- Reference files: stripped "Remember:" closer chants, brochure-style
  openers (12 files), and 419 em-dashes. Less context per command load,
  less repetition the model reads past.

Refresh harness output dirs and plugin/ subtree.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants