Skip to content

feat(extension): the live-test reload lane — stamp amicode_build, prompt on new builds (#1556, subsumes #1459) - #1557

Open
aarontrowbridge wants to merge 2 commits into
mainfrom
slice/live-test-reload-lane
Open

aarontrowbridge wants to merge 2 commits into
mainfrom
slice/live-test-reload-lane

Conversation

@aarontrowbridge

Copy link
Copy Markdown
Member

Closes #1556. Closes #1459 (subsumed — read #1556 first: the evidence, the design rationale, and why the whole lane lands extension-side with zero hub changes).

The ceremony this delivers

The agent ships the dist; the developer gets prompted; reload-the-window lands the new build. No cache surgery, no agent nagging, no stale ghosts.

The three parts

Derive (dist_build_id.ts, new — vscode-free, every seam injectable): the served dist's build id is the index-<hash>.js entry reference in the origin document (verified against the real staged dist: vite base64url charset, fresh-token match so my-index-abc.js never matches). The extension HOST's fetches bypass the webview service worker — #1556's whole premise — so the host always sees the true current dist even while the framed app is stuck on the previous ship. Fail-soft throughout: fetch failure / non-200 / unparseable → undefined, never a throw.

Stamp (the #1459 fix, both HTML paths): the panel's iframe src carries amicode_build=<id> alongside the existing param convention (colorScheme, auth_token, amicode_hide_project, …) — a new dist = a new URL = the SW's navigation cache can never serve the old app across ships. The construction fetch is started before the first render; the sync factory signatures pin the first render synchronous, so a cache-miss panel converges via ONE guarded re-render: pre-app-ready only (appReadySeen closes the window — a live session is never re-navigated), only when the id changed, never on a disposed panel. A window-wide per-origin cache means every panel after the first stamps its first render. Re-frames re-derive and re-stamp from the NEW origin.

Prompt: a slow poll (3 min) compares served vs stamped; on drift, one information message — "Amicode: a new app build is live (<id>). Reload Window to pick it up." — with a Reload Window button (workbench.action.reloadWindow). Once-per-version semantics are window-wide (side-by-side tabs prompt exactly once per ship); the prompted set marks before the prompt resolves so overlapping polls never double-fire; a stamped-undefined panel (unknown baseline) prompts on the first served id it sees; undefined served → never prompts.

Evidence

  • 72/72 scoped suite (the two new files' 32 tests + the pre-existing chat_panel trio untouched and green).
  • Wide sweep: 3710 passed / 4 failed — all 4 pre-existing environment failures (chat_bridge ~-expansion home-dir, cli_gate staged bins, skill_drift_lint × 2), reproduced identically on clean base via a control run; none touch the lane's files. Director re-verified the two runnable ones on the branch: same failures, unrelated areas.
  • pnpm typecheck (workspace): all 4 packages clean.
  • Scope: 4 files — src/dist_build_id.ts (new), src/chat_panel.ts (+135), the two new test files. No app-bundle/overlay/manifest surface, no service changes, no engine changes.

Named follow-ups (deliberately out of this slice)

  • A clean GET /amicode/app-version service route (v1 derives from the origin doc — no hub changes needed, so the lane works against today's deployed hub).
  • Pause-when-unfocused polling; app-side in-frame banners.

…pt on new builds (#1556, subsumes #1459)

The webview's service worker caches the panel iframe's navigation, so a
shipped dist reaches the developer only after hand-clearing the outer
webview cache (#1459), and nothing ever prompted that a new build was
live. The extension host's fetches bypass that SW, so it always sees the
true served origin doc: derive the dist's build id from its
index-<hash>.js entry reference and (1) stamp it on the iframe src
(amicode_build=<id>, both HTML paths — a new URL the SW has never cached,
never disturbing auth_token or any existing param), (2) poll it on a slow
3-minute interval while the panel is alive and prompt once per version
with a Reload Window button. Fail-soft throughout: unparseable/failing
origin docs degrade to today's unstamped behavior, never an error.
@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 52c4318e-776b-4802-a8d6-cfe09615cd6f


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@aarontrowbridge
aarontrowbridge marked this pull request as ready for review September 25, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant