Repository navigation
[Epic] Per-agent concurrency ceilings alongside the global admission limit - #3493
Conversation
…as the global limit, so the existing reserve / attach / fence / recover lifecycle covers them unchanged. The new suite (10 tests) passes against a real Redis 7.4.11 I built locally, three runs in a row. The existing `agentRunAdmission.test.ts` (27 tests) and the related suites pass too. Typecheck (root, core, API) and `eslint --max-warnings 0` (core, API, root `src/`) are clean. Nothing ran against real Docker; the tests use the existing Docker simulator. Admission script (`agentRunAdmission.ts`) - `acquire` now takes the alias and its ceiling. It counts that alias's holders in the loop that already decodes every record for the recovering check, so it's still one `EVAL`. - New holder records store `alias`. Every other operation decodes and re-encodes the whole record, so the field survives. - Records written before the upgrade (no alias) count toward the global limit only. - A recovering holder still blocks every acquire until its removal is confirmed, so alias capacity is never reused early. - `acquire` now replies with distinct codes: `global_limit`, `alias_limit` or `recovering`. The wait loop logs each change of reason, and callers can get it through a new `onWaiting` option. - Ceilings are not part of the fenced configuration identity. Each acquire passes the current value, so changing one needs no generation bump and no drain. Policy (`agentRunAliasLimits.ts`, `agentRunAdmissionPolicy.ts`) - Format is `PROPR_AGENT_RUN_ALIAS_LIMITS=local-llama=1,claude-prod=3`; unset or blank means no policy. - Rejected values: anything malformed, a duplicate alias, a value that isn't a positive integer, a ceiling above the global limit (it could never bind), and any policy while admission is off. - Worker and API startup refuse to start if the policy names a synthetic alias or one that isn't a configured direct agent. Disabled agents count as configured; `default` is accepted when no direct agents exist. - On `agents_update` / `synthetic_agents_update`, both processes re-check and log an error instead of crashing. - Because ceilings come from each process's environment, a change takes effect after restarting the processes. Carrying the alias to the boundary - All five agent implementations pass `agentAlias: config.alias` to `executeDockerCommand`. The three native goal paths pass it to `spawnWithNetworkPolicy`. - With a policy configured, a launch that names no agent fails before touching Redis. - The paths that launched without a registered alias, now listed in the architecture doc: | Path | Identity | | --- | --- | | Legacy Claude analysis (`executeClaudeCode`) | Exempt (`legacy-claude-analysis`): no registered agent runs, so it counts toward the global limit only. | | Health checks | The saved agent's alias. The probe always runs a saved configuration; I found no unsaved-config path. | | Implicit default agent | Alias `default`. | Tests (`test/agentRunAliasAdmission.test.ts`) - It uses a spawned `redis-server` if one exists, otherwise `REDIS_HOST`/`REDIS_PORT` with keys unique to the run (CI provides a Redis container rather than the binary). - With `PROPR_REQUIRE_REDIS_INTEGRATION=1` and no Redis it fails; without the flag it skips. I checked all three cases. - The multi-process test starts 7 processes across the standard and native entrypoints. It samples Redis throughout to confirm neither ceiling is ever exceeded. - Other cases cover: - a saturated alias not blocking another alias - the three wait reasons - no leak or early reuse after cancellation, create failure, crash, lease loss and repeated finish - changing a ceiling with no change to the stored identity - old records without an alias - unchanged holder data when no policy is set - To check the tests catch a real bug, I removed the alias-ceiling line from the script: four tests failed and the contention test hung until the timeout. The line is restored. - The existing worker fixture now accepts an optional `PROPR_TEST_AGENT_ALIAS`; when it's unset it behaves as before. Other changes - To keep `src/worker.ts` under the 400-line lint limit, I moved `refreshAgentRegistryForConfigUpdate` into `src/workerAgentPreparation.ts`. - `src/workerAgentPreparation.ts` and `packages/api/server.ts` import the new validation functions lazily. Some suites mock `@propr/core` with a fixed export list, and a static import would break them. - Docs: a "Per-agent ceilings" section in the architecture doc, including what to expect during a rolling restart. Processes still on the old version don't send an alias, so they can admit work on an alias that's already at its ceiling until every process is upgraded. - New `PROPR_AGENT_RUN_*` rows in the configuration reference, an `.env.example` entry, and a settings-catalog entry with the regenerated settings page. There are no visual changes, so I made no previews.
…tional-per-agen-20261112-1222-anp [3478 by Claude Opus 5.5] Enforce optional per-agent ceilings atomically in the agent-run admission script
…had already finished. No test failed because of this change, so my earlier summary stands.
…ferred forever. It now gets through to admission, which recovers the dead holder and then runs the job. I fixed F1: a job whose agent's holder died is no longer deferred forever. It now gets through to admission, which recovers the dead holder and then runs the job. **Cause.** The capacity pre-check counted every holder record for the alias. A holder whose lease had expired, or one already marked `recovering`, still counted, so every job for that alias was deferred before it reached the admission loop. That loop is the only place recovery runs, so nothing could ever free the slot. **Fix** (in `packages/core/src/agents/agentCapacity.ts`): - **New read-only helper.** `agentAdmissionAliasOccupancy` splits each alias's holders into `live` and `recoverable` (lease expired, or `recovering`). It uses Redis server time, the same clock the admission script uses to expire leases. - **Pre-check counts only live holders.** If a job only meets recoverable holders, it goes on to the normal acquire. That calls `recover`, which removes the recorded container before releasing the holder, so a slot is still never reused until removal is confirmed. If removal fails, the slot stays held, as before. - **The two other callers get the same rule.** Synthetic routing goes through the same pre-check. The wake-up on release (`wakeAgentCapacityWaiters`) now counts only live holders when working out free slots, so a woken job can be the one that does the recovery. - **No change to the admission script.** `agentRunAdmission.ts` is untouched; I moved the helper out of it because it pushed the file over the 400-line lint limit. - **Docs.** `docs/docs/architecture/agent-run-admission.md` now explains the live-holder rule for the pre-check and the wake-up. **New test** in `test/agentCapacityDeferral.test.ts`, run against a real Redis 7.4.1 and BullMQ: 1. A holder on a ceiling-1 alias "dies": its lease renewal never completes and it never calls `finish()`. 2. A job for that alias is deferred while the holder is still live, and the wake-up finds no free slot. 3. After the lease expires, the holder record is still there, but the pre-check reports room and the wake-up promotes the waiting job. 4. The job runs. The dead container is removed before the job's own container is created, it used one attempt, and its deferral data is cleared. 5. A later job for the same alias runs without being deferred, and no holder records are left. With the old pre-check put back, this test fails while the other five in the file pass. **Verification:** - `agentCapacityDeferral` passed 6/6 three times in a row. - Related suites pass: `agentRunAliasAdmission` (10), `agentRunAdmission` (27), `reviewCapacityRouting` (2), and core's `syntheticRoutingCapacity` and `syntheticRoutingService` (19). - Typecheck (root and core) and `eslint --max-warnings 0` on the core agents directory are clean. One unrelated flaky test: in one of three `agentRunAdmission` runs, "caller deadline during create removes the ID without starting it" timed out at 15 s. It forks worker processes, doesn't depend on any file I changed, and passed 4 more times in a row both with and without this fix. There's no visual preview because nothing in the UI changed. PR: #3497 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
…'t been updated for a new import on this branch, not a bug in the code. I fixed the Shard 1/4 failure. It was a test mock that hadn't been updated for a new import on this branch, not a bug in the code. **Cause.** One test failed: `executor and native goal admission retain create and final argument secrets` in `packages/core/test/managedDiagnostics.test.ts`. It replaces `agentRunAdmission.ts` with a mock that only provides `prepareAdmittedAgent`. The last commit made `agentCapacity.ts` import `agentAdmissionKeys` and `resolveAgentRunAdmission` from that module. With the mock in place, the native-goal path failed to load with `does not provide an export named 'agentAdmissionKeys'`. **Fix.** I added simple stand-ins for those two functions to the mock. `agentAdmissionKeys` returns the three instance keys and `resolveAgentRunAdmission` returns `null`. `test/nativeGoalLaunchBoundary.test.ts` mocks the same module in the same partial way, so I added the same two stand-ins there too. No source code changed. **Verification.** - `packages/core/test/managedDiagnostics.test.ts`: all 33 tests pass, including the one that failed in CI. - `test/nativeGoalLaunchBoundary.test.ts`: all 11 tests pass. I didn't run these two files with the old mock to watch them fail locally; the CI error is what points to the missing exports. I also ran eslint on both files, but it printed only an npm notice, so I can't confirm the lint check passed. There's no visual preview because nothing in the UI changed. PR: #3497 Comment by: @propr-dev[bot] (ID: 6830744846) Model: Claude Opus 5.5
… came from a test mock that didn't match a new import on this branch, not from a bug in the deferral logic. I fixed the Shard 4/4 failure. Like the Shard 1 failure, it came from a test mock that didn't match a new import on this branch, not from a bug in the deferral logic. **Cause.** Two files failed before running any tests: `test/checkRunHandler.test.ts` and `test/followupAssignmentGate.test.ts`. Both replace `bullmq` with a mock that only provides `ErrorCode`, `Queue`, `QueueEvents` and `Worker`. This branch's `packages/core/src/agents/agentCapacity.ts` imports `Job` from `bullmq` to wake jobs waiting for capacity, so loading it failed with `The requested module 'bullmq' does not provide an export named 'Job'`. **Fix.** I changed the source rather than the mocks. The wake-up code now uses `queue.getJob(jobId)`, which returns the same job (or nothing) as `Job.fromId(queue, jobId)`, and the `Job` import is gone. Three more root suites (`commentEventHandler.ultrafix`, `mergeConflictDetector`, `deliveryInterestHandlerGuard`) mock `bullmq` the same way, so this covers all of them without editing five test files. Only `agentCapacity.ts` changed. **Verification.** - `checkRunHandler` (145 tests) and `followupAssignmentGate` (51 tests) both pass now, as do the other three suites with the same mock. Two of those first failed with read-only `/tmp/git-processor` errors, which this container is known for. With the clone paths moved to a writable directory, they pass. - I ran `agentCapacityDeferral` against a real Redis 7.4.1 I built locally, with Redis marked as required so it couldn't skip. Its 6 tests cover the `getJob`/`promote` wake path and pass. The related suites pass too: `syntheticRoutingCapacity`, `processAgentRunJob`, `processGoalJob`, `reviewCapacityRouting` and `taskSubmissionLifecycle`. - The core typecheck reports no errors, and `eslint --max-warnings 0` passes on the changed file. I didn't rerun the full shard locally, and nothing ran against real Docker. There's no visual preview because nothing in the UI changed. PR: #3497 Comment by: @propr-dev[bot] (ID: 6831323136) Model: Claude Opus 5.5
…tabase connection open, not a problem in the deferral logic. I fixed the Shard 4/4 failure. It was a test that left a database connection open, not a problem in the deferral logic. **What failed.** In `test/processTaskImportJobRetry.test.ts`, all 10 tests passed, but the test process never exited. The runner killed it at its 180s limit and marked the file as failed. **Cause.** Two of the tests this branch added, "a lost race at admission…" and the resumed run in "an import stopped while it waited…", call the real `cleanupWorktree` and ask it to delete the worktree. Before deleting, it checks whether the worktree is still in use. It asks Docker first, and if Docker answers it then queries the database (`packages/core/src/db/connection.js`). Loading that module opens a SQLite connection, and nothing in this test closed it. In CI Docker answers, so the connection opened and kept the process alive. In this container there is no `docker`, so the check stopped before reaching the database, which is why the file passed when run here. **Fix.** The test's `after()` hook now closes the connection (`closeConnection()`) before removing its temp directory. Other suites (`followupHandoffWorktreeRestore.integration`, `llmLoggerPersist`) already do the same. Only that one test file changed. **Verification.** - **CI condition reproduced:** I put a stub `docker` on PATH that reports no running containers. Before the fix, the file hung until a 30s timeout killed it. After the fix it exits in about 3.5s with 10 passed and 0 failed, and the log shows the database query that CI ran. - **No Docker (this container's default):** still 10 passed and 0 failed, about 3.5s. - **Not run:** I didn't rerun the full shard. There's no visual preview because nothing in the UI changed. PR: #3497 Comment by: @propr-dev[bot] (ID: 6831943225) Model: Claude Opus 5.5
… alias, the job now leaves that alias's waiting list, so released capacity goes to the jobs that still wait for it. I fixed F2. When a re-entered job's refusal stops naming an alias, the job now leaves that alias's waiting list, so released capacity goes to the jobs that still wait for it. **Changes:** - **`persistAgentCapacityDeferral`** (`src/jobs/agentCapacityDeferral.ts`): once the new refusal is saved, the job leaves the waiting lists of aliases its previous refusal named and this one doesn't. In the review example from the finding, the review now leaves A's list when only B blocks it. It keeps its original place on B's list. - **`wakeAgentCapacityWaiters`** (`packages/core/src/agents/agentCapacity.ts`): before a waiter uses up a wakeup slot, the wakeup checks which aliases the job's last saved refusal named. If the job is delayed and no longer waits for this alias, its entry is removed and the slot goes to the next waiter. This catches leftover entries, for example if the removal above failed, since that removal is best effort. - **The window you asked about:** a job that isn't delayed may still be in the middle of joining a new alias's list, with its saved data still naming the old aliases. The wakeup skips such a job without counting it but doesn't remove its entry, because removing it would wrongly take the job off a list it just joined. Nothing is missed: right after joining, the job checks capacity itself and schedules a quick retry if the alias has room. That window is avoidable, so I closed it. The remaining overlap between a release and a job joining a list is the race the existing capacity check already covers. - **Related bug, same mistake:** when saving the refusal failed, the old code removed the job from every alias the refusal named. That included lists the job was legitimately on from its previous refusal, whose data was still saved. Now it removes only the lists this attempt newly joined. **Tests:** I added one integration test to `test/agentCapacityDeferral.test.ts`, run against a real Redis and BullMQ queue. It enables a second ceiling, `remote-llama=1`, and covers: - a review blocked on both aliases joins both lists. - a failed save keeps both entries. - re-deferring on remote-llama alone leaves local-llama's list but keeps its place on remote-llama's. - a local-llama wakeup drops an older leftover review entry, keeps the entry of a job that isn't delayed (without counting it), and wakes the real local-llama waiter. The test fails on the old code with either half of the fix reverted on its own, so each half is covered. **Verification:** - The capacity suite passes 7/7. - The related suites pass: alias admission 10, review capacity routing 2, agent run 71, agent action 35, PR publication 30, merge conflict 24, task import retry 10, task submission lifecycle 30. - `tsc` is clean for the root and for `packages/core`, and `eslint --max-warnings 0` is clean on both changed source files. To clear a nesting-depth warning I moved the alias check into a small `waitsFor` helper. No visual preview, since nothing visible changed. PR: #3497 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
… old code, and it reproduced both problems: an agent named `constructor` stayed full after its holder released, and a newer-generation job was turned away by a live older holder. With the fix, both checks give the right answer.
I fixed F3 and F4. Before the fix I ran a probe against the old code, and it reproduced both problems: an agent named `constructor` stayed full after its holder released, and a newer-generation job was turned away by a live older holder. With the fix, both checks give the right answer.
### F3: an alias named `constructor`
- **Occupancy** is now a `Map`, so looking up `constructor` only finds what was actually stored there. The occupancy function also returns a different shape now: `{ aliases: Map, reconciliationPending }` (`packages/core/src/agents/agentCapacity.ts`).
- **Same bug elsewhere in this PR's code, fixed:**
- `agentAdmissionAliasHolders` counted holders in a plain `{}` and could produce a garbage value for `constructor`. It now counts in a `Map`.
- **Ceiling lookup:** a direct agent called `constructor` *without* a ceiling inherited `Object` as its ceiling, so the pre-check always said it was full. Both the pre-check and the admission script's lookup now go through a new `agentRunAliasCeiling` helper that only reads listed entries. The parser also builds the limits in a `Map`.
- **Refusal messages:** they printed `(limit function Object() { [native code] })`, including on the task timeline. Both message builders now only show ceilings that were actually set (`AgentCapacityError` and `refusalReason` in `src/jobs/agentCapacityDeferral.ts`).
### F4: a newer generation reaching reconciliation
- The occupancy script now reads the stored admission configuration in the same Redis call as the holders. It reports when the stored generation is older than the caller's.
- In that case the pre-check counts no holders, so the job gets through to the acquire. Fencing and draining stay where they were: the acquire's recovery step marks the old holders, removes their containers, and only then admits.
- The wake-up after a release uses the same rule. A newer-generation process now wakes a waiter even while older holders are still live.
- **Unchanged cases:**
- An older process whose generation has been superseded still counts holders normally.
- A different limit at the same generation still counts normally. The acquire rejects that mismatch anyway.
- An unreadable stored configuration counts normally and is left for the acquire to reject.
- **Callers covered:** direct-agent jobs, synthetic member selection and the deferral retry path all go through `agentAliasHasCapacity`, so the one fix covers them.
### Tests and docs
- **New test file** `test/agentCapacityAliasOccupancy.test.ts`, using a real Redis, real BullMQ and the real admission script. It has 3 tests:
- `constructor` with a ceiling of 1: full while held, free again after release; also checks that no shared prototype was changed.
- `constructor` without a ceiling: not capped, and refusal messages are clean.
- A newer-generation job meets a live, renewing older-generation holder: it isn't deferred, either in the pre-check or through `checkJobAgentCapacity`. An old-generation job is still deferred. The new acquire removes the old container before creating its own.
- A waiter is woken by a newer-generation release but not by an older one.
- **Results:** the 3 new tests fail on the old code and pass with the fix. Related suites (alias admission, global admission including the generation upgrade/downgrade cases, repository workflow admission, deferral, native goals, review routing, synthetic routing) also pass: 129 tests, 0 skipped.
- `tsc` passes for the root project and for `packages/core`, and `eslint --max-warnings 0` passes on the changed files.
- I updated `docs/docs/architecture/agent-run-admission.md` to describe the generation rule and the new occupancy signature.
There's no visual change, so I didn't create a preview.
PR: #3497
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…straight to the claim fence and is retired at once, even while its agent is still full. It also leaves the agent's waiting list. I fixed F5. A paused or cancelled goal's delivery now goes straight to the claim fence and is retired at once, even while its agent is still full. It also leaves the agent's waiting list. **The fix** (`src/jobs/goalCapacity.ts`): before checking capacity, `checkGoalAgentCapacity` now applies the same conditions `claimGoalAttempt` uses. The goal must still match this attempt and have no result, have `desired_state === 'running'`, and have `claimed_at` unset. If any of these fails, it skips the capacity check and calls `admitAgentCapacity(job)`. That clears the stored wait counters and removes the job from every alias waiting list it joined. The claim then returns `goal_claim_fence` without another delay. The finding names only paused goals; the same change also covers these other cases the claim would reject: - **Cancelled goals:** they hit the same bug as paused ones and were delayed again. - **Already-claimed attempts:** the claim rejects these too, but the old code still delayed them. - **Superseded attempts:** the old code already returned early here, but it never removed the waiting-list entries. That is the cleanup part of the "minimum correction". **Regression tests** (`test/processGoalJob.test.ts`): one case each for paused, cancelled, superseded and already-claimed. Each uses a real database, the real `checkGoalAgentCapacity` and `claimGoalAttempt`, and a stub capacity Redis where `codex=1` stays fully held. The first delivery is delayed and joins the `codex` waiting list. After the goal changes, the next delivery returns `goal_claim_fence`, is not delayed again, leaves the list, and has its stored wait data cleared. **Verification:** - **Old code:** all four new tests fail. Paused, cancelled and already-claimed are delayed again; superseded hits the fence but stays on the waiting list. - **Fixed code:** the whole of `processGoalJob.test.ts` passes (23/23). - **Lint and typecheck:** `goalCapacity.ts` passes eslint with `--max-warnings 0`, and `tsc --noEmit` is clean. - **Not run:** the Redis-backed `agentCapacityDeferral.test.ts`, because this container has no `redis-server`. **Similar code checked (no change needed):** I looked at the other places that check capacity before starting work: agent report/action runs, task import, issue jobs, PR comment jobs and merge-conflict jobs. Each checks whether the work is still valid (run state, task cancellation or labels) before the capacity check, so none can be delayed indefinitely this way. Their early exits don't remove waiting-list entries either. That is harmless: when an agent frees up, the wake-up step drops entries for finished jobs without using up the wake-up. No visual preview: this change doesn't affect anything a user can see. PR: #3497 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
… so I don't need to restart it. All 28 related suites passed, and my summary above still holds. The monitor timed out after the batch had already finished, so I don't need to restart it. All 28 related suites passed, and my summary above still holds. PR: #3497 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
…-whose-agent-is-20261112-1539-3bs [3479 by Claude Opus 5.5] Defer jobs whose agent is at its ceiling instead of holding a worker, and charge the actual direct agent
…w charged under its parent's slot instead of waiting for it, so a global limit or agent ceiling of one no longer deadlocks. The new real-Redis, multi-process suite and the related existing suites pass. There's one intermittent failure, noted below. The rule (enforced in the admission script) - Global limit: a nested execution never takes a global slot; it is covered by its parent's slot, whichever agent runs it. So a global limit of one with one nested level always admits the child. - Same agent as the parent: charged under the parent's reservation, with no second slot of that agent. - Different agent: counts against that agent's ceiling and waits for it like any launch. - Bounds: depth is 1. At most `PROPR_AGENT_RUN_NESTED_LIMIT` (1–32, default 4) nested executions run under one parent at once. Going over either bound is refused at once with a clear error, never queued under the parent's slot. An invalid value stops the API and worker at startup. - Physical containers: because of this, the container count can exceed the global limit, up to `limit × (1 + nested limit)`. On Hosted, that means more containers than the entitlement. - Parent finishes first: its container is removed, but its slot stays charged until its last nested execution ends, and no new nested execution can join it. - Parent crashes, loses its lease, or is reconciled to a new generation: its nested executions are fenced with it. Their containers are removed before the parent's, and the slot isn't reused until all are gone. Which paths use which rule | Path | Rule | How the parent is identified | | --- | --- | --- | | Tasks an orchestrating goal starts while its session runs | Charged under the goal | The goal container gets `PROPR_PARENT_EXECUTION`, a value derived from the goal ID that stays the same across attempts. The orchestrate instructions ask the agent to put a hidden `<!-- propr-parent-execution: … -->` line in each issue it creates. The dispatcher copies it into the task's job data. | | Semantic `search_repository_files` called by an automation run | Charged under the run | The worker registers the run's MCP grant as the parent; the API recognises that grant on the caller. | | Auxiliary executions inside one job | Normal slot | None run while the main container is alive; they all run before or after it. | No path needed the reject-at-startup fallback. Diagnostics now report `draining` and `nested` counts, a per-parent list of nested executions (`agentAdmissionNestedHolders`), and logs that mark nested admissions. With no parent link, admission decisions and holder records are unchanged. Limitations of the goal path: - It depends on the agent adding the marker. An issue without it is an ordinary task that needs its own slot, as before. - The marker is visible to anyone who can read the issue. A copied marker can only charge work under that goal while its session is live, within the count bound. - Only issue tasks are covered. PR follow-ups a goal triggers through comments (`/fix`, reviews) still take normal slots. Tests - New suite `test/agentRunNestedAdmission.test.ts`: 8 tests, all passing. It covers every case in the acceptance criteria (same agent, other agent's ceiling, parent crash, both bounds, global limit of one), plus lease-loss fencing. With the parent link turned off, the three multi-process cases hang as expected, so the tests do catch the deadlock. - Parent-link tests added to the goal job, dispatcher, automation run and MCP search suites. The MCP one fails when the link is removed. - Existing suites: the admission, per-agent, deferral, goal and dispatcher suites, the MCP suites, and the suites that mock `@propr/core` all pass, as do lint (zero warnings) and `tsc` on root, core and API. - Three existing tests needed a one-line fix. They pick the script's operation out by argument position, and it moved by one because the script now takes a third Redis key. - One intermittent failure: the newer-generation test in `test/agentCapacityAliasOccupancy.test.ts` failed 2 of about 11 runs on my branch, then passed 6 in a row. It relies on a 600 ms lease that must keep renewing during the check. I couldn't link it to this change, but I also didn't check how often it fails on the base branch. - Not done: no live Fleet acceptance; I updated step 3 of the acceptance checklist in the doc to cover nesting. Docs: a new "Nested executions" section in `agent-run-admission.md`, plus `goals.md`, the configuration reference, the regenerated settings page, the settings catalog and `.env.example`. No preview, since nothing visual changed.
…ent no longer blocks the parent's agent. The next queued job on that agent now goes ahead to admission, which recovers the dead child and then frees the parent's slot. I fixed F1: a crashed nested execution under a finished parent no longer blocks the parent's agent. The next queued job on that agent now goes ahead to admission, which recovers the dead child and then frees the parent's slot. **Cause.** The capacity pre-check (`OCCUPANCY_SCRIPT` in `packages/core/src/agents/agentCapacity.ts`) treated a finished parent as fully occupied whenever any nested record pointed at it, even if that child's lease had expired. A shared child isn't counted on its own, so nothing on the alias ever looked recoverable. Every job deferred before reaching admission, which is the only place recovery runs. **Fix.** The pre-check now marks a parent whose nested executions include one that has expired or is being recovered. Such a finished parent counts as recoverable rather than live, so jobs reach admission instead of deferring. The child's agent doesn't matter here: an expired child on another agent blocked the parent's agent the same way, unless jobs happened to arrive for the child's agent. Admission still decides whether the slot can be reused, and it was already correct: it fences the expired child, removes its container, and hands back the parent's slot only after the last child is released. The wake-up path (`wakeAgentCapacityWaiters`) uses the same count, so it now wakes waiters in this situation too. **Regression test.** Two new real-Redis cases in `test/agentCapacityAliasOccupancy.test.ts`, one with the child on the parent's agent (shared) and one with it on a different agent. Each case: 1. Finishes the parent while the child is still running, so the parent is left draining and the agent still reads as full. 2. Expires the child's lease without calling `finish()`, standing in for a dead worker. 3. Sends an ordinary queued job through `checkJobAgentCapacity` and checks it is not deferred. 4. Checks that its admission removes the child's container before creating its own, and that only the new holder is left. Both cases fail on the previous code at the pre-check step and pass with the fix. **Verification.** I built Redis 7.2.5 from source, since the container has none. - Run one file at a time, with no skips: `agentCapacityAliasOccupancy` (5 tests), `agentRunNestedAdmission` (8), `agentRunAliasAdmission` (10), `agentRunAdmission` (27) and `agentCapacityDeferral` (7) all pass. - Running the four other files in one command gave two failures in `agentCapacityDeferral`. That file passes 7/7 alone, with and without the fix, so the failures come from running the files together. - The intermittent newer-generation test the PR already mentions failed once in my first run (before my new tests, which run after it) and then passed 5 runs in a row. - `eslint --max-warnings 0` on the core file and `tsc --noEmit` for core pass. No visual preview, since nothing visual changed. PR: #3514 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
…gAdmission.test.ts` now passes locally, 10 of 10 tests; it had failed 4 of them in CI. I fixed the Shard 3/4 failure. `packages/core/test/nativeLogAdmission.test.ts` now passes locally, 10 of 10 tests; it had failed 4 of them in CI. **Cause:** this branch added a third Redis key (the parents key) to the admission script. That moved the operation name (`acquire`, `release`, `expired`) one position later in the arguments to `client.eval`. The mocked `eval` in this suite still read the operation from the old position. So it never saw `acquire`, and the test that checks one container was created got 0 instead of 1. I missed this suite when I made the same one-line fix in three other suites earlier on the branch. **Fix:** in all four mocked `eval` functions in that file, I added a `_parents` argument before `op` so the operation is read from the right place. No production code changed. I only ran this one suite locally, not the full Shard 3/4 job. I checked the other tests that mock the admission script (`test/agentRunAliasAdmission.test.ts` and `test/agentCapacityDeferral.test.ts`); they were already updated. There's no visual change, so I didn't make a preview. PR: #3514 Comment by: @propr-dev[bot] (ID: 6839795528) Model: Claude Opus 5.5
…now removes the nested containers before the parent's container, and releases them before the parent's slot. It no longer depends on another admission attempt running recovery.
I fixed F2. When a parent loses its lease, its own process now removes the nested containers before the parent's container, and releases them before the parent's slot. It no longer depends on another admission attempt running recovery.
**Cause:** the `fence` operation marked the nested records `recovering` but didn't say which they were. So `finish()` removed only the parent's container, and the nested container kept running.
**The fix**
- **`fence` reply** (`packages/core/src/agents/agentRunAdmissionScript.ts`): when it fences a parent, it now returns `{1, nested token, nested container ID, …}` for every nested execution under that parent. The draining reply (`2`) for normal completion while nested executions still run is unchanged.
- **New `fenceAndStop()` helper** (`packages/core/src/agents/agentRunAdmission.ts`): it fences, removes each nested container, then removes the parent's. `finish()` then releases the nested reservations before the parent's. If any nested removal fails, it throws: the parent's container stays up and every reservation is kept for recovery, the same way `recover()` behaves.
- **Same problem in the renewal path:** when a parent's renewal finds its lease lost, it used to remove only the parent's container straight away, before `finish()` even ran. It now goes through `fenceAndStop()` too, so the nested containers go first there as well.
- **One case can't keep the order:** if Redis can't be reached, the process can't look up the nested executions, so it removes just the parent's container and keeps every reservation, as before.
**Tests** (`test/agentRunNestedAdmission.test.ts`, real Redis)
- **New:** "local cleanup of a lease-lost parent removes and releases its nested execution first, without a replacement admission". The parent's lease is expired and its `finish()` is called directly. The test checks that the nested container is removed first, both reservations are released, and the slot can be used again.
- **New:** "a parent whose renewal finds its lease lost stops its nested execution before its own container".
- **Both new tests fail on the previous code** (wrong removal order), so they catch the bug.
- **Passing:** all 10 tests in the nested suite, plus `agentCapacityAliasOccupancy` (5), `agentCapacityDeferral` (7), `agentRunAdmission` (27), `agentRunAliasAdmission` (10) and `packages/core/test/nativeLogAdmission.test.ts` (10). Core lint passes with zero warnings and core `tsc` passes. To run the Redis suites here, I built Redis 7.4.1 from source in `/tmp`.
There's no visual change, so no preview.
PR: #3514
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…ed now pass locally, and the related admission suites do too. I fixed both failures in Shard 4/4. The two files that failed now pass locally, and the related admission suites do too. Two test files failed in the shard. Both failures were intermittent: the previous commit on this branch passed the full suite. **1. `test/agentCapacityDeferral.test.ts` (tests 4 and 5): a real bug in the admission code** - **What should happen:** when the caller's own timeout ends a wait on an agent's limit, the launch reports a capacity wait (`AgentCapacityWaitTimeoutError`), not a provider timeout. - **The bug:** that only worked if the timeout fired during the short pause between polls. If it fired during one of the Redis calls or the cancellation check in the same loop, the raw `Command timed out after 200ms` error got through. That's what CI saw. - **Why test 5 failed:** test 4 failed before releasing its holder, so test 5 found one slot still taken. - **The fix:** the whole wait loop in `packages/core/src/agents/agentRunAdmission.ts` now reports that timeout as a capacity wait, wherever it lands. The check lives in `aliasCapacityWait` in `packages/core/src/agents/agentCapacity.ts`, and the pause uses it too. - **Proof:** I wrote a temporary test that slows Redis `eval` so the timeout lands inside a Redis call. The old code fails it with exactly the CI error; the fix passes. The suite then passed 7/7 in four runs side by side. **2. `packages/core/test/managedDiagnosticsPortability.test.ts`: a race in the test itself** - **The cause:** the test starts Node child processes with `--input-type=module -e`. The logger's pretty-printing worker thread inherits that flag and crashes at startup (`ERR_INPUT_TYPE_NOT_ALLOWED`). - **Why it usually passed:** the child normally still exits 0, after hanging about 10s in the logger's exit flush. On a slow CI host the worker's error arrived first and the child exited 1. The 21.5s CI duration fits: two child processes at about 10s each. - **The fix:** I dropped `--input-type`. Node 22.12+ (the project's minimum) recognises the scripts as ES modules on its own. The file now passes 14/14, and its run time fell from about 21s to 9s. Other checks: the nested-admission, per-agent admission, alias-occupancy, task-import capacity-race, native-log admission and synthetic-routing capacity suites all pass. So do `tsc` and lint (zero warnings) on core. I ran the Redis suites against a Redis server built from source, since none is installed here. About 22 other test spawns in the repo still pass `--input-type=module -e`. I only changed the one that failed; the others are open to the same intermittent failure. There are no previews, since nothing visual changed. PR: #3514 Comment by: @propr-dev[bot] (ID: 6840670392) Model: Claude Opus 5.5
…-executions-sta-20261112-2255-lfx [3480 by Claude Opus 5.5] Define how executions started by a running parent are charged, so a ceiling of one cannot deadlock
…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.
…. 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
… 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
… 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
…, 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
…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
…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
…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
…ission-capacity-20261113-0215-dfv [3481 by Claude Opus 5.5] Report admission capacity per agent through REST, MCP and the CLI, and document safe configuration changes
✅ Epic ready for final merge: Per-agent concurrency ceilings alongside the global admission limitAll 4 child PRs have been merged into this epic branch. This epic PR is ready for final review and merge. Posted automatically by ProPR |
…es/api/routeRegistry.ts`, reducing its counted lines from 401 to 398. Runtime behavior is unchanged. Fixed the API lint failure by compacting imports in `packages/api/routeRegistry.ts`, reducing its counted lines from 401 to 398. Runtime behavior is unchanged. Validation passed: API lint with zero warnings and `git diff --check`. No visual preview needed. PR: #3493 Comment by: @github-actions[bot] (ID: 6860989620) Model: GPT-6.1 Sol
|
ℹ️ Analyzed the follow-up request by @propr-dev[bot] Analysis SummaryThe failure was API lint: Verified API lint passes with zero warnings, and No additional changes or visual previews were needed. No code changes were necessary based on the current state of the branch. 🤖 Analysis Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
|
/ultrafix |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ Applied the requested follow-up changes in commit 94c17b8
Summary of ChangesImplemented F3 only. Synthetic selection now checks remaining same-tier members after a cross-alias nesting refusal and preserves immediate refusal when none can run. Authoritative acquire enforcement is unchanged. Added regressions for both strategies, pinned selections, parent reservation sharing, and free alternatives. Validation: 24 tests passed; core typecheck passed. One Redis integration test skipped because Redis was unavailable. 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ng same-tier members after a cross-alias nesting refusal and preserves immediate refusal when none can run. Authoritative acquire enforcement is unchanged. Implemented F3 only. Synthetic selection now checks remaining same-tier members after a cross-alias nesting refusal and preserves immediate refusal when none can run. Authoritative acquire enforcement is unchanged. Added regressions for both strategies, pinned selections, parent reservation sharing, and free alternatives. Validation: 24 tests passed; core typecheck passed. One Redis integration test skipped because Redis was unavailable. PR: #3493 Comment by: @integry (ID: 6863687956) Model: GPT-6.1 Sol
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds atomic per-agent ceilings, queue deferral, nested admission, and a shared REST/MCP/CLI report. It needs changes before merge because goal-parent attribution can exempt unrelated executions from admission limits. ✅ Atomic accounting — Global and alias checks share one Redis acquire operation, and recovering holders retain their charge until removal is confirmed. ✅ Deferral lifecycle — Capacity refusals preserve the queue job, avoid consuming failure attempts, and update task timeline metadata. ✅ Report access filtering — MCP filters task IDs and repository names through grant and repository authorization. This review is a static trace of the supplied diff; no commands were run. The issue specifications and supplemental file context contain truncation notices, limiting verification of requirements beyond their visible portions. Current checks report no failures and three pending checks. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F4: 🔴 Public markers can bypass admission ceilings
SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Exercise queue-level parent starvationThe admission tests demonstrate nested launches once their processors run. A separate integration test with an orchestrating goal occupying a queue worker and ordinary admission waiters occupying the remaining workers would clarify whether queued children can reach admission. This is an optional follow-up concerning the existing queue scheduling architecture, rather than a demonstrated regression in this diff. ScoreThe implementation has substantial lifecycle coverage and useful operational reporting, but reliable parent attribution remains a merge blocker. Pending checks alone do not lower the rating. 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 35ba5e3
Summary of ChangesImplemented F4 only. Nested accounting now requires a signed association bound to the exact issue or PR command, including Ultrafix continuations. Copied markers and stale scopes retain ordinary accounting. Typecheck, lint, and 13 focused test files passed. Ten Redis integration cases were skipped because Documented the shared signing-secret requirement for admission-enabled orchestration. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…d association bound to the exact issue or PR command, including Ultrafix continuations. Copied markers and stale scopes retain ordinary accounting. Implemented F4 only. Nested accounting now requires a signed association bound to the exact issue or PR command, including Ultrafix continuations. Copied markers and stale scopes retain ordinary accounting. Typecheck, lint, and 13 focused test files passed. Ten Redis integration cases were skipped because `redis-server` is unavailable. Documented the shared signing-secret requirement for admission-enabled orchestration. PR: #3493 Comment by: @propr-ultrafix (ID: 0) Model: GPT-6.1 Sol
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR implements per-agent admission, queue deferral, nested execution accounting, and shared capacity reporting with substantial regression coverage. It needs changes before merge because mixed-version recovery can release a parent’s reservation while its nested execution remains running. ✅ Atomic ceilings — The Lua acquire checks global and alias occupancy together, retaining recovering holders until confirmed removal. ✅ Early deferral — Issue and automation processors check capacity before repository admission or durable execution claims. ✅ Shared reporting — REST, MCP, and CLI expose the same report, with explicit unavailable states and caller-specific task visibility. This review is static: no commands were run. Two files were explicitly omitted, and the supplied issue specifications are truncated. Current checks show no failures and one pending validation check; historical lint failures are not treated as current failures. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F5: 🔴 Fence incompatible recovery during rolling upgrades
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe implementation has substantial coverage and clear separation of admission, deferral, and reporting. The demonstrated mixed-version lifecycle violation prevents merge despite the otherwise successful current checks. Score: 6/10 🤖 Review Details
Files omitted from review diff2 files were omitted from the review diff. Large, binary, generated, and lockfile changes are deprioritized. Did not fit the review context budget
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 8075f2c
Summary of ChangesImplemented F5 only.
Validation: 66 tests passed with real Redis, no skips. Core typechecking, focused lint, and diff checks passed. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
Implemented F5 only. - Versioned admission identity fences legacy recovery, including higher-generation callers. - Documented the required coordinated drain and upgrade procedure. - Added regressions using the legacy script against a draining parent with a live child. Validation: 66 tests passed with real Redis, no skips. Core typechecking, focused lint, and diff checks passed. PR: #3493 Comment by: @propr-ultrafix (ID: 0) Model: GPT-6.1 Sol
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds atomic per-agent ceilings, early queue deferral, nested execution accounting, and REST/MCP/CLI reporting. The implementation has substantial targeted coverage, but incorrect recovery guidance needs correction before merge. ✅ Atomic accounting — The admission script checks global and alias occupancy together and retains recovering reservations until removal is confirmed. ✅ Deferral coverage — The added tests exercise worker release, unchanged retry budgets, synthetic routing, and recovery using real Redis and BullMQ. This review is static: no commands were run. The issue specifications are truncated, and three documentation/generated files are omitted. Current checks show no failures and three pending checks; the historical lint failures are not current blockers. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F6: 🔴 Distinguish incompatible admission protocols in recovery guidance
SuggestionsThese are optional follow-ups and are not sent to S3: 🟢 Preserve review selections across deferrals
ScoreStrong implementation and extensive targeted tests, with one localized but operationally significant reporting defect. Pending checks and the omitted documentation remain verification limitations. Score: 6/10 🤖 Review Details
Files omitted from review diff3 files were omitted from the review diff. Large, binary, generated, and lockfile changes are deprioritized. Did not fit the review context budget
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit d720c6b
Summary of ChangesAddressed F6 only. CLI and API guidance now qualify generation changes by protocol compatibility and direct incompatible upgrades to the coordinated drain/reset procedure. Regenerated the API contract and added focused regressions. Validation: 17 tests passed, CLI typecheck passed, and generated-contract checks passed. Redis integration checks were blocked by missing Visual previewSuggested agent tools
🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ion changes by protocol compatibility and direct incompatible upgrades to the coordinated drain/reset procedure. Regenerated the API contract and added focused regressions. Addressed F6 only. CLI and API guidance now qualify generation changes by protocol compatibility and direct incompatible upgrades to the coordinated drain/reset procedure. Regenerated the API contract and added focused regressions. Validation: 17 tests passed, CLI typecheck passed, and generated-contract checks passed. Redis integration checks were blocked by missing `redis-server`; terminal preview capture was unavailable. PR: #3493 Comment by: @propr-ultrafix (ID: 0) Model: GPT-6.1 Sol
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds atomic per-agent ceilings, queue deferral, explicit parent accounting, and REST/MCP/CLI reporting. The supplied code appears merge-ready within the reviewed scope, conditional on the three pending checks completing successfully. ✅ Atomic accounting — Global and alias limits are checked together; recovering holders remain charged until removal is confirmed. ✅ Durable deferral — Capacity refusals preserve job identity, avoid consuming retry attempts, and update task timeline metadata. ✅ Resource-bound parent proofs — Signed associations bind nested work to specific issues or comments, preventing copied markers from granting another resource an exemption. This was a static review; no commands were run. The issue specifications are truncated, and three documentation/generated files were omitted, limiting verification of the complete acceptance criteria and published documentation. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S4: 🟢 Cover simultaneous limit saturationAdd a task-import race regression with both the global limit and alias ceiling set to one. S5: 🟢 Clarify deferred-count snapshot semantics
ScoreThe implementation has substantial targeted coverage and carefully preserves admission recovery guarantees. No verified blocker was found in the supplied code; current checks report no failures, with three still pending. Score: 8/10 🤖 Review Details
Files omitted from review diff3 files were omitted from the review diff. Large, binary, generated, and lockfile changes are deprioritized. Did not fit the review context budget
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
|
|
/review fable |
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — fableOverall EvaluationThis Epic PR implements the four linked issues: optional per-direct-agent ceilings taken in the same atomic Lua I traced the Lua script (acquire/fence/release/expired with nested records), the acquire loop changes in ✅ Nested lifecycle ordering is correct in the atomic script — ✅ Deferral never consumes the failure budget or triggers replacement — ✅ Parent association is resource-bound, not timing-based — The PR is merge-ready within scope. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S6: 🟢 Reuse a long-lived Redis connection for capacity checks
S7: 🟢 Thread the BullMQ key prefix into wake-ups
S8: 🟢 Keep pinned synthetic selections across repository deferrals outside the issue jobThe issue job calls S9: 🟢 Bound the cost of the Fleet deferred count
S10: 🟢 Prune malformed or orphaned waiter entriesIn S11: 🟢 Treat the goal signing key as a credential in diagnostics
S12: 🟢 Verify a writer exists for
|
✅ Epic merged: Per-agent concurrency ceilings alongside the global admission limitEpic PR #3493 has been merged into main. 4 out of 4 PRs merged into main through this epic PR. All planned epic work is now merged. Posted automatically by ProPR |
Per-agent concurrency ceilings alongside the global admission limit
This Epic PR aggregates all changes for the plan: Per-agent concurrency ceilings alongside the global admission limit
Issues in this Epic
Auto-close
When this PR is merged, the following issues will be automatically closed:
Fixes #3478
Fixes #3479
Fixes #3480
Fixes #3481
Created automatically by ProPR