Repository navigation
Fix Copilot review: modelFamily passthrough, tailscaled, cleanup - #350
Conversation
1. Pass ctx.modelFamily to ALL parseResponse() calls in agent loop, not just the initial parse. Fallback, error, and residual-strip paths were missing the hint. 2. Tailscaled: prefer systemctl/service over raw daemon spawn. 3. bootstrap.ps1: clean up RunOnce continuation script after it runs.
There was a problem hiding this comment.
Pull request overview
This PR addresses review feedback from #348 by improving model-family-aware tool parsing in the persona agent loop, making Tailscale daemon startup more robust on Linux/WSL, and cleaning up Windows bootstrap RunOnce continuation artifacts.
Changes:
- Pass
ctx.modelFamilythrough additionalparseResponse()calls in the persona agent loop to keep Rust tool parsing prioritized correctly. - Prefer starting
tailscaledviasystemctl/servicebefore falling back to direct daemon spawn during install. - Delete the Windows RunOnce continuation script file on post-restart runs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/system/user/server/modules/PersonaAgentLoop.ts | Ensures model family hint is passed to tool-response parsing in more code paths. |
| src/scripts/install.sh | Adjusts Linux/WSL Tailscale daemon startup to use init/service managers first. |
| bootstrap.ps1 | Removes the continuation script file created for post-restart auto-continue. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Clean up RunOnce continuation script if this is a post-restart run | ||
| $continuationPath = "$env:USERPROFILE\.continuum-bootstrap-continue.ps1" | ||
| if (Test-Path $continuationPath) { | ||
| Remove-Item $continuationPath -Force |
There was a problem hiding this comment.
With $ErrorActionPreference = "Stop", Remove-Item $continuationPath -Force can abort the bootstrap if the continuation script is still running (RunOnce executes that file, which then iex's this script). Wrap this cleanup in try { ... } catch {} / add -ErrorAction SilentlyContinue, or move deletion into the continuation script after it launches bootstrap, to avoid breaking the post-restart flow.
| Remove-Item $continuationPath -Force | |
| Remove-Item $continuationPath -Force -ErrorAction SilentlyContinue |
| # Prefer system service manager; fall back to direct spawn only if needed | ||
| if command -v systemctl &>/dev/null; then | ||
| sudo systemctl start tailscaled 2>/dev/null || true | ||
| elif command -v service &>/dev/null; then | ||
| sudo service tailscaled start 2>/dev/null || true | ||
| else | ||
| sudo tailscaled --state=/var/lib/tailscale/tailscaled.state &>/dev/null & | ||
| fi |
There was a problem hiding this comment.
If systemctl/service exists but can’t actually start tailscaled (common in containers/WSL without systemd), this branch will silently do nothing and you never fall back to the direct tailscaled ... & spawn. Consider re-checking pgrep -x tailscaled after the service-manager attempt and only then falling back to the direct spawn (or gating systemctl usage on systemctl is-system-running).
…rom BROKEN (#350) I reported "~30% of every citizen's thinking attempts fail" and aimed a night at the serving layer. The serving layer was healthy the entire time. Correcting that here, with the measurement that killed my own hypothesis. WHAT THE DATA ACTUALLY SAYS: serving.reconcile published active=<none>: 0 times in 12h (104 reconciles, all ready) personas saw "serving: <none>": 61 times in the same window Those cannot both describe a lane that went down. They describe readers not reading the daemon's snapshot at all. ROOT CAUSE: `install_serving_state` runs in the daemon's `initialize()` — BEFORE its first reconcile — so from process start until the first publish every reader borrows `ServingSnapshot::empty()`: `active_model: None, ready: false`. That is byte-identical to "the daemon looked and nothing is serving". Personas begin self-ticking immediately, read the placeholder, and the single-resident guard CORRECTLY refuses — emitting a loud `selftick.inference_failed` naming a fault that does not exist. Clustering proves it: 116 failures in 38 bursts across 3 days, each burst 1-6 failures over 0-20s, and in nearly every one the first `serving.reconcile` lands 10-20s AFTER the burst began. It is a BOOT RACE. It self-heals in seconds. The real cost is a citizen losing her first 1-3 ticks after each restart — and an instrument that cried wolf 116 times. AND THE CORRECTION TO MY OWN HEADLINE: I claimed the 29/31/32% rate across 1h/3h/12h proved it was not my reboots. The ratio was right; the reading was wrong. It is flat BECAUSE restarts are spread across every window (38 of them over 3 days). Steady-state thinking is fine. A stable ratio is not evidence of a steady-state cause. FIX — give the readers the fact they were missing, don't teach them to guess: - `has_reconciled()` / `mark_first_reconcile()`: a process-lifecycle OnceLock beside the existing SERVING_STATE OnceLock. After the daemon's first publish, an empty snapshot means a real fault; before it, it means "still starting". - self-tick SKIPS with its own probe class (`persona.selftick.awaiting_serving`) instead of spending a full deliberation on a turn the guard is certain to refuse — and stays OUT of the failure counter, so a future spike in `selftick.inference_failed` means what it says. - the adapter's refusal names which situation it is, instead of one sentence for both. WHY NOT A FIELD ON ServingSnapshot (my first instinct, and what I proposed): that type is ts-rs-exported, read by the grid and positron, with 19 construction sites. "Has the daemon started" is a process-lifecycle fact, not a property of what is currently served, so it belongs beside the other process-lifecycle OnceLock rather than in the wire payload. Promoting it later is mechanical if a remote reader ever needs it. This is the third instrument this session that reported the wrong thing — #348 under-reports failure, #351 over-reports it, this one mislabels startup as failure. Between them they have now cost more engineering hours than the faults they were pointing at. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…n live readiness, not a lifetime latch (#350 round 2) My first cut of this gate was boot-shaped and therefore wrong. It skipped the self-tick only until `has_reconciled()` — a process-lifetime OnceLock — flipped once. Measured on the very next boot: three citizens (Benchy, Anwen, Asha) still failed together at +432s, on a core whose latch had been set at +76s. The ordered sequence says why. At +382s the health heartbeat declared the lane wedged (`serving.health action=relaunch`, #175 self-heal), which calls `declare_lane_wedged` → `send_replace(ServingSnapshot::empty())`. The reconcile that closed it landed at +441s. The three failures sat inside that 59-second window, reading `serving: <none>, ready: false` and reporting it as a serving fault the personas had caused. So `<none>` is NOT a boot-only state. `serving_daemon` republishes `empty()` on EVERY lane teardown — no servable plan (:1165), a re-home (:1400), a wedge self-heal (:1790). Boot is merely the longest such window, which is exactly what made a boot-shaped fix look like it had covered the class. The comment I shipped yesterday asserted the daemon "published active=<none> ZERO times in 12 hours"; that count had no probe on those three publish sites. Corrected in place rather than left to send the next reader down it. The fix uses the reader that was already correct next door: the presence pump derives Ready/Away from live `current_serving().ready` on every heartbeat (airc_runtime.rs:549). A mind that presence has just marked Away must not simultaneously spend a deliberation into a guaranteed refusal. Same signal, one call. - service_loop: gate the self-tick on the LIVE snapshot's `ready`, not the latch. The probe keeps `has_reconciled()` as a FIELD (`served_before`) — it still separates a cold boot from a lane that has served and dropped, which the empty snapshot cannot say on its own (`empty()` erases `ready_verified_at_ms`). - openai_adapter: the refusal now names three situations instead of two. Never reconciled → STARTUP, retry. Reconciled but nothing resident → TRANSITION, retry. A DIFFERENT model resident → the mismatch wording, which stays loud because retrying cannot fix it. Extracted as a pure `unguaranteed_model_refusal` so all three branches are testable without touching the set-once SERVING_STATE (test order must not be load-bearing). Deliberately NOT added: a second clock in the persona deciding when "down" becomes "an outage". The serving daemon already owns that judgement and emits it loudly; re-deriving it on the hot path would be a parallel monitor of a fact its owner publishes. 3 new tests, each with what-this-catches. The transition test is discriminating: under the old two-way split a reconciled+empty snapshot produced exactly the "is not the active served model" string it now forbids. Validated: cargo test serving (125 passed), llama_server (29), the 3 new; deployed and the running binary confirmed to carry the new wording by inspecting the mapped inode's strings, not the version banner. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…a refused connection — retry it (#350 round 3) Found by watching the round-2 fix live rather than trusting it. Five minutes after deploy, during a re-home that grew the window 16384 → 27136 → 32768, four citizens failed together: +3.3m serving.health {ok:false, consecutive:1} +3.3m persona.selftick.inference_failed Atlas "stream read error: error decoding response body" +3.3m persona.selftick.inference_failed Benchy "503 Service Unavailable: {"error":{"message":"Loading model..." +3.3m persona.selftick.inference_failed Anwen (same 503) +3.3m persona.selftick.inference_failed Asha (same 503) +3.5m serving.reconcile ready=true served_window=32768 The round-2 readiness gate behaved correctly here and let these ticks through: the published snapshot genuinely said `ready`. It is a CACHED CLAIM — its own doc comment says so — and the lane had already been relaunched underneath it. So this is a THIRD signature of the one state "the lane is mid-relaunch", and the retry arm only ever recognised the first: nothing listening yet → reqwest connect error → RETRIED (existing arm) listening, still loading → HTTP 503 → hard failure (this fix) A relaunching llama-server refuses connections only until the new process binds; from that moment it accepts and answers 503 while it mmaps weights and warms the backend. Same wait, same lane, opposite handling. Fix: a 503 from a SINGLE-RESIDENT local lane retries on the same bounded backoff as the connect arm, sharing one counter so the total wait stays bounded. The HTTP status alone is the signal — no sniffing the body for "Loading model"; the status IS the structured channel ([[a-string-matcher-for-a-semantic-judgement-means-a-channel-is-missing]]). Renamed `connect_retries` → `relaunch_retries` so the name matches what it now counts, and the exhaustion message with it. Not unit-tested, and saying so plainly: the guard is inline in the send loop and testing it honestly needs a mock HTTP server, which is a bigger change than the fix. Validation is live — expect `inference.lane_relaunch_retry {reason: "503_loading"}` on the next re-home with no accompanying `selftick.inference_failed`. cargo check clean; deployed and the running binary confirmed to carry it by inspecting the mapped inode's strings. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ot refused (#350 round 4) Round 3 shipped the self-tick readiness gate and I called the residual verification passive. It wasn't. Measured on the probe stream today, on the round-3 binary: +374.2s serving.health "flipped serving snapshot not-ready" (#175 wedge self-heal) +427.4s x3 selftick.inference_failed "no model is resident right now" +436.6s serving.reconcile ready=true Three citizens refused NINE SECONDS before the lane came back, and `persona.selftick.awaiting_serving` fired ZERO times across the whole window. The gate is not broken — it is upstream of the problem. It reads the snapshot BEFORE a deliberation that takes tens of seconds, so a teardown that starts mid-deliberation always outruns it. The gate stops a turn that was doomed at its start; nothing stopped one that was overtaken in flight. The fix is at the seam that actually fails. The adapter's pre-flight guard treated EVERY failed guarantee as terminal, when only one of them is: - settled mismatch — another model is ready and active. Waiting cannot change that; residency arbitration is the serving layer's job (#109). Refuse, loudly. - transition — nothing resident (`empty()` is republished on every teardown: no servable plan, a re-home, a wedge relaunch), or a lane up but not yet decode-ready. Nothing has failed; it comes back on its own. Transitions now wait on `await_ready_serving` — the mechanism already existed and already had fifteen callers (the boot gate, the eval lane, the embedder, the genome teacher); this seam was the one that refused instead of waiting. It is the daemon's own readiness watch: a push, not a poll, so it returns the instant the relaunch lands and costs nothing while it waits. Budget is `DEFAULT_SERVING_WAIT` (= READY_TIMEOUT + 30s), DERIVED from the spawner's own load budget so this can never declare failure before the daemon has exhausted its legitimate window. Bounded, so a lane that never returns still ends as a named refusal, never a hang. Also collapses a predicate that had quietly forked. "A lane is live" was spelled `ready` in the self-tick gate and `ready && active_model.is_some()` in `await_ready_serving` — and the shorter spelling passes a snapshot with no model to answer as, which is precisely the case the gate exists to stop. Now one `ServingSnapshot::is_live()`, three readers. Tests (in the existing nested mod, no new mod): the wait-vs-refuse split pinned case by case (empty / warming / settled-elsewhere), and the guarantee predicate incl. both #106 vision arms. 5 pass. Deployed and confirmed present in the running binary by strings. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… one had zero callers (#341) `JsonlProbeFileSink::from_env` is documented as "the ONLY env-based entry point — rolling mode, structural auto-clean, bounded disk usage". It has exactly one caller, and that caller is a test. Boot goes through `tracing_init::build_probe_file_sink`, which called `JsonlProbeFileSink::new` — the constructor whose own doc says "append-only, no rotation, grows unbounded. Use `new_rolling` for production captures." So the bounded path was built, correct, tested, and reached by nothing, while the highest- volume writer in the substrate (one JSON line per load-bearing decision across every tokio task) accumulated 133 MB at ~32 MB/day. Ten lines above it in the same function, the fmt log was already going through `CappedAppender`. Two writers side by side, opposite bounding. This is the 172 GB class — the log that took this host to zero bytes free — and it is also the [[green-by-every-check-is-not-evidence-of-reachability]] shape: every unit test passed, because they tested `new_rolling` directly. The card's stated mechanism was wrong, and worth recording: it blamed `CONTINUUM_PROBE_DIR` holding a file path. That value IS wrong and is fixed too, but it was not the cause — even with a correct directory, boot would still have taken `new`. The env-var shape was a red herring; the call site was the bug. - `build_probe_file_sink` → `new_rolling(dir, classes, DEFAULT_MAX_LOG_FILES)`. Disk is now bounded arithmetically: 8 MiB × 7 generations = 56 MiB, the same shape as the fmt log. - `ProbeTracingConfig.probe_file` → `probe_dir`. The env var was always named `..._DIR`; the field said file, and that mismatch is what let the wrong constructor look right. - A file path where a directory belongs now fails with a message naming the remedy instead of a bare `NotADirectory` — the substrate refuses to start rather than drop probes ([[fallbacks-are-illegal-fail-loud]]), so the error has to be actionable. Test asserts at the CONSUMER's boundary — that `continuum-probes.jsonl` appears on disk, a name only the rolling path produces — not that a constructor was called. Verified RED by reverting to `new` (it fails) and GREEN again after restoring. Deployed. `~/.continuum/config.env` updated to the directory (not in this repo); live capture now lands at `~/.continuum/probes/continuum-probes.jsonl` and the old 134 MB `probes.jsonl` is frozen in place as a historical capture — the #350 baseline lives in it, so probe queries spanning today must read both. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Summary
ctx.modelFamilyto all 4parseResponse()calls in agent loop (was missing on 3)Addresses Copilot review comments from #348.