Repository navigation
[3480 by Claude Opus 5.5] Define how executions started by a running parent are charged, so a ceiling of one cannot deadlock - #3514
Conversation
…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.
|
/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: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds explicit parent links and atomic Redis admission for nested executions, with substantial integration coverage. It needs changes before merge: one recovery path can indefinitely block an agent after its nested execution crashes. ✅ Atomic admission rules — The Lua acquire operation checks parent liveness, nesting bounds, and alias charges together. ✅ Cross-process coverage — The new tests exercise both Docker wrappers, parent crashes, nesting limits, and draining reservations using real Redis. The supplied current-head status has no failed checks; five remain pending. This review used static analysis only, as requested. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Recover crashed children of draining parents
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Align the introductory capacity descriptionThe architecture document still opens with an unconditional maximum number of simultaneous containers, while its new nesting section permits up to ScoreThe implementation has strong admission and integration-test coverage, but the demonstrated recovery deadlock prevents merge. Current checks have no reported failures, with five still pending. 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 bb02a90
Summary of ChangesI 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 ( 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 ( Regression test. Two new real-Redis cases in
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.
No visual preview, since nothing visual changed. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…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
|
✅ 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 4ee2b85 Summary of ChangesI fixed the Shard 3/4 failure. Cause: this branch added a third Redis key (the parents key) to the admission script. That moved the operation name ( Fix: in all four mocked I only ran this one suite locally, not the full Shard 3/4 job. I checked the other tests that mock the admission script ( There's no visual change, so I didn't make a preview. 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…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
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds explicit parent scopes, atomic nested admission, and lifecycle accounting to prevent parent–child capacity deadlocks. It needs changes before merge because local parent cleanup does not preserve the promised child-first fencing and removal behavior. ✅ Atomic admission rules — The Redis script checks nesting depth, child count, and different-agent ceilings within the same acquire operation. ✅ Focused integration coverage — The added tests exercise real Redis and separate processes, including global-limit-one admission and crash recovery. The supplied current-head status has no failed checks and two pending checks. This review is based on static tracing; no commands were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F2: 🔴 Preserve child-first cleanup on local lease loss
SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Reconcile capacity documentationThe architecture introduction and configuration catalog still describe the global limit as a maximum simultaneous container count, although nested containers can exceed it. Updating these summaries to distinguish charged slots from physical containers would make the documented operational impact clearer. The detailed nested-execution section already explains the behavior, so this is documentation cleanup rather than a merge blocker. ScoreThe admission rules and integration coverage are substantial, but a parent lease-loss cleanup path violates the new lifecycle contract. Current checks report no failures, with two still pending. 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 f892027
Summary of ChangesI 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 The fix
Tests (
There's no visual change, so no preview. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…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
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
|
CI failed: Full Test Suite Shard 4/4 Please investigate and fix this CI failure.
Failure evidence
|
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR implements explicit parent-linked admission with atomic Redis accounting and bounded nesting. No merge-blocking defect was verified from the supplied diff and caller context. It is merge-ready within the reviewed scope, conditional on the three pending checks completing successfully. ✅ Atomic nested accounting — Parent resolution, depth/count enforcement, global-slot sharing, and different-alias ceiling checks occur in one admission script. ✅ Capacity retained through cleanup — Recovering parents cannot release their reservations while child records remain; draining parents retain capacity until their last child releases. ✅ Relevant integration coverage — The added tests exercise real Redis and multiple processes, including global-limit-one admission, alias sharing, crash recovery, and lease-loss cleanup. This was a static review; no commands or tests were run. The supplied current-head status reports no failed checks. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S3: 🟢 Exercise interrupted draining cleanupAdd a regression around S4: 🟢 Clarify headline capacity guaranteesUpdate the opening paragraph and Observability section of ScoreThe implementation has substantial, relevant coverage and coherent admission and recovery logic. Static review found no verified blocker; three current-head checks remain pending, and live Fleet acceptance is not established. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit d9f55cc Summary of ChangesI 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.
2.
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 About 22 other test spawns in the repo still pass There are no previews, since nothing visual changed. 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…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
AI Implementation Summary
Closes #3480
Branch:
3480/claude-opus-5-5-define-how-executions-sta-20261112-2255-lfxCommits: ✅ Changes committed (04e8a0d)
AI Processing Completed
Execution Details:
Summary:
I've implemented nested-execution admission. A nested execution is now 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)
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.limit × (1 + nested limit). On Hosted, that means more containers than the entitlement.Which paths use which rule
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.search_repository_filescalled by an automation runNo path needed the reject-at-startup fallback. Diagnostics now report
drainingandnestedcounts, 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:
/fix, reviews) still take normal slots.Tests
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.@propr/coreall pass, as do lint (zero warnings) andtscon root, core and API.test/agentCapacityAliasOccupancy.test.tsfailed 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.Docs: a new "Nested executions" section in
agent-run-admission.md, plusgoals.md, the configuration reference, the regenerated settings page, the settings catalog and.env.example. No preview, since nothing visual changed.Detailed Logs:
0fdb3d7f-e1bc-4682-9c8a-526457cd4e1dLog files stored at:
/usr/src/app/logs/executions/issue-3480-2026-11-12T23-42-39-291Z-conversation.json/usr/src/app/logs/executions/issue-3480-2026-11-12T23-42-39-291Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #3480.
💡 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!