Skip to content

Zcode store-drift repair can overwrite a route transferred during its health probes #63

Closed

Description

@anuzzolilli-oss

(ai: anthropic/claude-fable-5-2)

Category I (routing ownership), p2. Found while fixing #13; not included in that change (PR #62).

Mechanism (source-level, master 9d4bda8e5)

repairSharedStoreDrift in src/zcode/native.ts reads the shared store's current origin once, then awaits up to two health probes and, on one branch, replacement discovery. After those awaits it calls routeZcodeConfig or unrouteZcode without re-reading who owns the store.

If another process re-routes the store to a live instance during those awaits, the repair can overwrite that route with this process's origin or a replacement, or revert it to direct. This is the same read, await, write shape as #13, on the watchdog's repair path instead of the exit path.

What is and is not known

  • Source-level finding only. No reproduction has been run and no outage is known.
  • The repair only proceeds when the origin it first read was dead, so the window needs a second process to re-route within the probe and discovery time.

Suggested reproduction and fix

Use the probe and findReplacement seams to re-point a scratch store to a third, live origin during the awaits; assert the store is left byte-identical on each of the three write paths (re-point to self, re-point to replacement, revert to direct). Re-check ownership before each write, as #62 does for the exit handoff.

A full fix for both paths needs the ownership check inside the locked write; see the limits section of PR #62. Keep that as its own decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions