feat(tray): split routing off the Inference menu, and add a fail-closed peer-only mode - #377
Merged
Merged
Conversation
|
📘 Docs preview for this PR: https://waired-docs--pr-377-txi1imv4.web.app Rebuilt on each push; the preview channel auto-expires in 7 days. |
…ed peer-only mode The rc7 review found the tray's "Inference" submenu unreadable: engine controls, status captions and the routing selector all sat at one level, with the abstract modes (Auto / Local only / Peer preferred) listed alongside concrete per-node pins. Three separate complaints, one shape. Split at the TOP level instead of nesting deeper. "Inference" now holds only this computer's engine — pause/resume, start/stop, install, mesh sharing, engine and model status. A new "Inference routing" parent holds the answer to "which computer answers my requests": the current worker, whether any peer engine is reachable, the automatic modes under a "Choose automatically" header, and the per-peer pins under a "Pin to one peer" header. The pins do NOT move one submenu deeper, as the review first suggested: fyne.io/systray's Windows backend does not render a third nesting level (the same limit that flattened these rows in waired#809), and submenus cannot hold separators. Disabled header rows are the available separation, and they are the existing pattern from the Claude Code submenu. Add "Peer only" alongside "Local only", its mirror image: serve from another computer or fail. Unlike peer-preferred it never falls back to the local engine, because falling back is precisely what the operator excluded — the silent-local-fallback shape #325 is removing from pins. The Claude surface inherits this for free: its non-destructive local retry is gated on pinned mode, so peer-only surfaces the error. That invariant now has a test. peer-only is agent-local state: no proto change, no CP contract change. Signed-off-by: gen16k <gen16k@gmail.com>
The submenu the comments point at is called 'Inference routing' since the split. Comment-only; no behaviour change. Signed-off-by: gen16k <gen16k@gmail.com>
The EN page picked up both the `--force-reauth` rows from #367 and the peer-only line from this branch; the ja page carries both translations, so the pair hash is recomputed to match. Signed-off-by: gen16k <gen16k@gmail.com>
gen16k
force-pushed
the
feat/327-tray-routing-menu-split
branch
from
August 1, 2026 20:09
06ba8a3 to
35c244a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
rc7 review (waired-ai/waired#986, F31): the tray's "Inference" submenu mixes three kinds of item at one level — engine actions (Disable / Stop / Stop sharing), status captions (Engine / Sharing / Mesh / Model / Worker), and an "Inference worker" radio group where the abstract modes Auto / Local only / Peer preferred sit alongside concrete per-node pins. The reviewer's three points:
The mockup and wording for this were approved by the owner before implementation, per the issue's decision block.
What changed
Menu IA — split at the top level, not one level deeper.
The pins deliberately do not move one submenu deeper as the issue suggested:
fyne.io/systrayv1.12.2's Windows backend does not render a third nesting level (the same limit that flattened these rows under "Inference" in waired#809 — see the comment ininternal/gui/tray/tray.go), andsystray.AddSeparator()is top-level only. Disabled header rows are the available separation, and they are the existing pattern from the Claude Code submenu (Main conversation/Subagents). Wording keeps the current vocabulary so the tray labels andwaired worker set --mode=values still line up.ShowRoutingMenugates the new parent: true when either the worker rows or the mesh row has content, so a daemon exposing only one of the two still gets a parent worth opening, and one predating both renders no parent at all.peer-only— the mirror image oflocal-only, fail-closed.internal/router/endpoint_router.gogets a routing branch that serves from the mesh or returnsErrModelNotReady— it never consults a ready local model, andMeshSnapshotFn == nil(the overlay-side Selector) fails rather than degrading to local. Falling back is exactly what the operator excluded, and it is the silent-local-fallback shape #325 is removing from pins.The Claude surface inherits this without new code:
selectWithWorkerPref's non-destructive local retry is gated onMode == pinned, so peer-only propagates its error.TestClaudeSelector_PeerOnlyDoesNotFallBackLocalpins that invariant rather than leaving it to be rediscovered.Plumbed through
internal/runtime/state(const + validation),cmd/waired-agent/worker_control.go,internal/management/inference_worker.go(400 on a stray pin),internal/agentconfig,cmd/waired/worker.go(--mode, help, examples) andcmd/waired/claude_route.go. No proto change — the routing mode is agent-local state, so there is no CP contract to bump.Verification
gofmt -l .,go vet ./...,golangci-lint run(0 issues),go test ./... -timeout 10m,go build -tags prod ./... && go vet -tags prod ./...,make verify-cross— all green.tray-row-mutation-guard.sh,tray-dialog-seam-guard.sh,routing-sentinel-paths-guard.sh,testnet-gate-guard.sh,decision-log-guard.py.npm run i18n:check(31 pairs in sync afteri18n:accept) andnpm run build.ShowRoutingMenufor a mesh-only and a pre-feature daemon;peer-onlyselected-row and label; router peer-only serves remote / fails closed with an empty mesh while local is READY / fails closed with no snapshot; Claude selector records no fallback under peer-only; and the mode rows now round-trip through the existing table tests for state persistence, the worker controller, the management handler, agentconfig and the CLI.Note on test shape: the mode rows are rendered into pre-allocated slots typed
*systray.MenuItem, which themenuRowrecorder cannot substitute — a live tray session would be needed to assert the rendered slots. The real risk there is a mode row past the pre-allocation being silently unclickable, soTestApplyWorkerModeSlotsMatchPreallocationpinslen(WorkerModes) == workerModeSlotsinstead.Refs
Fixes #327
Refs waired-ai/waired#1002 (L18)
Refs waired-ai/waired#986
Refs #325 (shared fail-closed contract), #326 (deterministic pin row order, merged separately)
docs/decisions/20260801/1840-tray-routing-split-and-peer-only.md