Repository navigation
fix(server): quiet capacity sampling and gate verdicts only on rules - #794
Merged
Merged
Conversation
Swap, worktree folder counts and turn activity have no threshold, so an unreadable value no longer turns verdicts unknown and restarts recovery. Off reports no measurements and open verdicts instead of stale would-hold verdicts with a synthetic activity reason. The would-hold log fires when the held verdict or its reasons change rather than every five seconds. Darwin reads memory pressure and swap in one sysctl call and the core count once. Environment reads include linked machines only on request; the capacity CLI asks for them. Carry-Group: incubator Carry-Observation: Advisory capacity evolves independently of the launch, environment, and CLI results that carry it. Co-Authored-By: Claude <[email protected]>
…r Off Carry-Group: incubator Carry-Observation: Advisory capacity evolves independently of the launch, environment, and CLI results that carry it. Co-Authored-By: Claude <[email protected]>
Carry-Group: incubator Carry-Observation: Advisory capacity evolves independently of the launch, environment, and CLI results that carry it. Co-Authored-By: Claude <[email protected]>
Carry-Group: incubator Carry-Observation: Advisory capacity evolves independently of the launch, environment, and CLI results that carry it. Co-Authored-By: Claude <[email protected]>
lastobelus
marked this pull request as ready for review
November 20, 2026 23:04
Owner
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
lastobelus
added a commit
that referenced
this pull request
Nov 21, 2026
…iew (#808) Two independent reviewers, GPT-6.2 Astra (high) and Claude Fable 5.2 (high), re-reviewed the whole observe-only capacity system after [#793](#793), [#794](#794) and [#797](#797). This PR fixes what they found in verdicts, recovery and launch latency, before capacity step 2 starts acting on verdicts. ## What changed - **A gap restarts recovery:** if sampling stalls for more than 30 seconds, both agent and background verdicts hold until they've had 60 healthy seconds again. Before, a background verdict that was open reopened on the first sample after the stall. The last sample time survives a worktree-directory change, so a gap across one is still seen. Resuming after Off still starts the way server start does. - **Recovery needs new samples:** recovery time is measured between samples, not up to the read. Before, a read with no new sample could end recovery. - **A real breach holds:** a verdict is `hold` when a fresh measurement breaches a rule, even if another signal can't be read. Before, one unreadable signal hid the breach as `unknown`. On Linux, memory pressure is always unreadable, so Linux could never report `hold`. A stale sample is still `unknown`, even if its last reading breached. - **Launches don't wait on activity:** launch, task and Action results read capacity without counting turns, which needs a snapshot of every thread and could take up to 3 s. Only `t3_environment_read` counts turns, and that count now times out after 1 s, inside a peer's 2 s forwarded read. - **The folder count can't delay verdicts:** the worktree folder count has its own 1 s timeout. No rule uses it. - **Sampling survives a crash:** a crash in one sample is logged as `capacity.sample-failed`, and sampling continues. Before, it ended sampling silently, and every later read stayed stale until restart. ## Not changed - **Remote `delegate_task` capacity:** still read with one bounded call to the peer. The remote launch starts asynchronously after `delegate_task` returns, so there's no launch result to reuse. - **Left as follow-ups:** - an `enforced` field on the snapshot, for step 2; - a warm-up rule for the disk rate, plus a minimum window; - a guard against stuck volume reads piling up; - a slower schedule for the folder count; - smaller capacity blocks on launch results; - a wiring test through the route layer; - activity counting one turn per thread; - an Off interval that falls entirely between two samples; - a defect in the first sample after Off. ## Validation - **Tests:** each new test fails on main and passes here: - the gap hold, including across a directory change; - recovery advancing only with new samples; - a breach beside an unreadable signal; - a stale sample with an old breach; - a defective sample. - **Fake services:** launch-path fakes now fail the test if a launch reads activity. - **Focused tests:** the capacity, capacity-read and environment tests pass (70). - **Changed-file gate:** `vp run check:changed origin/lastcode/main` passed format, lint, both knip passes, GraphQL, typecheck and tests. - **Model-backed MCP evals:** not run; this machine has no authorized eval proxy. No tool description or schema changed. Local review: 3 rounds with GPT-6.1 Terra (xhigh), approved. - **Round 1:** found that a stale sample with an old breach reported `hold`. - **Round 2:** found that a directory change during a stall erased the gap. Both are fixed, with tests. - **Round 3:** approved, with one nit left as a follow-up: a defect in the first sample after Off. Implemented with Claude Opus 5.5 through Claude Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Carry-Source-Ref: refs/lastcode/carry-sources/pr-808/53b03d4a05ec8427d5ec2a47c2e189a1c1fa8e3d Carry-Source-Base: e2a195b Carry-Source-Head: 53b03d4
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.
The observe-only capacity sampler from #726 had review nits about noisy verdicts, logging, process spawns, and default fan-out. This PR fixes them before capacity step 2 starts acting on verdicts.
What changed
nullinstead of turning both verdictsunknownand restarting the 60-second recovery. Load, memory pressure and free disk still gate as before.openverdicts with no reasons, since Off samples and holds nothing. Before, it returned staleunknownverdicts with a made-upactivity: unreadablereason. A read that sees Off also invalidates earlier readings, so a brief Off between sampler ticks can't leave pre-Off data or recovery time in place.capacity.would-holdis logged when the held state or its reasons change, including categorical values such as warning becoming critical. It used to log every 5 seconds while held.sysctlcall per sample, parsed by content so one failed name doesn't shift the other value. One native source is kept per worktree directory and reads the core count only once. The livesysctlcommand is built on each read.CapacityState.activityand its parameter were never set in production.t3_environment_readreads linked machines only withincludeLinked: true, because each one can cost 2 seconds.lastcode-thread capacityasks for them. The tool description now says how to get linked machines, that no mode holds work, and what Off reports. It is shorter than before (369 bytes, down from 374).Validation
Capacity.makeruns with a fake macOS spawner over three samples. It reads the core count once and the live values three times, and logs a changing pressure level each time. Without the service-level source cache and the per-read command, it fails.vp run check:changed origin/lastcode/mainpassed format, lint, both knip passes, GraphQL, typecheck, and tests.pnpm mcp-tool-use --out runs/capacity-environment-readfromevals/.Local review: 3 rounds with GPT-6.1 Terra (xhigh), approved.
sysctleffect had been built once, which would have frozen the live values. Round 1 also found a gap after brief Off periods and a log signature that ignored categorical values.Implemented with Claude Opus 5.5 through Claude Code.