Skip to content

The agent that grows with you

fix: a leftover dead marker no longer hides the old-renderer warning

Tekniumb718aa79d527
diff --git a/apps/desktop/electron/bundle-skew.test.ts b/apps/desktop/electron/bundle-skew.test.ts
index 59e85601965..16a06107c62 100644
--- a/apps/desktop/electron/bundle-skew.test.ts
+++ b/apps/desktop/electron/bundle-skew.test.ts
@@ -92,6 +92,18 @@ it('coalesces polls, backs off failures, and skips checks while an update owns t
await other
})
+// Review K132345 P3: main defers the warning on a LIVE marker only (an async
+// owner-liveness judgement), so a dead marker Desktop never deletes cannot
+// suppress it forever.
+it('an asynchronous isUpdating defers only while it answers true', async () => {
+ let updating = true
+ const check = createBundleSkewChecker(STAMP, gitCounting('2\n'), { isUpdating: async () => updating })
+
+ expect(await check(REPO)).toEqual({ desktopCommitsBehind: null, outOfSync: false })
+ updating = false
+ expect(await check(REPO)).toEqual({ desktopCommitsBehind: 2, outOfSync: true })
+})
+
describe('isFallbackCommit', () => {
it('matches the all-zero placeholder at any stamp length', () => {
expect(isFallbackCommit('0'.repeat(40))).toBe(true)
diff --git a/apps/desktop/electron/bundle-skew.ts b/apps/desktop/electron/bundle-skew.ts
index ff48d6f3545..f0dcee05476 100644
--- a/apps/desktop/electron/bundle-skew.ts
+++ b/apps/desktop/electron/bundle-skew.ts
@@ -82,17 +82,21 @@ export const RUNTIME_PATHS = [
const NOT_STALE: BundleSkewResult = { desktopCommitsBehind: null, outOfSync: false }
-/** About/version polls share one check per checkout, including failed checks. */
+/**
+ * About/version polls share one check per checkout, including failed checks.
+ * `isUpdating` may answer asynchronously (the marker's owner liveness is an
+ * async judgement); a sync answer keeps the check synchronous.
+ */
export function createBundleSkewChecker(
stamp: BundleSkewStamp | null,
runGit: RunGit,
- { isUpdating, now = Date.now }: { isUpdating: () => boolean; now?: () => number }
+ { isUpdating, now = Date.now }: { isUpdating: () => boolean | Promise<boolean>; now?: () => number }
): (repoRoot: string) => Promise<BundleSkewResult> {
const pending = new Map<string, Promise<BundleSkewResult>>()
const cached = new Map<string, { result: BundleSkewResult; at: number }>()
- return repoRoot => {
- if (isUpdating()) {
+ const checkUnlessUpdating = (repoRoot: string, updating: boolean): Promise<BundleSkewResult> => {
+ if (updating) {
cached.clear()
return Promise.resolve(NOT_STALE)
@@ -111,8 +115,8 @@ export function createBundleSkewChecker(
}
const check = detectBundleSkew(stamp, runGit, repoRoot)
- .then(result => {
- if (isUpdating()) {
+ .then(async result => {
+ if (await isUpdating()) {
return NOT_STALE
}
@@ -126,6 +130,14 @@ export function createBundleSkewChecker(
return check
}
+
+ return repoRoot => {
+ const updating = isUpdating()
+
+ return typeof updating === 'boolean'
+ ? checkUnlessUpdating(repoRoot, updating)
+ : updating.then(answer => checkUnlessUpdating(repoRoot, answer))
+ }
}
/** Matches write-build-stamp.mjs's all-zero placeholder for non-git builds. */
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index 242b43bab5e..011f30b780b 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -611,7 +611,7 @@ import {
registerUpdateHoldIpc,
waitForPoolUpdateClearance
} from './update-hold-wiring'
-import { describeSkippedPrewrite, markerPath, updateHandoffConflict, writeUpdateMarker } from './update-marker'
+import { describeSkippedPrewrite, readLiveUpdateMarker, updateHandoffConflict, writeUpdateMarker } from './update-marker'
import { heldWaitMessage, holdTicker } from './update-marker-gate'
import { updateConnectionsBeforeLocal } from './update-order'
import {
@@ -18735,9 +18735,9 @@ function resolveHermesVersion(scope: { connectionId?: string; profile?: string }
const checkRendererSkew = createBundleSkewChecker(
INSTALL_STAMP,
(args, options) => execGit(resolveGitBinary(), args, options),
- // Sync and conservative: any marker file defers the skew warning; the async
- // owner-liveness verdict belongs to the boot gate.
- { isUpdating: () => updateInFlight || isQuittingForHandoff || fs.existsSync(markerPath(HERMES_HOME)) }
+ // Only a LIVE marker defers the warning: Desktop never deletes a dead one,
+ // so a leftover file would otherwise suppress it indefinitely.
+ { isUpdating: async () => updateInFlight || isQuittingForHandoff || Boolean(await readLiveUpdateMarker(HERMES_HOME)) }
)
async function detectRendererSkew() {