Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(config-sync): keep manual sync alive across views
vastsa824549669e4f
diff --git a/apps/desktop/electron/main/ipc/config-sync-ipc.ts b/apps/desktop/electron/main/ipc/config-sync-ipc.tsindex 001ee9235..f2948bc41 100644--- a/apps/desktop/electron/main/ipc/config-sync-ipc.ts+++ b/apps/desktop/electron/main/ipc/config-sync-ipc.ts@@ -38,6 +38,8 @@ export function registerConfigSyncIpc({handle(IPC.invoke.configSyncTest, (input: unknown) =>callHost("configSync.test", input),);+ // This request is Host-owned; navigating away from the Settings route must+ // not cancel it. Host state/progress notifications remain the completion path.handle(IPC.invoke.configSyncSyncNow, () => callHost("configSync.syncNow"));handle(IPC.invoke.configSyncPause, (input: unknown) =>callHost("configSync.pause", input),diff --git a/apps/desktop/src/components/settings/ConfigSyncPage.tsx b/apps/desktop/src/components/settings/ConfigSyncPage.tsxindex acff548ac..718dde656 100644--- a/apps/desktop/src/components/settings/ConfigSyncPage.tsx+++ b/apps/desktop/src/components/settings/ConfigSyncPage.tsx@@ -113,17 +113,9 @@ export function ConfigSyncPage() {const hydrateSavedFields = useCallback((next: ConfigSyncState) => {if (formDirtyRef.current || !next.configured) return;const draft = draftFromState(next);- setForm((current) => ({- ...current,- ...initialConfigSyncForm(draft),- // Background status refreshes must not erase a password being entered.- secretAccessKey: current.secretAccessKey,- sessionToken: current.sessionToken,- clearSessionToken: current.clearSessionToken,- backupPassword: current.backupPassword,- currentBackupPassword: current.currentBackupPassword,- newBackupPassword: current.newBackupPassword,- }));+ // A clean form contains no transient credentials. Do not restore them from+ // a stale closure when Host broadcasts a background sync status update.+ setForm((current) => ({ ...current, ...initialConfigSyncForm(draft) }));setSelection(selectionFromDraft(draft.categories));writeConfigSyncDraft({ ...draft, saved: true });}, []);@@ -411,16 +403,18 @@ export function ConfigSyncPage() {const configured = state?.configured === true;const locked = state?.locked === true;const stateReady = state !== null;+ const syncing = state?.status === "syncing";+ const controlsBusy = busy !== null || syncing;+ const categories = selection;const connectionReady = Boolean(form.endpoint.trim() && form.region.trim() && form.bucket.trim() && form.accessKeyId.trim());const vaultPasswordReady =form.backupPassword.length === 0? configured && !locked: form.backupPassword.length >= 8;- // The report only exists for a sync this page started: an automatic run stays- // quiet, and no report outlives the request that produced it. Enabling a- // vault runs the same full sync as "sync now", so both operations are watched.+ // Host progress continues independently of this view; a page reopened while+ // syncing listens for the remaining reports and keeps duplicate actions off.const syncProgress =- (busy === "sync" || busy === "configure") && progress+ (syncing || busy === "sync" || busy === "configure") && progress? configSyncProgressView(progress): null;@@ -450,7 +444,7 @@ export function ConfigSyncPage() {<Badge tone={statusTone(state.status)}>{statusLabel}</Badge>{!locked ? (<Button variant="primary" onClick={() => void run("sync")}- disabled={busy !== null || state.paused}>+ disabled={controlsBusy || state.paused}><IconCloudDown size={14} />{t(state.mode === "backup" ? "settings.configSync.backupNow" : "settings.configSync.syncNow")}</Button>@@ -465,9 +459,9 @@ export function ConfigSyncPage() {onChange={(event) => updateForm("backupPassword", event.target.value)}aria-label={t("settings.configSync.backupPassword")} autoComplete="current-password"showLabel={t("settings.configSync.showPassword")} hideLabel={t("settings.configSync.hidePassword")}- disabled={busy !== null} />+ disabled={controlsBusy} /><Button variant="primary" onClick={() => void run("unlock")}- disabled={busy !== null || !form.backupPassword}>+ disabled={controlsBusy || !form.backupPassword}><IconShield size={14} />{t("settings.configSync.unlock")}</Button>@@ -477,7 +471,7 @@ export function ConfigSyncPage() {<SettingsRow title={t("settings.configSync.pauseTitle")}description={t("settings.configSync.pauseDescription")}><SettingsToggle checked={state.paused} label={t("settings.configSync.pauseTitle")}- disabled={busy !== null} onChange={() => void togglePause()} />+ disabled={controlsBusy} onChange={() => void togglePause()} /></SettingsRow>)}</SettingsCard>@@ -534,16 +528,16 @@ export function ConfigSyncPage() {<SettingsDisclosure title={t("settings.configSync.connectionTitle")}open={!configured || initialDraft.saved === false}><ConfigSyncConnectionFields form={form} configured={configured} locked={locked}- disabled={busy !== null} onChange={updateForm} />- <ConfigSyncScopeFields selection={selection} disabled={busy !== null} onChange={updateSelection} />+ disabled={controlsBusy} onChange={updateForm} />+ <ConfigSyncScopeFields selection={selection} disabled={controlsBusy} onChange={updateSelection} /><div className="settings-config-sync-actions settings-config-sync-form-actions"><Button variant="secondary" onClick={() => void run("test")}- disabled={busy !== null || loading || !stateReady || !connectionReady}>+ disabled={controlsBusy || loading || !stateReady || !connectionReady}><IconRefresh size={14} />{t("settings.configSync.test")}</Button><Button variant="primary" onClick={() => void run("configure")}- disabled={busy !== null || loading || !stateReady || !connectionReady || !vaultPasswordReady}>+ disabled={controlsBusy || loading || !stateReady || !connectionReady || !vaultPasswordReady}><IconCloudDown size={14} />{configured ? t("settings.configSync.save") : t("settings.configSync.enable")}</Button>@@ -576,7 +570,7 @@ export function ConfigSyncPage() {size="sm"variant="secondary"onClick={() => void mapProject(approval.mappingKey!)}- disabled={busy !== null}+ disabled={controlsBusy}>{t("settings.configSync.mapFolder")}</Button>@@ -585,7 +579,7 @@ export function ConfigSyncPage() {size="sm"variant="secondary"onClick={() => void approve(approval.id, approval.digest, false)}- disabled={busy !== null}+ disabled={controlsBusy}>{t("settings.configSync.reject")}</Button>@@ -593,7 +587,7 @@ export function ConfigSyncPage() {size="sm"variant="primary"onClick={() => void approve(approval.id, approval.digest, true)}- disabled={busy !== null}+ disabled={controlsBusy}>{t("settings.configSync.approve")}</Button>@@ -672,7 +666,7 @@ export function ConfigSyncPage() {<Buttonvariant="secondary"onClick={() => void loadHistory()}- disabled={busy !== null || locked}+ disabled={controlsBusy || locked}><IconRefresh size={14} />{t("settings.configSync.refreshHistory")}@@ -697,7 +691,7 @@ export function ConfigSyncPage() {size="sm"variant="secondary"onClick={() => void restore(entry)}- disabled={busy !== null || (entry.current && state.mode === "sync") || locked}+ disabled={controlsBusy || (entry.current && state.mode === "sync") || locked}>{t("settings.configSync.restore")}</Button>@@ -714,7 +708,7 @@ export function ConfigSyncPage() {</SettingsDisclosure></SettingsCard>- <ConfigSyncVaultSettings form={form} locked={locked} disabled={busy !== null}+ <ConfigSyncVaultSettings form={form} locked={locked} disabled={controlsBusy}onChange={updateForm} onChangePassword={() => void changePassword()}onDisconnect={() => void run("disconnect")} /></>diff --git a/apps/desktop/test/config-sync-ipc.test.mjs b/apps/desktop/test/config-sync-ipc.test.mjsindex bb55960c8..b27301595 100644--- a/apps/desktop/test/config-sync-ipc.test.mjs+++ b/apps/desktop/test/config-sync-ipc.test.mjs@@ -28,3 +28,29 @@ test("history and probe results never masquerade as configuration state events",assert.deepEqual(events, [[IPC.event.configSyncChanged, state]]);assert.deepEqual(calls.at(-1), ["configSync.configure", { mode: "backup" }]);});++test("sync IPC stays pending and completes after its renderer navigates away", async () => {+ const handlers = new Map();+ const events = [];+ const state = { configured: true, status: "upToDate" };+ let finishHostCall;+ const hostCall = new Promise((resolve) => { finishHostCall = resolve; });+ let hostCallSettled = false;+ const hostResult = hostCall.then((value) => { hostCallSettled = true; return value; });+ registerConfigSyncIpc({+ registrar: { handle: (channel, handler) => handlers.set(channel, handler) },+ getHost: () => ({ call: (method) => {+ assert.equal(method, "configSync.syncNow");+ return hostResult;+ } }),+ sendToRenderer: (channel, value) => events.push([channel, value]),+ });+ const request = handlers.get(IPC.invoke.configSyncSyncNow)();+ await Promise.resolve();+ // Route disposal has no cancellation handle for the Main-owned Host call.+ assert.equal(hostCallSettled, false);+ finishHostCall(state);+ assert.deepEqual(await request, state);+ assert.equal(hostCallSettled, true);+ assert.deepEqual(events, [[IPC.event.configSyncChanged, state]]);+});diff --git a/apps/desktop/test/config-sync-settings.test.mjs b/apps/desktop/test/config-sync-settings.test.mjsindex 32f5c1bb3..545964199 100644--- a/apps/desktop/test/config-sync-settings.test.mjs+++ b/apps/desktop/test/config-sync-settings.test.mjs@@ -3,7 +3,6 @@ import { readFile } from "node:fs/promises";import test from "node:test";import { loadStyles } from "./helpers/styles.mjs";import {- CONFIG_SYNC_RPC_TIMEOUT_MS,DEFAULT_RPC_TIMEOUT_MS,rpcTimeoutMs,} from "@pi-desktop/shared";@@ -106,7 +105,7 @@ test("the sync page follows progress while it runs a sync of its own", () => {// Enabling a vault runs the same full sync as "sync now", so both gate it.assert.match(syncPage,- /\(busy === "sync" \|\| busy === "configure"\) && progress/,+ /\(syncing \|\| busy === "sync" \|\| busy === "configure"\) && progress/,);// The request's own answer ends the run, so the last report is cleared when// it settles instead of outliving the sync it described.@@ -176,15 +175,9 @@ test("the sync card exposes the fraction to assistive technology", () => {assert.match(styles, /\.settings-config-sync-progress-figures \{/);});-test("a manual sync outlasts the flat default transport deadline", () => {- // The host cannot cancel a run that is already under way, so a deadline that- // fires while it is still working would only report a failure that is not- // one; the report events carry liveness instead.- assert.match(rpcTimeouts, /CONFIG_SYNC_RPC_TIMEOUT_MS = 1_800_000/);- assert.match(rpcTimeouts, /method === "configSync\.syncNow"/);- assert.equal(rpcTimeoutMs("configSync.syncNow", {}), CONFIG_SYNC_RPC_TIMEOUT_MS);- assert.ok(CONFIG_SYNC_RPC_TIMEOUT_MS > DEFAULT_RPC_TIMEOUT_MS);- // Every other config-sync call keeps the shared default.+test("a manual sync has no total-request RPC timeout", () => {+ assert.ok(rpcTimeouts.includes('if (method === "configSync.syncNow") return undefined;'));+ assert.equal(rpcTimeoutMs("configSync.syncNow", {}), undefined);assert.equal(rpcTimeoutMs("configSync.getState", {}), DEFAULT_RPC_TIMEOUT_MS);});diff --git a/apps/desktop/test/config-sync-user-path.test.mjs b/apps/desktop/test/config-sync-user-path.test.mjsindex f880b9c3f..66f5f9103 100644--- a/apps/desktop/test/config-sync-user-path.test.mjs+++ b/apps/desktop/test/config-sync-user-path.test.mjs@@ -38,6 +38,9 @@ let releaseSync;let holdSync = true;let holdHistory = false;let releaseHistory;+const emitState = () => {+ for (const callback of listeners.get(IPC.event.configSyncChanged) ?? []) callback(state);+};const history = () => [{ revisionId: "current-" + state.prefix, createdAt: "2026-01-02T00:00:00Z", entityCount: 1, current: true },{ revisionId: "older-" + state.prefix, createdAt: "2026-01-01T00:00:00Z", entityCount: 1, current: false },@@ -59,7 +62,11 @@ window.piDesktop = { platform: "darwin", channels: IPC,state = { ...state, ...publicFields, configured: true, enabled: true, status: "upToDate" };data = state;} else if (channel === IPC.invoke.configSyncSyncNow) {+ state = { ...state, status: "syncing" };+ emitState();if (holdSync) await new Promise((resolve) => { releaseSync = resolve; });+ state = { ...state, status: "upToDate" };+ emitState();data = state;} else if (channel === IPC.invoke.configSyncListHistory) {const captured = history();@@ -174,9 +181,20 @@ window.configSyncProbe = async () => {check(probe.secretAccessKey === "test-secret" && probe.sessionToken === "test-token" && !('backupPassword' in probe), "probe credential contract");await click("enable");await until(() => releaseSync, "first run did not start");- check(input("secretAccessKey").value === "" && input("sessionToken").value === "" && input("backupPassword").value === "", "saved secrets outlived configure");+ const transientInputs = {+ accessKey: input("secretAccessKey").value.length > 0,+ sessionToken: input("sessionToken").value.length > 0,+ vaultPassword: input("backupPassword").value.length > 0,+ };+ check(Object.values(transientInputs).every((present) => !present), "transient inputs remained after configure: " + JSON.stringify(transientInputs));check(last("configSyncConfigure").backupPassword === "test-password", "vault password missing");- holdSync = false; releaseSync(); await ready();+ flushSync(() => view.unmount());+ mount();+ await until(() => button("backupNow")?.disabled, "re-entered settings did not restore active sync state");+ holdSync = false;+ releaseSync();+ await until(() => button("backupNow") && !button("backupNow").disabled, "background sync did not complete after navigation");+ await ready();await until(() => document.body.textContent.includes("older-pi-desktop/config"), "history missing");flushSync(() => view.unmount()); mount(); await ready();check(input("bucket").value === "private-config", "saved connection not hydrated");diff --git a/crates/host-core/src/rpc/mod.rs b/crates/host-core/src/rpc/mod.rsindex ba80fb93c..91d558c52 100644--- a/crates/host-core/src/rpc/mod.rs+++ b/crates/host-core/src/rpc/mod.rs@@ -484,12 +484,10 @@ pub async fn serve(state: Arc<Mutex<AppState>>) -> Result<()> {.unwrap_or(Ok(()))}-/// Wall-clock budget for a single non-tool RPC request. The JS client gives-/// its calls ~130s before it rejects locally without ever telling the host-/// (issue #1071), so a request stuck waiting on the global state lock keeps-/// its in-flight slot after the caller has moved on. 135s sits just past that-/// client budget: the slot is guaranteed to come back within seconds of the-/// client giving up, instead of never.+/// Wall-clock budget for ordinary non-tool RPC requests. The long-running+/// `configSync.syncNow` is explicitly exempt below; other handlers stuck on the+/// global state lock must release their in-flight slot rather than accumulate.+/// Keep this slightly beyond the shared 130s client deadline (issue #1071).const RPC_REQUEST_BUDGET_MS: u64 = 135_000;/// Grace window added on top of a tool's own effective timeout. A@@ -506,11 +504,16 @@ const RPC_TOOL_BUDGET_GRACE_MS: u64 = 90_000;/// so the cap matches that order.const RPC_PERMISSION_WAIT_CAP_MS: u64 = 120_000;-/// Budget for one request. `tools.execute` follows its own effective tool-/// timeout (plus permission cap and grace); a tool without an effective-/// timeout keeps the old unbounded behavior. Every other method gets the-/// fixed budget.+/// Budget for one request. `configSync.syncNow` has no aggregate wall-clock+/// deadline because the Host owns a multi-step cloud operation. `tools.execute`+/// follows its own effective tool timeout (plus permission cap and grace); all+/// other methods use the fixed budget.fn request_budget_ms(method: &str, params: &Value) -> Option<u64> {+ if method == "configSync.syncNow" {+ // One sync may contain arbitrarily many individually bounded S3+ // requests. Keep the Host-owned workflow alive across renderer routes.+ return None;+ }if method != "tools.execute" {return Some(RPC_REQUEST_BUDGET_MS);}@@ -5095,6 +5098,10 @@ mod tests {);}+ #[test]+ fn config_sync_request_has_no_wall_clock_budget() {+ assert_eq!(request_budget_ms("configSync.syncNow", &json!({})), None);+ }#[test]fn request_budget_for_tools_execute_follows_tool_timeout() {// The real wire shape: ToolsExecuteParams is serde-renamed todiff --git a/docs/spec/03-runtime/06-host-rpc-protocol.md b/docs/spec/03-runtime/06-host-rpc-protocol.mdindex 75a06c902..55bbb155e 100644--- a/docs/spec/03-runtime/06-host-rpc-protocol.md+++ b/docs/spec/03-runtime/06-host-rpc-protocol.md@@ -1325,6 +1325,11 @@ remote state before conditional publication and local application. Backuppublishes only a local snapshot to its separate head. Publication preconditionfailures restart from the latest head, never an unconditional overwrite.+`configSync.syncNow` has no aggregate request deadline: the Host owns the+multi-step operation, and renderer route navigation does not cancel it. A+reopened Settings page reads the Host's current `syncing` state. Individual S3+requests remain bounded; Host shutdown is still the lifecycle boundary.+`configSync.listHistory` returns at most 30 indexed entries for the saved mode.It returns metadata only, and is not broadcast as a `configSync.changed` state.Sync `restore` requires `acknowledgePropagation: true` and publishes a newdiff --git a/docs/spec/03-runtime/22-config-sync.md b/docs/spec/03-runtime/22-config-sync.mdindex e50127783..b7dc595ec 100644--- a/docs/spec/03-runtime/22-config-sync.md+++ b/docs/spec/03-runtime/22-config-sync.md@@ -219,9 +219,15 @@ A manual run reports `capture`, `download`, `merge`, `upload`, and `apply` via`configSync.progress`; there is no cleanup phase. `done`/`total` count objectswhile transferring and entities otherwise. A total of 0 means unknown, and a`bytesTotal` of 0 means the byte size is unknown, which is the normal case for a-download. Reports are throttled, a phase change is never dropped, and the state-event plus the call's return value stay the terminal signal. Background polls-report nothing: only the manual path has a caller watching.+download. Reports are throttled and phase changes are never dropped; the Host+state event and call return are terminal signals. Background polls report+nothing, while a manual Host-owned sync reports progress independent of the view.++`configSync.syncNow` has no aggregate RPC deadline. The Host owns the operation,+so navigating away from Settings does not cancel it. Returning to the page reads+the Host's `syncing` state, disables duplicate actions, and subscribes to the+remaining progress reports. Individual S3 requests retain their own timeouts;+normal Host/process shutdown remains the lifecycle boundary.Credentials and memory are unchecked by default. The setup preview reportssupported, excluded, secret-bearing, mapping-required, and pending-activationdiff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex a38799e83..afab3543d 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -9553,6 +9553,9 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.7. Restart an isolated Host and verify persisted state, then disconnect withoutdeleting unrelated data. Inspect remote object bytes for known fixtureplaintext and verify there is no automatic immutable-object GC.+ 8. Hold an in-flight manual sync, navigate away from Settings and return.+ Verify Host still reports `syncing`, duplicate actions stay disabled, and+ releasing the fixture completes the operation and refreshes Host state.- **Expected:** Only S3 is supported, with mandatory conditional writes andencrypted vault contents. Identical/disjoint edits converge; conflicts andtombstones preserve changes; excluded categories do not imply deletion.diff --git a/docs/zh-CN/spec/03-runtime/22-config-sync.md b/docs/zh-CN/spec/03-runtime/22-config-sync.mdindex 2b0399671..c8c22b3ea 100644--- a/docs/zh-CN/spec/03-runtime/22-config-sync.md+++ b/docs/zh-CN/spec/03-runtime/22-config-sync.md@@ -102,6 +102,12 @@ unit/byte totals of zero meaning unknown. No cleanup phase remains. Credentialsand memory remain opt-in; keys and exported secrets are never returned to therenderer. Newly entered connection secrets/passwords are transient IPC inputs.+`configSync.syncNow` has no aggregate RPC deadline. The Host owns the operation,+so navigating away from Settings does not cancel it. Returning to the page reads+the Host's `syncing` state, disables duplicate actions, and subscribes to the+remaining progress reports. Individual S3 requests retain their own timeouts;+normal Host/process shutdown remains the lifecycle boundary.+Host 负责自动同步启用后的启动即时检查、30 秒本地变更防抖以及有界的五分钟远端轮询。失败网络请求使用带 jitter 且有上限的指数重试;paused、locked、不兼容、认证和错误密码状态不会启动重试循环。应用退出时 worker 会随 Host 取消;退出后没有额外 daemon。## 6. 持久性与兼容性diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.mdindex cbe817326..4a4fc8f42 100644--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md@@ -8960,6 +8960,10 @@ Follow the [current S3 acceptance scenario](/spec/06-delivery/04-e2e-test-plan#e- Automation: `pnpm test:e2e:config-sync`, Rust `config_sync::` and`user_skills::`, `config-sync-user-path.test.mjs`, `config-sync-ipc.test.mjs`.Full checkpoint-recovery fault injection is not claimed by these user paths.+- Start a held manual sync, leave Settings, then return. Verify Host still+ reports `syncing`, duplicate actions remain disabled, and releasing the local+ fixture finishes the operation and refreshes state. The aggregate RPC has no+ deadline; individual S3 requests remain bounded.- Acceptance: F (persistence), Security, Quality. Candidate validation required.### E2E-DIALOG-long-text-boundariesdiff --git a/packages/shared/src/protocol.test.ts b/packages/shared/src/protocol.test.tsindex 1b7bb2755..ae7a30f58 100644--- a/packages/shared/src/protocol.test.ts+++ b/packages/shared/src/protocol.test.ts@@ -15,7 +15,6 @@ import {isGlobalPermissionMode,isToolsOutputParams,AGENT_COMPACT_RPC_TIMEOUT_MS,- CONFIG_SYNC_RPC_TIMEOUT_MS,COMMAND_RPC_BUFFER_MS,COMPACTION_SUMMARY_MAX_RETRIES,COMPACTION_SUMMARY_RETRY_BUDGET_MS,@@ -270,19 +269,14 @@ describe("Plan protocol contracts", () => {expect(rpcTimeoutMs("agent.getStatus", { sessionId: "s" })).toBe(130_000);});- it("lets a whole cloud sync finish instead of failing on a lost reply", () => {- // The sync is one request that answers only when every phase is done, and- // the host keeps running after a transport deadline fires. The progress- // reports are the liveness signal, so the deadline is only a ceiling that- // stops a genuinely lost answer from hanging the caller forever.+ it("leaves a whole cloud sync unbounded and observable after navigation", () => {+ // The Host owns sync execution; progress is supplementary, and navigating+ // away from Settings must not impose a transport deadline on that request.expect(IPC.event.configSyncProgress).toBe("pi-desktop/configSync/event/progress",);expect(IPC_WHITELIST.has(IPC.event.configSyncProgress)).toBe(true);- expect(CONFIG_SYNC_RPC_TIMEOUT_MS).toBe(1_800_000);- expect(rpcTimeoutMs("configSync.syncNow", {})).toBe(- CONFIG_SYNC_RPC_TIMEOUT_MS,- );+ expect(rpcTimeoutMs("configSync.syncNow", {})).toBeUndefined();expect(rpcTimeoutMs("configSync.getState", {})).toBe(130_000);});});diff --git a/packages/shared/src/rpc-timeouts.ts b/packages/shared/src/rpc-timeouts.tsindex e34c25d28..65a7c8523 100644--- a/packages/shared/src/rpc-timeouts.ts+++ b/packages/shared/src/rpc-timeouts.ts@@ -56,16 +56,12 @@ export const AGENT_COMPACT_RPC_TIMEOUT_MS =COMMAND_RPC_BUFFER_MS;/**- * `configSync.syncNow` runs a whole sync in one request: a sequence of network- * round trips whose steps the host reports through `configSync.progress`. The- * host cannot cancel a run that is already under way and keeps going after a- * transport deadline expires, so the progress events are the liveness signal- * and the deadline only exists to stop a promise hanging forever when the- * response is genuinely lost. No part of the run has a wall clock the- * transport could read, so this is a ceiling for the whole run, not a measured- * budget.+ * `configSync.syncNow` is a Host-owned multi-step operation. It has no+ * whole-request deadline: individual S3 requests retain their own bounds, and+ * navigating away from Settings only detaches the renderer from the request.+ * Host/process shutdown remains the lifecycle boundary.*/-export const CONFIG_SYNC_RPC_TIMEOUT_MS = 1_800_000;+/*** Whether an error came from a transport deadline rather than from the peer.@@ -78,18 +74,18 @@ export function isRpcTimeoutError(error: unknown): boolean {}/**- * Return the transport deadline for an RPC call. `tools.execute` can wait for- * an explicit user decision for an unbounded period, so its transport call has- * no deadline. Host-core still enforces each tool's execution budget after the- * permission gate, and cancellation or process shutdown still settles the- * request. Other long-running methods retain their explicit finite ceilings.+ * Return the transport deadline for an RPC call. `configSync.syncNow` is+ * Host-owned and has no aggregate deadline; individual S3 requests keep their+ * own bounds. Renderer navigation does not cancel the Main/Host request, while+ * process shutdown remains the lifecycle boundary. Other methods keep their+ * explicit ceilings.*/export function rpcTimeoutMs(method: string,_params: unknown,): number | undefined {if (method === "agent.compact") return AGENT_COMPACT_RPC_TIMEOUT_MS;- if (method === "configSync.syncNow") return CONFIG_SYNC_RPC_TIMEOUT_MS;+ if (method === "configSync.syncNow") return undefined;if (method === "tools.execute") return undefined;return DEFAULT_RPC_TIMEOUT_MS;}