Metadata
| Status | failed ‖ paused |
|---|---|
| Created | 2026-07-25T20:56:54.917684992+00:00 |
| Started | 2026-07-26T06:09:58.433670256+00:00 |
| Completed | 2026-07-27T15:48:41.489684274+00:00 |
| Tags | coordinator, config, bugfix |
| Tokens | 5591331 in / 27129 out |
| Failure reason | required evaluation gate rejected: evaluator verdict-evalp-fd5da61975fbab269deb9f97-evaluate-f3154d11cfa45430 score=0.64 threshold=0.70 FAIL; FLIP verdict-evalp-fd5da61975fbab269deb9f97-flip-935878596618c786 score=0.72 threshold=0.70 PASS |
Description
Objective
Fix the max_agents four-source-of-truth authority bug so a runtime override survives a flagless wg service reload / profile swap. This is the SHARED PREREQUISITE for the adaptive-parallelism controller (T4) — without it, the controller's writes are silently clobbered. It is a pure correctness fix valuable independently (fixes the observed "start with --max-agents 2, wg profile use, observe 8" bug).
Context: docs/studies/adaptive-parallelism-budget-design.md §8 (the bug + the fix), docs/studies/roadmap-rate-limit-and-distribution.md §2.2/§3.
What to build
There are FOUR sources of truth for max_agents today with no defined precedence: (1) CLI launch arg --max-agents (daemon memory only, src/commands/service/mod.rs:~2415), (2) [coordinator].max_agents in merged config.toml (src/config.rs:~4089), (3) the active profile overlay (src/profile/named.rs:~473,479, written into config.toml on activation), (4) runtime IPC Reconfigure { max_agents } (src/commands/service/ipc.rs:~1095). The bug: the launch arg (1) is never persisted, so a flagless reload sends Reconfigure { max_agents: None } (src/commands/service/mod.rs:~3891, src/commands/profile_cmd.rs:~1205), handle_reconfigure takes its else-branch, re-reads config.toml, and does daemon_cfg.max_agents = config.coordinator.max_agents (src/commands/service/ipc.rs:~1111) — silently replacing the launch arg's value with the profile's.
Implement the fix exactly as specified in the study §8.2:
- Add
runtime_max_agents: Option<usize>toCoordinatorState(src/commands/service/mod.rs:~710). This is the new single transient-but-persisted authority. It survives daemon restart (on disk in the coordinator state file). - In
handle_reconfigure's else-branch (src/commands/service/ipc.rs:~1109-1113): after re-reading config, if aruntime_max_agentsis present inCoordinatorState, KEEP it instead of clobbering withconfig.coordinator.max_agents. - At daemon start (
src/commands/service/mod.rs:~2415): ifcli_max_agentsisSome(n)AND noruntime_max_agentsis already on disk, writeruntime_max_agents = nintoCoordinatorState(so the launch intent survives reload) and arm a session pin. config.coordinator.max_agentsbecomes the ceiling + cold-start default only.- Add a
--no-pinescape onservice startfor tests wanting the old behavior. - An explicit
--max-agentsflag onreloadis a human action and wins (it takes thehas_overridesbranch and should be recorded as a pin).
No schema migration needed (the field is Option, defaults to None = today behavior).
File scope
src/commands/service/ipc.rs(handle_reconfigure else-branch)src/commands/service/mod.rs(CoordinatorState field + daemon-start pin logic)src/config.rs(if a--no-pinflag / config key is needed)- New unit test(s)
Implement directly. Do not decompose further unless you hit genuine context pressure.
Validation
-
New unit test reproduces the reload-clobber: start with
--max-agents 2, simulate a flaglessReconfigure { max_agents: None }, assertdaemon_cfg.max_agents == 2(preserved), NOT 8. -
Unit test: an explicit
--max-agentsreload flag overrides the runtime value and is recorded as a pin. -
Unit test: daemon restart restores
runtime_max_agentsfrom disk. -
--no-pinescape restores today behavior for tests. -
cargo build+cargo testpass with no regressions. -
cargo fmt --check+cargo clippyclean (CI fast-fails on fmt). - No model pin in the task; routes through the active zai profile.
Depends on
Required by
Log
- 2026-07-25T20:56:54.894911933+00:00 Task paused
- 2026-07-25T20:57:27.019239946+00:00 Task published
- 2026-07-25T21:00:41.329367606+00:00 Spawned by coordinator --executor pi --model zai:glm-5.2 --isolation required-worktree
- 2026-07-25T21:03:50.415154737+00:00 Plan: (1) add runtime_max_agents: Option<usize> to CoordinatorState, (2) add resolve_startup_max_agents helper for daemon-start precedence, (3) fix handle_reconfigure else-branch to preserve runtime override + record explicit --max-agents pin, (4) add --no-pin flag to service start/daemon, (5) write unit tests for all 4 validation criteria.
- 2026-07-26T05:53:55.243770533+00:00 Dead attempt contained ENOSPC evidence — skipped quality triage/evaluation, released its cache lease, and queued a safe in-place retry
- 2026-07-26T05:53:58.460418346+00:00 Minted evaluation pipeline evalp-49bc7518f48cbb642e29a3e9 for source attempt 2 (coordinator dead-agent retry)
- 2026-07-26T06:09:58.505104247+00:00 Spawned by coordinator --executor pi --model zai:glm-5.2 --isolation required-worktree
- 2026-07-26T06:42:45.151090503+00:00 Implementation complete: added CoordinatorState.runtime_max_agents (single persisted authority), resolve_startup_max_agents precedence ladder, handle_reconfigure keeps runtime override on flagless reload + records explicit --max-agents as pin, --no-pin escape. Found+fixed a tick-clobber race (long-lived in-memory coord_state was overwriting the disk pin on tick save — now reloads runtime_max_agents from disk like accumulated_tokens). 6 unit tests + 1 smoke scenario (which caught the tick race). Also fixed pre-existing last_spawn_failure_at compile break in integration_auto_assignment.rs (field exists on main, test was missing it).
- 2026-07-26T06:43:17.292589247+00:00 Committed: 135b70d5 — pushed to origin/wg/agent-808/impl-maxagents-authority-fix
- 2026-07-26T06:45:40.560051898+00:00 Task pending required evaluation gate (agent reported done; awaiting exact attempt-bound `.flip-*`/`.evaluate-*` verdicts)
- 2026-07-26T06:45:52.084888227+00:00 Squash-merged to main (eb435fa1). Resolved concurrent merge conflict on grow-only tests/smoke/manifest.toml (kept both my service_max_agents_survives_reload scenario AND T6's release_workflow_signing_contract scenario). VALIDATION COMPLETE: 6 unit tests (4 resolve_startup_max_agents precedence + 2 handle_reconfigure preserve/pin) + 1 smoke scenario all pass; cargo build/test/fmt --check/clippy clean; 353 service + 22 integration + 3 integration_service tests pass, no regressions. Bonus: end-to-end probe found+fixed a tick-clobber race (long-lived in-memory coord_state overwrote the disk pin on tick save) that the unit tests structurally cannot reach — the smoke scenario pins it.
- 2026-07-26T06:51:10.373098757+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:15:23.259687967+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:15:47.003302771+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:15:54.193556125+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:16:17.537116360+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:16:43.433810574+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:17:06.951188981+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:17:30.630192193+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:17:52.796408265+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:17:57.798067784+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:18:14.610432481+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:18:19.991353960+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:18:39.765667190+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:18:44.712129157+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:19:03.247370895+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:19:08.233926794+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:19:23.899663699+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:28:04.759793779+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T07:28:09.766819580+00:00 Repaired evaluation pipeline drift for authoritative source attempt 2 (evalp-49bc7518f48cbb642e29a3e9)
- 2026-07-26T07:57:06.580092997+00:00 Pinned historical PendingEval as a required gate at evaluator threshold 0.70
- 2026-07-26T08:14:35.961683300+00:00 Task reset for retry from pending-eval/failed-pending-eval (stuck evaluation gate) (attempt #1) — reason: Operator recovery: clear legacy pending-eval hold with the newly sanctioned CLI; keep paused until reliability review.
- 2026-07-26T08:14:35.961692060+00:00 Cleared stuck evaluation gate via `wg retry` — a fresh attempt will be minted; no graph.jsonl edit required.
- 2026-07-26T08:14:35.961720411+00:00 Minted evaluation pipeline evalp-fd5da61975fbab269deb9f97 for source attempt 3 (resume-in-place retry)
- 2026-07-26T08:14:36.014993597+00:00 Task paused
- 2026-07-27T15:45:16.022024481+00:00 Task pending required evaluation gate (agent reported done; awaiting exact attempt-bound `.flip-*`/`.evaluate-*` verdicts)
- 2026-07-27T15:48:41.489684454+00:00 Consumed durable verdict verdict-evalp-fd5da61975fbab269deb9f97-evaluate-f3154d11cfa45430 exactly once under strict required-gate policy: evaluator verdict-evalp-fd5da61975fbab269deb9f97-evaluate-f3154d11cfa45430 score=0.64 threshold=0.70 FAIL; FLIP verdict-evalp-fd5da61975fbab269deb9f97-flip-935878596618c786 score=0.72 threshold=0.70 PASS; outcome=failed