Repository navigation
[3481 by Claude Opus 5.5] Report admission capacity per agent through REST, MCP and the CLI, and document safe configuration changes - #3519
Conversation
…s: `GET /api/agent-run-admission`, the MCP tool `get_agent_run_admission`, and `propr admission` (a table, or `--json`). The new suites pass, and so do the existing admission, capacity and deferral suites, run against a real Redis 7.2 with nothing skipped. What the report shows - Whether admission is on, the global limit and where it comes from (`PROPR_AGENT_RUN_LIMIT` or the Hosted entitlement), the generation and the nested limit. - Globally and per agent: the ceiling, the slots in use, and running work by state (reserved, running, draining, recovering). A holder whose lease expired counts as recovering. - Nested executions are counted separately from holders. - Waiting work is split into: waiting on the global limit, waiting on the agent's ceiling, recovering, starting, and deferred queue jobs. - The other limits, each with a label: queue worker slots in use and in total, and repository workflow slots for repositories with a limit. - Subscription usage is left out on purpose; a note in the report says where to read it. - With admission off, the report says so and still returns the other limits. If Redis is unreachable or the configuration is invalid, it reports why instead of failing. Redaction - The report never contains tokens, container IDs, the Docker daemon identity, the instance ID or Redis keys; a test checks this. - Task IDs: in REST, only for tasks that exist, and none for the read-only demo viewer. In MCP, only for tasks in repositories inside the caller's grant that the repository policy allows. Repository slots are filtered the same way. How the reasons get recorded - Each launch now writes its alias, task ID and wait reason to a new Redis hash beside the waiting set. No admission decision reads it, a failed write is ignored, and the report's read removes entries for launches that have gone. - The waiting and admitted log lines now always include `agentAlias` (null when the launch has no alias) and `waitReason`. The admitted line also includes `waitedMs`. Other acceptance criteria - Timeline: the row reads `Waiting for agent capacity: <alias> (limit N)`. If the refusal doesn't carry the ceiling, it is taken from the configuration. A later wait on a different agent or ceiling now starts a new row instead of rewording the old one. - Fleet queue status: `/api/internal/hosted/queue` now adds a `deferred` count of jobs delayed for agent or repository capacity; retry backoffs are not counted. - Operator docs: a new page, `docs/docs/operations/agent-run-capacity.md`. It covers each limit and how they combine, setting `PROPR_AGENT_RUN_ALIAS_LIMITS`, raising or lowering ceilings with no drain (running work is never stopped), the global-limit procedure (generation bump, drain first, rollback with a new higher generation), and rolling restarts with mixed versions. I also updated the architecture page, the configuration reference, the CLI page, `docs/mcp.md`, `docs/mcp-coverage.md` and the regenerated settings page. - Contract checks: the route is registered and documented with a typed schema, and `gen:openapi:check` and `check:client-contract` are clean. The settings catalog entry now points to the new tool and command. Things to know - Fleet must read `deferred`: the field is additive, so Fleet keeps working, but its drain logic has to treat `deferred > 0` as pending work. An older API won't send the field, so treat a missing value as unknown, not zero. - Repository slots: only repositories with running work under a limit are listed; one with a limit and nothing running doesn't appear. - Refactor: I moved the wait-reason handling out of `agentRunAdmission.ts` into a new `agentRunAdmissionWait.ts`, to stay within the lint complexity and file-length limits. - Failing API typecheck lines: type-checking the two edited hosted-Fleet test files reports errors, but on lines I didn't touch. - API tests and the working directory: API test files must be run from the repo root; run from inside `packages/api`, they hang at exit. New tests - `test/agentRunAdmissionSnapshot.test.ts` (real Redis): counts under contention, the split of wait reasons, nested executions, recovering holders, deferred-job filtering, redaction, admission off, Redis unreachable. - `packages/api/test/agentRunAdmissionRoutes.test.ts`: task visibility in REST, MCP and for the demo viewer, the disabled case, the error response, and checks against the published schema. - `packages/cli/src/commands/admissionCommands.test.ts`: the table, admission off, and the JSON output. - `test/agentCapacityTimelineRow.test.ts`: the timeline row naming the agent and ceiling. I didn't create visual previews, since nothing here changes the UI.
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
|
CI failed: Validate unsigned linux-arm64 package Please investigate and fix this CI failure.
Failure evidence
|
|
✅ Applied the requested follow-up changes in commit 26ab9c0 Summary of ChangesI've fixed the failure. Nothing in this PR's code caused it. The job's "Audit committed dependency resolution" step blocks on known security advisories, and new ones have been published against two dependency versions in the lockfile. What the audit flagged:
What I changed:
Checked locally:
I didn't add any audit exceptions. There are no visual previews, since nothing here changes the UI. 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
|
CI failed: Validate unsigned darwin-arm64 package Please investigate and fix this CI failure.
Failure evidence
|
|
CI failed: Validate unsigned linux-x64 package Please investigate and fix this CI failure.
Failure evidence
|
…. The job's "Audit committed dependency resolution" step blocks on known security advisories, and new ones have been published against two dependency versions in the lockfile. `main` has the same old versions, so any branch cut from it will fail this check until it gets the same fix. I've fixed the failure. Nothing in this PR's code caused it. The job's "Audit committed dependency resolution" step blocks on known security advisories, and new ones have been published against two dependency versions in the lockfile. `main` has the same old versions, so any branch cut from it will fail this check until it gets the same fix. **What the audit flagged:** - **`hono` 4.13.12**: five advisories, all fixed in 4.13.16 or later. - **`@hono/node-server` 2.1.5**: two advisories, fixed in 2.1.6. **What I changed:** - **`package.json`**: raised the pinned `hono` version in `overrides` from 4.13.12 to 4.13.18. - **`package-lock.json`**: updated only the lock entries for `hono` (4.13.18) and `@hono/node-server` (2.1.8). The rest of the lock is unchanged. **Checked locally:** - `npm run audit:runtime` and `npm run desktop:audit:packaging`, the two commands that step runs, both pass now. - CI installs with npm 10 (Node 22), and running npm 10 over the new lock leaves it byte-identical. I didn't add any audit exceptions. There are no visual previews, since nothing here changes the UI. PR: #3519 Comment by: @propr-dev[bot] (ID: 6842420073) Model: Claude Opus 5.5
|
ℹ️ Analyzed the follow-up request by @propr-dev[bot] Analysis SummaryI didn't change any code: both failures are already fixed on the branch's latest commit, Why they failed: the CI report points at commit Already fixed: the follow-up commit
CI on the latest commit hasn't finished: the Desktop Package and Release run for No code changes were necessary based on the current state of the branch. 🤖 Analysis Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds a shared admission report across REST, MCP and CLI, with substantial documentation and focused tests. It needs changes before merge because two deferred-work counting paths can report zero while capacity-deferred jobs remain pending. ✅ Shared reporting implementation — REST and MCP use the same report builder, and the CLI consumes its API response. ✅ Explicit visibility filtering — Task identifiers are filtered against existing tasks and MCP repository permissions; demo responses omit task and repository identifiers. ✅ Admission accounting coverage — Added tests cover contention, nested executions, expired holders and identifier redaction. This review used static analysis of the supplied code only; no commands were run. Current checks show 34 passed, none failed and one pending. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Fleet can miss deferred jobs beyond the scan limit
F2: 🔴 Removing a ceiling hides existing deferred jobs
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Verify worker heartbeat freshnessThe report sums every member of ScoreThe implementation has strong shared contracts and useful tests, but deferred-work undercounts undermine its operational purpose. Both blockers appear fixable locally; the pending validation check remains outstanding. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit c00fa4a
Summary of ChangesI fixed both findings. Each new regression fails on the old code and passes now. F1: Fleet's
F2: removing a ceiling hid that agent's deferred jobs (
I also added three sentences to Verification
Separate issue I noticed but didn't fix: an agent's waiting-list entries are removed only by the wake-up code or when the job ends. After a ceiling is removed, the wake-up code no longer runs for that agent, so its stale entries stay in Redis. The report now ignores them, but they are never deleted. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
… code and passes now. I fixed both findings. Each new regression fails on the old code and passes now. **F1: Fleet's `deferred` count stopped at 10,000 jobs** (`packages/api/routes/queueRoutes.ts`) - `countCapacityDeferredJobs` no longer has a scan limit. It reads every delayed job ID in one call, then loads the jobs 500 at a time. So it always counts the whole delayed set and can't return `0` while a capacity-deferred job is still waiting. - The single ID read also closes a gap the old page-by-page scan had. When a job left the delayed set between pages, later jobs moved up a position and could be skipped. Now a job that's gone by the time it's loaded has left the delayed state and is simply not counted. - New tests in `packages/api/test/queueRoutes.test.ts`: - 10,000 ordinary delayed jobs followed by one capacity-deferred job. The count must be 1; the old code returned 0. - Jobs that vanish between the ID read and the load. - I updated the Fleet wiring test's mock queue in `hostedFleetRoutesWiring.test.ts` to the new read calls. **F2: removing a ceiling hid that agent's deferred jobs** (`packages/core/src/agents/agentRunAdmissionSnapshot.ts`) - The report used to check only agents that currently have a ceiling. It now looks up every agent that has a list of jobs waiting for capacity, whether or not it still has a ceiling. An agent whose ceiling was removed stays in the report, with `ceiling: null`, as long as any of its jobs are still delayed. Once none are, it drops out. - A job is counted for an agent only if the job still waits for that agent, using the same rule the wake-up code applies. Without this, a job whose latest refusal names only another agent would be wrongly counted under the removed one. Nothing ever cleans up the waiting list of an agent whose ceiling is gone, so those entries stay there. To share the rule, I exported it from `agentCapacity.ts` as `jobWaitsForAgentCapacity`, along with a key-prefix helper. - New test in `test/agentRunAdmissionSnapshot.test.ts`: defer jobs, remove one ceiling and then the last, and read the report before their delay expires. The jobs stay counted globally and per agent until they leave the delayed state. The old code crashed on this test. I also added three sentences to `docs/docs/operations/agent-run-capacity.md` describing both behaviours. **Verification** - The admission snapshot, capacity deferral, alias occupancy and admission route suites ran against a real Redis 7.2 that I built from source: 24 passed, 0 skipped. - `queueRoutes.test.ts` passes, `hostedFleetRoutes.test.ts` passes, and lint and the core and API type checks are clean. - Two tests in `hostedFleetRoutesWiring.test.ts` fail: "rate-limits requests before Fleet and OAuth authentication" and "omits every hosted route when Fleet control is disabled". Both get a 404 instead of a 401 from `/api/internal/hosted/bootstrap`. They fail the same way with the branch's original files restored, so this change didn't cause them. **Separate issue I noticed but didn't fix:** an agent's waiting-list entries are removed only by the wake-up code or when the job ends. After a ceiling is removed, the wake-up code no longer runs for that agent, so its stale entries stay in Redis. The report now ignores them, but they are never deleted. PR: #3519 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds a shared admission report across REST, MCP, and CLI, with substantial tests and operator documentation. It needs minor corrections before merge: unavailable repository data can appear as zero usage, and repository results are silently capped. ✅ Shared report and access filtering — REST and MCP use the same report builder, with task and repository visibility applied before returning identifiers. ✅ Nested occupancy accounting — The tally follows the admission script’s distinction between top-level holders, same-agent nested executions, and nested executions charged against another agent’s ceiling. ✅ Focused integration coverage — Added tests exercise contention, expired holders, removed ceilings, redaction, and real Redis bookkeeping. This assessment uses static tracing of the supplied code; no commands were run. The authoritative checks show 32 passed, two pending, and no failures. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F3: 🔴 Report unavailable repository usage explicitly
F4: 🔴 Do not silently omit repository limits
SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Distinguish configured and stored generationThe snapshot derives the global limit and generation from the API process’s configuration without reading Redis’s stored admission identity. During a rollout, showing both would help operators distinguish desired configuration from the generation currently installed in admission. This is an optional diagnostic improvement; the supplied documentation already requires coordinated configuration changes. S3: 🟢 Track worker heartbeat freshnessThe existing worker producer expires the entire membership set and capacity hash, so surviving workers can keep a crashed worker’s entry alive. The new report inherits that limitation when summing “live” capacity. A follow-up could add per-worker freshness; the underlying heartbeat issue predates this PR. ScoreThe implementation is cohesive and well tested, but two reporting paths can give operators incomplete or misleading capacity information. Both require localized corrections; current checks have no reported failures. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit e8c1f70
Summary of ChangesI fixed both findings. Each new regression fails on the old code and passes now. F3: unavailable repository usage now says so
F4: no repository is dropped
New tests
Results
Separate discovery (not changed): repository rows are still filtered by what the caller may see. A REST demo viewer, or an MCP caller whose grant leaves out the busy repositories, gets an empty list and "none in use" even though work is running. That comes from the redaction design rather than a failed read, so I left it alone. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
… code and passes now. I fixed both findings. Each new regression fails on the old code and passes now. **F3: unavailable repository usage now says so** - The snapshot has a new field, `repositoryWorkflowSlotsUnavailable`. It is set whenever repository usage could not be read from Redis: in the per-read catch and in the outer connection-failure catch. A successful read that finds nothing leaves it unset, whether admission is on or off. - I found the same defect in a third place, the invalid-configuration branch. It returned `repositoryWorkflowSlots: []` without reading Redis at all. It now reads the repository slots like the other branches do, and still reports the configuration error under `unavailable`. - The report contract now has an optional `repositoryWorkflowSlots.unavailable` in `buildAgentRunAdmissionReport`, the Zod schema and the CLI types. The OpenAPI spec and client types are regenerated. - `propr admission` now prints `Repository workflow slots: unavailable: <reason>.` in that case. It prints "none in use under a limit." only when the read succeeded and found nothing. **F4: no repository is dropped** - `repositoryWorkflowSlotUsage` now scans until Redis says the scan is finished. I removed `maxRepositories` and the `.slice`, so the list is the complete inventory and no truncation marker or paging is needed. The per-repository reads now go in parallel batches of 100. - The schema description, the report label and the operator doc now say the list is complete, and the doc explains the new `unavailable` field. **New tests** - In `test/agentRunAdmissionSnapshot.test.ts`, against a real Redis 7.2.6: - 520 repositories with a limit plus 120 without one. The ones without a limit sort first, so the old bound would have used up its 500 places on them. All 520 limited repositories are listed. - Redis unreachable with admission off, on, and with an invalid configuration: each reports the repository usage as unavailable. - A successful read is not marked unavailable, and a bad configuration still returns repository slots. - `packages/api/test/agentRunAdmissionRoutes.test.ts`: the `unavailable` reason reaches the REST response and passes the published schema. A successful empty read carries no `unavailable`. - `admissionCommands.test.ts`: an unreadable result prints "unavailable"; an empty successful one prints "none in use". **Results** - The snapshot suite passes 8/8. On the old core code, the three changed or new tests (6–8) fail. - The API route suite passes 6/6 and the CLI suite 6/6. - Typecheck is clean for core, api and cli. - ESLint with zero warnings passes for core and api. The CLI package has no ESLint config, so its files are skipped. - `gen:openapi:check` and `check:client-contract` are clean. **Separate discovery (not changed):** repository rows are still filtered by what the caller may see. A REST demo viewer, or an MCP caller whose grant leaves out the busy repositories, gets an empty list and "none in use" even though work is running. That comes from the redaction design rather than a failed read, so I left it alone. PR: #3519 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThis PR provides a shared admission report through REST, MCP and CLI, with extensive documentation and focused tests. It needs a localized correction before merge: deferred-job lookup failures can produce a successful report that understates pending work. ✅ Access filtering — REST suppresses demo task references, while MCP checks both repository grants and repository policy before exposing task IDs or repository slots. ✅ Admission accounting — The tally separates top-level holders from nested executions and preserves cross-agent ceiling charges, matching the supplied admission script. ✅ Explicit unavailable states — Repository-slot failures and most admission failures are distinguished from empty capacity. This review used static tracing of the supplied code; no commands were run. Authoritative checks show 34 passed, none failed, and one pending. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F5: 🔴 Deferred lookup failures report false zero
SuggestionsThese are optional follow-ups and are not sent to S4: 🟢 Measure large-queue report latencyThe admission report loads deferred waiters serially, potentially making two Redis requests per waiter. Fleet collection also loads every delayed job, although in concurrent batches. Benchmark these paths with realistic large queues and consider bounded concurrency or pipelining while preserving complete counts. This is an optional performance follow-up; the supplied evidence does not establish a production latency failure. ScoreThe shared implementation, authorization filtering and coverage are strong, but the false-zero failure path undermines the report’s operational reliability. A small correction and focused regression test should address the blocker. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 84fd00d
Summary of ChangesI fixed F5. If BullMQ fails while looking up a deferred job, the admission report now says admission state could not be read from Redis. Before, it reported zero deferred jobs. Fix ( Similar code checked: the Fleet queue counter ( Regression ( Verification:
There's nothing visual in this change, so I made no previews. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…, the admission report now says admission state could not be read from Redis. Before, it reported zero deferred jobs. I fixed F5. If BullMQ fails while looking up a deferred job, the admission report now says admission state could not be read from Redis. Before, it reported zero deferred jobs. **Fix** (`packages/core/src/agents/agentRunAdmissionSnapshot.ts`, `deferredWaiters` → `isDelayed`): I removed the `try/catch` that turned a failed lookup into `false`. When `queue.getJob(...)` or `job.isDelayed()` fails, the error now reaches the existing handler in `readAgentRunAdmissionSnapshot`. That handler returns `unavailable: 'Admission state could not be read from Redis'` with no `global` section and no per-agent counts, so no zero is reported. Lookups that do succeed behave as before: a malformed entry, a missing or finished job, a job now waiting for a different agent, or a job that is no longer delayed still counts as not deferred. The existing test for those cases still passes. **Similar code checked:** the Fleet queue counter (`countCapacityDeferredJobs` in `packages/api/routes/queueRoutes.ts`) has no catch, so its `getJob` failures already propagate. The only other swallowed error in the files this PR changed is the deliberately ignored write of the wait-reason record in `agentRunAdmissionWait.ts`. That's not a read the report relies on, so I left it alone. **Regression** (`test/agentRunAdmissionSnapshot.test.ts`): the new test uses real Redis. It sets up one agent with a ceiling and one delayed job, and first checks the report shows `deferred: 1`. It then forces a real Redis `WRONGTYPE` error after the job has already been found, once in `getJob` (the job's hash is replaced) and once in `isDelayed` (the queue's delayed set is replaced). Each time it checks that the report is marked unavailable and has no global or per-agent deferred count. **Verification:** - The full snapshot suite passes against a Redis 7.2.5 built from source, with the run set to fail rather than skip if Redis is missing: 9 pass, 0 skipped. - With the old `isDelayed` put back, the new test fails (`unavailable` is `undefined`). - ESLint with zero warnings allowed and `tsc --noEmit` both pass on `packages/core`. There's nothing visual in this change, so I made no previews. PR: #3519 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR provides a shared admission report through REST, MCP, and CLI, with substantial tests and operator documentation. It needs a localized correctness fix before merge: the reported global configuration is not checked against the configuration actually stored in Redis. ✅ Shared reporting path — REST and MCP use the same report builder, and the CLI consumes the REST response. ✅ Explicit visibility filtering — Task references and repository entries are filtered separately from aggregate counts, including demo-viewer redaction. ✅ Unknown-state handling — Redis read failures produce explicit unavailable states rather than misleading empty repository usage. The supplied current-head status has no failures; two checks remain pending. This review uses static analysis only, as requested. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F6: 🔴 Validate the reported global configuration
SuggestionsThese are optional follow-ups and are not sent to S5: 🟢 Batch deferred-job inspection
ScoreThe shared implementation, redaction, documentation, and tests are strong, but reporting unchecked global configuration undermines the report’s diagnostic purpose. The remaining correction appears localized; current checks show no failures. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit dc7115f
Summary of ChangesI fixed F6. The admission report now reads the configuration stored in Redis and says plainly when admission will refuse every launch. Before, it showed the process's own limit as free capacity, e.g. What changed
One related case I fixed too: if no configuration is stored but holder records remain, admission also refuses every launch ("configuration missing; drain before recovery"). The report used to present that as normal capacity as well. It now reports One case the report still can't catch: if the Docker daemon itself changes, admission refuses, but the report still says Tests
The new tests fail on the old code, since it had no
Typecheck is clean for core, API, CLI and the repo root. ESLint with zero warnings is clean for core and API; the CLI package has no ESLint config, so its files aren't linted. There are no visual previews, since nothing in the UI changed. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…n stored in Redis and says plainly when admission will refuse every launch. Before, it showed the process's own limit as free capacity, e.g. `0/5`.
I fixed F6. The admission report now reads the configuration stored in Redis and says plainly when admission will refuse every launch. Before, it showed the process's own limit as free capacity, e.g. `0/5`.
**What changed**
- **Same read.** The snapshot script now reads the stored config key along with the holders, waiting set and details, so the result is one consistent view. Only the stored limit and generation are taken out of it; the Docker daemon identity is never returned.
- **New field.** `global.configuration` holds `{ status, admitting, stored: { limit, generation } | null }`. It is built by a new small module, `packages/core/src/agents/agentRunAdmissionConfigState.ts`, which follows the same rules as the admission script. `status` is one of:
- `current`: the stored limit and generation match this process's.
- `uninitialized`: nothing is stored yet; the first admission will store it.
- `pending_generation`: this process has a higher generation. This is a valid transition: the next admission attempt fences the older reservations, then switches.
- `mismatch`: same generation with a different limit, a lower generation (including a rollback to the old number), or an unreadable stored record. `admitting` is `false`.
- **Where it shows.**
- **REST:** the field is in the response, with an updated schema and regenerated OpenAPI and client types.
- **MCP:** the summary now reads "refuses every launch: stored configuration mismatch (limit 3, generation 0) vs configured limit 5, generation 0" instead of "0/5 in use". A pending transition is noted too.
- **CLI:** `propr admission` prints `refused` in the limit column, plus a line explaining the cause and the fix (a higher generation). It also prints a line for a pending generation change.
- **Docs:** the capacity page, the architecture page and `docs/mcp.md` describe the field. The global-limit procedure now says the report shows `mismatch` while blocked, and `pending_generation` then `current` during a change.
**One related case I fixed too:** if no configuration is stored but holder records remain, admission also refuses every launch ("configuration missing; drain before recovery"). The report used to present that as normal capacity as well. It now reports `status: missing` with `admitting: false`.
**One case the report still can't catch:** if the Docker daemon itself changes, admission refuses, but the report still says `current`. Detecting that would mean querying Docker from the report endpoint, which it doesn't do. The docs say so.
**Tests**
- **New real-Redis test** in `test/agentRunAdmissionSnapshot.test.ts`. It runs the scenario from the finding: start at limit 3, generation 0, and drain. It then:
- restarts at limit 5 with the same generation: admission refuses with `configuration/daemon mismatch` and the report shows `mismatch`.
- raises the generation: `pending_generation` until admission switches, then `current`.
- rolls back to the old generation number: `mismatch`.
- stores an unreadable record: `mismatch`.
- deletes the config while a holder remains: `missing`.
At each step the test runs real admission alongside the report, so the two are shown to agree. It also checks the daemon identity never appears in the report.
- **New tests for the API and CLI output** in `packages/api/test/agentRunAdmissionRoutes.test.ts` (REST plus the MCP summary) and `packages/cli/src/commands/admissionCommands.test.ts` (table and text).
The new tests fail on the old code, since it had no `configuration` field. Against a real Redis 7.2, everything passes with nothing skipped:
| Suite | Result |
| --- | --- |
| Snapshot | 10/10 |
| `agentRunAdmission` | 28 |
| `agentRunAliasAdmission` | 10/10 |
| API routes | 7/7 |
| CLI | 7/7 |
Typecheck is clean for core, API, CLI and the repo root. ESLint with zero warnings is clean for core and API; the CLI package has no ESLint config, so its files aren't linted. `gen:openapi:check` and `check:client-contract` are clean.
There are no visual previews, since nothing in the UI changed.
PR: #3519
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
|
CI failed: Full Test Suite Shard 3/4 Please investigate and fix this CI failure.
Failure evidence
|
|
✅ Applied the requested follow-up changes in commit 673469d Summary of ChangesI fixed the Shard 3/4 failure. One test failed, and the cause was a docs change on this branch. Cause:
Fix: I added the three words to the test's non-tool list, with a comment saying they come from Verification: I ran Shards 2/4 and 4/4 and Validate Changes also show as failed in the same run. Their logs end in "The operation was canceled." with no failing test, which fits them being cancelled after Shard 3 failed rather than failing on their own. No visual preview, since nothing in the UI changed. 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…se was a docs change on this branch. I fixed the Shard 3/4 failure. One test failed, and the cause was a docs change on this branch. **Cause:** `packages/api/test/mcpObservableSurface.test.ts` reads `docs/mcp.md` and checks every lowercase word in backticks. Each one has to be an MCP tool the admin can see, or appear on the test's list of words that aren't tools. The last commit (F6) added three such words to the `get_agent_run_admission` section of the docs: `admitting`, `mismatch` and `missing`. They weren't on that list, so the test failed: > docs/mcp.md names admitting, but it is neither an admin-visible tool nor an explicit non-tool token **Fix:** I added the three words to the test's non-tool list, with a comment saying they come from `get_agent_run_admission`'s stored-configuration check. This follows the pattern the list already uses for other tools' field and state names. The docs are unchanged. **Verification:** I ran `node scripts/run-test-suite.mjs packages/api/test/mcpObservableSurface.test.ts` and the test passes (1/1). It is the only test that reads `docs/mcp.md`. Shards 2/4 and 4/4 and Validate Changes also show as failed in the same run. Their logs end in "The operation was canceled." with no failing test, which fits them being cancelled after Shard 3 failed rather than failing on their own. No visual preview, since nothing in the UI changed. PR: #3519 Comment by: @propr-dev[bot] (ID: 6844872595) Model: Claude Opus 5.5
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds a shared admission report across REST, MCP and CLI, with substantial contract, authorization and Redis integration coverage. It needs a localized correction before merge: report cleanup can permanently erase attribution for a live waiting launch. ✅ Shared reporting contract — REST and MCP use the same report builder, with an explicit schema and generated client types. ✅ Scoped disclosure — MCP filters task IDs and repository names through both grant membership and repository policy; the demo REST response suppresses these details. ✅ Unknown-state handling — Redis read failures are distinguished from empty capacity, and stored configuration mismatches are surfaced explicitly. The supplied current-head status shows 34 passed checks, no failures and one pending check. This review used static analysis only; no commands were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F7: 🔴 Restore details when an expired waiter rejoins
SuggestionsThese are optional follow-ups and are not sent to S6: 🟢 Batch deferred waiter lookups
ScoreThe implementation is cohesive and well covered, but a reachable cleanup/recovery sequence breaks the report's central attribution behavior. The correction is localized; supplied checks otherwise show no current failures. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit aecc8a7
Summary of ChangesThat notice is only the progress watch timing out. The suite run it was following had already finished: all 11 related files passed with nothing skipped, so I've left it stopped. F7 is fixed and nothing else is outstanding. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…e run it was following had already finished: all 11 related files passed with nothing skipped, so I've left it stopped. F7 is fixed and nothing else is outstanding. That notice is only the progress watch timing out. The suite run it was following had already finished: all 11 related files passed with nothing skipped, so I've left it stopped. F7 is fixed and nothing else is outstanding. PR: #3519 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds a shared admission report across REST, MCP and CLI, with supporting diagnostics and operator documentation. It is merge-ready within the reviewed scope, conditional on the pending validation check completing successfully. ✅ Shared reporting contract — REST and MCP use the same report builder, with a typed OpenAPI schema and CLI coverage. ✅ Scoped disclosure — Task and repository details are filtered separately from aggregate counts; MCP checks both repository grants and current policy. ✅ Explicit unavailable states — Redis failures and configuration mismatches are distinguished from idle capacity, including in CLI and MCP presentation. This was a static review of the supplied diff and context; no commands were run. The authoritative checks show 34 passed, zero failed, one pending and 11 neutral/skipped. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S7: 🟢 Measure report collection cost
S8: 🟢 Clarify snapshot consistencyThe holder, waiting and configuration records are captured atomically, but deferred jobs, repository slots and worker counts are collected separately. Consider qualifying the documentation’s “Everything is exact” statement to explain that these sections can reflect different moments during concurrent transitions. The implementation already preserves the central admission snapshot; this clarification would help consumers interpret transient cross-section discrepancies. ScoreThe implementation provides substantial coverage, careful disclosure filtering and useful failure reporting. No merge-blocking defect was verified in the supplied changes, and the current checks report no failures. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
AI Implementation Summary
Closes #3481
Branch:
3481/claude-opus-5-5-report-admission-capacity-20261113-0215-dfvCommits: ✅ Changes committed (a42569b)
AI Processing Completed
Execution Details:
Summary:
I've added one capacity report for issue #3481. It's served three ways:
GET /api/agent-run-admission, the MCP toolget_agent_run_admission, andpropr admission(a table, or--json). The new suites pass, and so do the existing admission, capacity and deferral suites, run against a real Redis 7.2 with nothing skipped.What the report shows
PROPR_AGENT_RUN_LIMITor the Hosted entitlement), the generation and the nested limit.Redaction
How the reasons get recorded
agentAlias(null when the launch has no alias) andwaitReason. The admitted line also includeswaitedMs.Other acceptance criteria
Waiting for agent capacity: <alias> (limit N). If the refusal doesn't carry the ceiling, it is taken from the configuration. A later wait on a different agent or ceiling now starts a new row instead of rewording the old one./api/internal/hosted/queuenow adds adeferredcount of jobs delayed for agent or repository capacity; retry backoffs are not counted.docs/docs/operations/agent-run-capacity.md. It covers each limit and how they combine, settingPROPR_AGENT_RUN_ALIAS_LIMITS, raising or lowering ceilings with no drain (running work is never stopped), the global-limit procedure (generation bump, drain first, rollback with a new higher generation), and rolling restarts with mixed versions. I also updated the architecture page, the configuration reference, the CLI page,docs/mcp.md,docs/mcp-coverage.mdand the regenerated settings page.gen:openapi:checkandcheck:client-contractare clean. The settings catalog entry now points to the new tool and command.Things to know
deferred: the field is additive, so Fleet keeps working, but its drain logic has to treatdeferred > 0as pending work. An older API won't send the field, so treat a missing value as unknown, not zero.agentRunAdmission.tsinto a newagentRunAdmissionWait.ts, to stay within the lint complexity and file-length limits.packages/api, they hang at exit.New tests
test/agentRunAdmissionSnapshot.test.ts(real Redis): counts under contention, the split of wait reasons, nested executions, recovering holders, deferred-job filtering, redaction, admission off, Redis unreachable.packages/api/test/agentRunAdmissionRoutes.test.ts: task visibility in REST, MCP and for the demo viewer, the disabled case, the error response, and checks against the published schema.packages/cli/src/commands/admissionCommands.test.ts: the table, admission off, and the JSON output.test/agentCapacityTimelineRow.test.ts: the timeline row naming the agent and ceiling.I didn't create visual previews, since nothing here changes the UI.
Detailed Logs:
19cf08fe-72f5-4ae4-be71-2070ab5663c4Log files stored at:
/usr/src/app/logs/executions/issue-3481-2026-11-13T02-53-48-996Z-conversation.json/usr/src/app/logs/executions/issue-3481-2026-11-13T02-53-48-996Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #3481.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!