Skip to content

Commit ee3d07a

Browse files
Petrus Pennanenclaude
andcommitted
Model picker: review fixes - trusted-host auth, real timeouts, no silent exits
Adversarial review of #119 found four P1s and two P2s. Each fix has a regression test proven to fail against the unfixed code. P1-2: use gateAuthHeadersFor(daemonBase) instead of gateAuthHeaders(resolveGateToken()). --daemon is an argument, and the old code attached the fleet gate token to whatever host it named, re-opening the token-exfiltration path fixed in PR #52. P1-1: the run-directly guard compared import.meta.url (realpath-resolved) with process.argv[1] (not). Through any symlink - a ~/bin symlink, or macOS /tmp - main() never ran and the process exited 0, a code this file documents as "a selection was applied". Uses the realpathSync idiom already in scripts/team-watchdog.mjs. P1-3: every daemon request now carries an AbortSignal, clamped to the time left. Without one, a daemon that accepts a connection and never answers left the poll fetch pending forever and --timeout-sec could not be enforced. P1-4: the write is wrapped, and a failure after the tap has its own outcome, its own exit code and a message that says plainly that the choice did not take effect. main() no longer lets anything escape as a stack trace. P2-8: an entry whose configured key cannot be read is no longer offered. vLLM and llama.cpp serve /v1/models without auth, so such a box reports UP and then refuses the first real request. model-capacity.js now reports keyBlocked as its own field rather than only inside the reason prose. P2-9: daemonBase and callerHost are required with no defaults, so a test can no longer fall through to the production daemon and raise a live intent on the owner's phone. Every test in the suite passes a fixture daemon. Also: one-up refusal replaced with apply-after-re-probe (a fresh box, a fleet that shrank to one, and a single-machine clone were all broken by refusing); --require-choice keeps the strict behaviour. Distinct exit codes for distinct faults. A daemon that answers 400 is DAEMON_REFUSED, not "not answering". The answer is validated against the options offered, not against the registry. No "model unknown" and no "unknown" caller host in anything the owner reads. 39 picker tests, one new model-capacity test, all controls proven. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent cf79c96 commit ee3d07a

5 files changed

Lines changed: 811 additions & 204 deletions

File tree

0 commit comments

Comments
 (0)