Skip to content

fix: persist rebuild status to survive iframe reloads during remote rebuild - #213

Merged
jeonghun-jj-lee merged 2 commits into
local/amicodefrom
fix/rebuild-remote-status-persistence
Aug 19, 2026
Merged

fix: persist rebuild status to survive iframe reloads during remote rebuild#213
jeonghun-jj-lee merged 2 commits into
local/amicodefrom
fix/rebuild-remote-status-persistence

Conversation

@jeonghun-jj-lee

@jeonghun-jj-lee jeonghun-jj-lee commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Problem

The "Rebuild Remotely" (now "Rebuild from Latest") button's status indicator vanishes prematurely before the window reloads. The local rebuild path doesn't suffer from this.

Root Cause

During remote rebuild, git checkout local/amicode in the opencode workspace folder triggers VS Code's file watcher on hundreds of changed files. This causes the opencode server to restart, which reloads the iframe serving the settings page — wiping the volatile rebuildState signal back to idle.

Fix

Persist the "rebuilding" state in localStorage so it survives iframe reloads:

  • Write amicode:devtools-rebuilding flag on rebuild start
  • On component mount, check the flag — if present without a "rebuilt" flag, restore the Rebuilding... indicator
  • Clear the flag on done/failed messages from the extension
  • Add a 5-minute safety timeout to prevent permanently stuck state if the extension crashes mid-rebuild

Also renames the button from "Rebuild Remotely" to "Rebuild from Latest" for clarity.

Changes

  • packages/app/src/components/settings-v2/developer-tools-controller.ts — localStorage persistence logic
  • packages/app/src/i18n/*.ts — button label rename (all 18 locales)

Summary by CodeRabbit

  • Bug Fixes

    • Rebuild progress now persists through iframe reloads.
    • Rebuilds interrupted for more than five minutes are marked as failed.
    • Completion and failure states are cleared correctly after rebuilds finish.
  • UI & Localization

    • Updated the developer-tools action label from “Rebuild Remotely” to “Rebuild from Latest” across supported languages.

During remote rebuild, git checkout in a watched workspace folder triggers
VS Code's file watcher, which can cause the opencode server to restart and
the iframe to reload. This wiped the volatile 'rebuilding' signal, making
the status indicator vanish prematurely.

Fix: write an 'amicode:devtools-rebuilding' flag to localStorage on rebuild
start, and restore the Rebuilding... state from it on mount. Clear the flag
on done/failed messages. Add a 5-minute safety timeout to prevent stuck state
if the extension crashes mid-rebuild.
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b7dd4da5-d8ae-48b4-aa67-b0661078bafe

📥 Commits

Reviewing files that changed from the base of the PR and between 0e1b388 and c903336.

📒 Files selected for processing (19)
  • packages/app/src/components/settings-v2/developer-tools-controller.ts
  • packages/app/src/i18n/ar.ts
  • packages/app/src/i18n/br.ts
  • packages/app/src/i18n/bs.ts
  • packages/app/src/i18n/da.ts
  • packages/app/src/i18n/de.ts
  • packages/app/src/i18n/en.ts
  • packages/app/src/i18n/es.ts
  • packages/app/src/i18n/fr.ts
  • packages/app/src/i18n/ja.ts
  • packages/app/src/i18n/ko.ts
  • packages/app/src/i18n/no.ts
  • packages/app/src/i18n/pl.ts
  • packages/app/src/i18n/ru.ts
  • packages/app/src/i18n/th.ts
  • packages/app/src/i18n/tr.ts
  • packages/app/src/i18n/uk.ts
  • packages/app/src/i18n/zh.ts
  • packages/app/src/i18n/zht.ts

📝 Walkthrough

Walkthrough

The developer-tools controller now persists rebuild progress across iframe reloads, restores interrupted state, handles completion and failure flags, and applies a five-minute timeout. All supported locale labels now say “Rebuild from Latest”.

Changes

Developer-tools rebuild flow

Layer / File(s) Summary
Persist rebuild state and update action labels
packages/app/src/components/settings-v2/developer-tools-controller.ts, packages/app/src/i18n/*
The controller stores rebuild progress in local storage, restores state after reloads, clears flags after completion or failure, and marks interrupted rebuilds as failed after five minutes. Supported translations now use “Rebuild from Latest”.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant DeveloperToolsController
  participant localStorage
  participant iframe
  User->>DeveloperToolsController: Start rebuild
  DeveloperToolsController->>localStorage: Set rebuilding flag
  DeveloperToolsController->>iframe: Post rebuild request
  iframe-->>DeveloperToolsController: Completion or failure message
  DeveloperToolsController->>localStorage: Clear rebuilding flag
  iframe->>iframe: Reload
  DeveloperToolsController->>localStorage: Restore rebuild state on mount
Loading

Possibly related PRs

  • harmoniqs/opencode#199: This PR extends the developer-tools controller and rebuild persistence introduced there.

Suggested reviewers: brendonovich, aarontrowbridge

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/rebuild-remote-status-persistence

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

@jeonghun-jj-lee
jeonghun-jj-lee marked this pull request as ready for review August 19, 2026 10:17
@jeonghun-jj-lee
jeonghun-jj-lee merged commit 72dfaf6 into local/amicode Aug 19, 2026
1 of 5 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