Repository navigation
Conversation
raes 7.0.0 lets one RuntimeManager own a target's components until it is closed. The automatic backend retry kept the first attempt's manager alive and built a second one for the same target, so the retry raised "backend already has a runtime owner" and `lilrae lab start --json` printed nothing. The retry now closes the first manager before the admitted hook runs. If RAES refuses to release it, the retry is skipped and the first attempt's error is kept with the reason. If the retry also fails, its error ends with "Initial attempt:" and the first attempt's diagnostics. The retryable set is unchanged.
doublewhy
marked this pull request as ready for review
October 25, 2026 11:41
7 tasks done
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the first backend apply fails with
aptl.provisioner.backend-start-failedand the startup adapter admitsBEFORE_BACKEND_RETRY(the bundled TechVault does),lilrae lab startwaits 60 s and crashes withRuntimeError: backend already has a runtime owner.--jsonprints nothing. raes 7.0.0 lets oneRuntimeManagerown a target's components until it is closed, and the retry built a second manager while the first attempt's was still open.The retry now closes the first attempt's manager before the hook runs, then applies the same admitted plan. If RAES refuses the close, the retry is skipped and the result keeps the first error with the reason. If the retry also fails, its error ends with
Initial attempt:and the first attempt's diagnostics. The retryable set does not change.Requirement UIDs
Related Issues
Closes #1424
Shares
test_raes_backend.pyandruntime-architecture.mdwith #1369 (#1325) in disjoint hunks; either merge order is clean, and #1369's retry test relies on this PR's_FakeRuntimeManager.close().ADR Impact
None. Start still applies through RAES's own
RuntimeManager.apply()(ADR-046, runtime service addendum).Changes
src/aptl/backends/_raes_start_retry.py(new, 79 lines):apply_with_single_retry. It catches only what RAESclose()raises (RuntimeError,TimeoutError).src/aptl/backends/raes.py:_apply_with_backend_retrykeeps its signature and delegates (499 → 493 lines).tests/test_raes_start_retry.py(new, 7 tests): the deployment backend and the retry hook are modelled. The runtime manager, its RAES claim, andclose()are real; the skip test subclasses the real manager only to leave a clock driver that does not stop. The CLI test replaces only the lab steps around the handoff. Owner checks expect a secondAptlRuntimeManager(target)to raise "already has a runtime owner".tests/test_raes_backend.py: the shared_FakeRuntimeManagergets a no-opclose(), which the existing retry tests now call.docs/sdl/runtime-architecture.md: the retry paragraph names the admitting hook (not thesocprofile), the close, the skip and the suffix.docs/reviews/962-lilrae-readiness/tracked-file-inventory.tsv: rows for the two new files.apply_with_single_retry,_release_runtime_ownertest_retry_releases_the_first_runtime_owner_and_starts:RuntimeError: backend already has a runtime owner--jsonok=falsewith both attempts' diagnostics.apply_with_single_retry(Initial attempt:)test_failed_retry_reports_both_attempts: sameRuntimeError;test_lab_start_json_reports_both_attempts_after_a_failed_retry:JSONDecodeErroron empty stdout_release_runtime_owner,_RETRY_SKIPPEDtest_unreleasable_first_owner_skips_the_retry(RAES'sTimeoutErrorfrom the realclose()): sameRuntimeErrorapply_with_single_retrytest_first_attempt_without_retry_keeps_its_owner(3 cases): pass without the change; fail under a close-on-every-path mutationAll run in the "Python tests + coverage" lane.
Test Plan
bash tools/run-targeted-tests.sh tests/test_raes_start_retry.py: 7 passed. Without the change: 4 failed (threeRuntimeError, one empty--json), 3 passed (no-retry cases).DID NOT RAISE RuntimeError); closing the retry's manager fails the retry-success test.bash tools/run-targeted-tests.sh(both touched test files): 128 passed.pytest -k "not integration"on the 25 modules that referenceaptl.backends.raes,test_cli.pyandtest_raes_participant_delivery.py: 1004 passed;test_lilrae_rename_boundary.py: 5 passed.pre-commit run --files <changed files>(including the pack boundary),ruff check, and Vale on the doc: passed.lilrae lab start --scenario techvault --clean --yes --jsonon Linux (uid 1001), wherewazuh-dashboardexits withEACCES(Fix the wazuh-dashboard config read failure (EACCES) #1422) and fails the first apply. Ondev(cad3c6e): exit 1 after 695 s, emptystart.json,RuntimeError: backend already has a runtime ownerin stderr. On this branch: exit 1 after 781 s, both applies ran, noruntime ownerline,start.jsonparses withok: false,outcome: failed, anderrorcarries, after the retry's diagnostics,Initial attempt: RAES runtime handoff failed: aptl.provisioner.backend-start-failed … Node wazuh-dashboard … required IPv4 address was not observed.