Skip to content

quest: plan the origin failover state machine - #3891

Merged
kixelated merged 3 commits into
mainfrom
claude/quest-origin-failover-machine
Sep 22, 2026
Merged

kixelated merged 3 commits into
mainfrom
claude/quest-origin-failover-machine

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Adds Origin failover machine at the top of main's list, planned in an interview after #3882 and #3884.

What it plans

One state machine per front, owning per-track state: events in, actions out, no locks or waiters inside, with the async task reduced to feeding events and executing actions. Every transition gets a runtime-free test and a bounded enumerator checks the invariants that wake predicates used to guard by hand. Subscribers keep today's guarantees.

Decisions settled in the interview:

  • Simplify semantics where it pays, within limits: the corpse-vs-refusal distinction goes, the local multi-source table becomes table selection (one source slot per front), and resume::Producer's action surface may move. Per-track refusal skipping and the first-hop identity pin stay. Transparent failover stays a feature.
  • One [L] quest rather than a questline: the state fold and the machines are designed together.
  • Proof is a transition table plus a hand-rolled bounded exhaustive enumerator; no new dependency.
  • Ranked first in main; the implementation starts right after this lands, once perf(net): wake a front only when a covering route changes #3884 merges.

Public API and wire impact

None; a planning document.

🤖 Generated with Claude Code

(written by Claude Fable 5.1)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: a4738d21-5270-40f2-89da-a3d75316f391

📥 Commits

Reviewing files that changed from the base of the PR and between 8f7de4d and 35362b2.

📒 Files selected for processing (2)
  • quest/main/README.md
  • quest/main/origin-failover-machine.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@kixelated

Copy link
Copy Markdown
Collaborator Author

MERGE

Positive improvement? Yes. The root problem is concrete and historically grounded: wake predicates that disagree with the decision they guard (#3312 resume memo, NoRoute spin, dead-set starvation). Folding source selection and per-track splicing into one front-owned step function (events in, actions out) is the right permanent fix once #3882/#3884 have removed the table-wide predicates. Ranking it first in main matches the interview decision and the remaining serve_track/serve_route mirror risk in a ~220KB origin.rs.

Worth the complexity? Yes for an [L] planning quest. The simplifications pay for themselves: one source slot via existing route_order, corpse-vs-refusal dropped, per-track verdicts collapsed to one enum, proof as a transition table plus a hand-rolled bounded enumerator with no new dependency. Scope stays private to origin.rs except a possible resume::Producer action-surface move; no wire or public API change. One quest rather than a questline is appropriate when the fold and the machines must be designed together.

Different approach? Not clearly better. Keeping the multi-source local table or a questline (design doc → implement) would either preserve the state sprawl this quest kills or split decisions that need to land together. Exhaustive model checking with an external crate would be heavier than the planned enumerator for a two-source/two-track bound.

Ship the plan; watch these on the implementation PR:

  • #3884 is still open — correctly listed as Required; do not start the fold until it merges.
  • Main's Goal section still reads as API-crate + GPU priorities; the Quests list now leads with origin failover. Either leave that as intentional ranking or tighten the Goal blurb so newcomers are not surprised.
  • The event/action alphabets are marked "roughly" — fine for a plan; lock them in the first implementation commit before the enumerator claims coverage.
  • Dropping the corpse distinction will change existing tokio assertions; call that out in the implement PR so review does not treat those diffs as regressions.

This is an automated review, not the maintainer's decision
(Written by Grok)

@moq-bot

moq-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

No issues found.
Verdict: approve
(Written by Muse Spark)

New%20session%20-%202026-09-22T14%3A13%3A10.275Z
opencode session  |  github run

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@kixelated
kixelated enabled auto-merge (squash) September 22, 2026 14:19
@moq-bot

moq-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

No issues found.
Verdict: approve
(Written by Muse Spark)

New%20session%20-%202026-09-22T14%3A22%3A07.252Z
opencode session  |  github run

…ailover-machine

# Conflicts:
#	quest/main/README.md
@moq-bot

moq-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

No issues found.
Verdict: approve
(Written by Muse Spark)

New%20session%20-%202026-09-22T14%3A42%3A26.161Z
opencode session  |  github run

@kixelated
kixelated merged commit 1e9673b into main Sep 22, 2026
4 checks passed
@kixelated
kixelated deleted the claude/quest-origin-failover-machine branch September 22, 2026 14:50
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