Skip to content

fix(runtime): preserve bootstrap failures when cleanup fails - #724

Merged
morluto merged 1 commit into
mainfrom
agent/preserve-bootstrap-failure-676
Aug 7, 2026
Merged

fix(runtime): preserve bootstrap failures when cleanup fails#724
morluto merged 1 commit into
mainfrom
agent/preserve-bootstrap-failure-676

Conversation

@morluto

@morluto morluto commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Problem

If runtime bootstrap fails after opening its artifact store and ArtifactRepository.close() also raises, the cleanup exception replaces the original construction error. Users then see a secondary teardown fault instead of the startup root cause.

Fixes #676.

Solution

Keep cleanup best-effort inside the existing bootstrap exception path. When closing the store also fails, attach that secondary failure as an exception note and re-raise the original exception unchanged.

The regression closes a real store before injecting the cleanup error, so it proves both resource release and exception precedence rather than bypassing cleanup.

Testing

The regression failed on main by raising OSError: store close failure instead of the injected primary RuntimeError.

uv run --locked pytest -q tests/composition/runtime/test_runtime_lifecycle.py::test_bootstrap_cleanup_failure_preserves_primary_failure
uv run --locked ruff check src/jacobian/runtime/bootstrap.py tests/composition/runtime/test_runtime_lifecycle.py
uv run --locked ruff format --check src/jacobian/runtime/bootstrap.py tests/composition/runtime/test_runtime_lifecycle.py
git diff --check origin/main
make test-plan BASE=origin/main

Result: the regression passed and preserved the cleanup error in __notes__; Ruff, formatting, and diff checks passed. The planner conservatively selects broader product lanes for the transitively imported bootstrap path; those draft-PR checks are pending.

Trust & Compatibility Impact

No verification, checker authorization, artifact, protocol, or public API contract changes. Only dual-failure exception reporting changes; a cleanup-only failure is still raised normally.

Checklist

  • Routine local validation passes (make check)
  • Relevant focused tests are listed above

@cursor
cursor Bot force-pushed the agent/preserve-bootstrap-failure-676 branch from 9d4848e to 1861d55 Compare August 7, 2026 15:50
@morluto
morluto marked this pull request as ready for review August 7, 2026 15:59
@cursor

cursor Bot commented Aug 7, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto merged commit 42fc483 into main Aug 7, 2026
39 checks passed
@morluto
morluto deleted the agent/preserve-bootstrap-failure-676 branch August 7, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: bootstrap_services masks root cause when ArtifactRepository.close fails during construction

1 participant