Count queries served between polls as breadsearch activity #50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/ram-82-queries-served"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes RAM-82
The breadsearch adapter derived idleness only from polled in_flight, pending and loading. A query holds in_flight for milliseconds and the daemon polls every 2 to 3 s, so a mill answering a query every few seconds was read as idle and unloaded. The RAM-30 contention benchmark reproduced this in 3 of 3 runs.
The adapter now also reads an optional queries_served counter from the status. Any change between two readings is activity, a counter that goes backwards (daemon restart) is activity, and a daemon without the field behaves exactly as before. The counter is added by breadsearch PR for feature/status-queries-served (commit 7e5eef9); this change is safe to merge first because the field is optional and absent means no signal.
Tests: four new adapter tests (counter moving between polls, flat counter and idle restart, counter going backwards, daemon without the counter). With the counter ignored, three of the four fail, so they exercise the change. cargo test --workspace 596 passed, clippy -D warnings clean.
Live: scripts/bench/bench-contention.sh from feature/ram-30-benchmarks, run against this build and a breadmill built from 7e5eef9, three runs, each showing zero busy-mill unloads and one confirmed unload of the quiet mill (docs/benchmarks/ram30/release/contention-fixed-*.jsonl on that branch). Before the change the same bench unloaded the busy mill in 3 of 3 runs. The earlier single-mill 45 s window is not counted as evidence of protection.
REVIEW VERDICT: changes_requested (formal review blocked: the token account authored this PR)
Independent review of head
532fb5d055(based32197d). Verdict: changes requested, two small items. The logic is correct; nothing here needs a redesign.Checked on that exact SHA in a scratch clone:
532fb5d: successCriteria:
Requested before merge:
A. Add a test for the note_socket_result path (crates/breadram-core/src/adapter/breadsearch.rs, tests module). Mutating note_socket_result to call shows_work(None, &status) passes every existing test, so the executor confirmation-read path is unpinned. This test passes on the current code and fails under that mutation (I ran both):
B. The PR body cites docs/benchmarks/ram30/release/contention-fixed-{1,2,3}.jsonl on feature/ram-30-benchmarks, but those files are not on that branch on the remote (head
ae63ff5, release/ has only contention-{1,2,3}). They exist only as untracked files in the local ram30 worktree. I read them there: all three show busy_mill_unloads 0, quiet_mill_unloads 1, busy_mill_protected true, and the pre-fix remote files show busy_mill_unloads 1 in each run, so the evidence is consistent with the claim. Commit and push the fixed-run files (and stderr) to feature/ram-30-benchmarks, or reword the PR body so it does not point at files a reader cannot fetch. This is not part of this SHA, so no code change is needed on this branch.Non-blocking notes:
Next: push item A. I will re-review the new head and merge if CI is green on it.
REVIEW VERDICT: pass (formal review not possible: the token account authored this PR)
Independent re-review of head
f92dfebb14(based32197d7a1). Prior verdict (comment 5240, head532fb5d) had items A and B. Both are resolved.Checked on that exact SHA in a scratch clone:
f92dfeb: success (1m29s)Item A (confirmation-read test): pass. a_confirmation_read_compares_against_the_previous_reading drives note_socket_result with a moved counter and asserts Unknown, then a flat poll restarts idleness from that poll. Mutation run myself: note_socket_result changed to shows_work(None, &status). Result: that test FAILS (panic at breadsearch.rs:768), the other breadsearch tests still pass, confirming the test pins exactly that path. Mutation reverted, tree clean.
Tightened assertion: pass. a_counter_that_goes_backwards_is_activity_not_idleness now asserts Unknown. Traced: first reading starts the idle clock, the backwards reading makes shows_work true and clears idle_since_ms, and activity() returns Unknown when in_flight, pending and loading are all zero and no idle clock is set. Unknown is the correct value and a stronger check than not-Idle, since it would fail if the clock were left running.
Item B (benchmark evidence): pass. origin/feature/ram-30-benchmarks at
8c2b684contains docs/benchmarks/ram30/release/contention-fixed-{1,2,3}.jsonl and .stderr, fetched and read. Each jsonl shows busy_mill_unloads 0, quiet_mill_unloads 1, busy_mill_protected true, contention_resolved true, daemon_policy_driven true; each stderr is "ok". This matches the PR body claim (three runs, zero busy-mill unloads, one confirmed quiet-mill unload). The two bench scripts (bench-contention.sh, bench-breadsearch-daemon.sh) gained BREADRAM_BENCH_DAEMON and BREADRAM_BENCH_CLI overrides, as described.Scope: one file changed in this PR (crates/breadram-core/src/adapter/breadsearch.rs), no unrelated churn. Optional counter on one side only gives no signal, so older daemons behave as before and merging before the breadsearch change is safe.
Merged as
75bccaf214(merge commit, headf92dfebb14, based32197d). Head branch fix/ram-82-queries-served deleted. Main CI 'CPU checks / check (push)' on the merge SHA: success (1m36s). RAM-82 is awaiting verification of the integrated behaviour, not done: the live check needs a breadmill built from the breadsearch queries_served change, which is not merged.