Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

My safety guard was checked in 6 places. Nothing ever set it.

Description and use

Safari MCP server issued tab‑ownership tokens that became invalid after a daemon restart due to a stale browser‑session epoch, causing stranded tabs and command failures. The fix is to verify the epoch at token minting and update a generation counter.

Problem

Safari MCP server issued tab‑ownership tokens that became invalid after a daemon restart, causing stranded tabs and failed commands.

Outcome

The issue was caused by a dead guard that failed to detect epoch rotation during a daemon restart, leading to stale tokens and stranded tabs. The fix involves re‑verifying the epoch at mint time and updating a generation counter.

Workflow

  • 1. Daemon restarts and extension re‑handshakes. 2. Background worker resolves a browser‑session epoch and caches it. 3. New tokens are minted using the cached epoch. 4. Epoch rotates in session storage during the restart window. 5. Cached epoch remains stale, so new tokens carry old epoch. 6. Later commands using these tokens are rejected, leaving tabs stranded.
  • 7. Rehydration discards all stored tokens with stale epoch, causing simultaneous failures.
  • 8. Bug analysis reveals dead guard that never increments epoch counter.
  • 9. Proposed fix: re‑verify epoch against storage at mint time and increment counter when mismatched.

Evidence

Tokens are stamped with a browser-session epoch: a random identifier that ties a token to one continuous run of the browser.

Source

The cached copy is treated as the truth.

Source

A variable that is compared must be assigned somewhere other than its declaration.

Source

  • Record date: 2026-09-15T22:30:41.159Z