Conversation
…apply->resume)
Ships commits 3-5 of Recovery Controller v2: the active loop beyond drills.
After this PR the controller can orchestrate the full sequence
failure -> freeze -> propose -> review -> apply -> resume -> thaw without
mocks in the source path. LLM provider calls go through swappable adapter
callables (`_minimax_adapter` / `_deepseek_adapter`); defaults raise
ProviderNotConfigured so unconfigured deployments surface 503 with a
generic message rather than leaking which env var is missing.
Routes (POST, all under /api/code-operator/recovery/):
* /propose -- 200 ProposalRecord | 503 provider_not_configured | 409 state
* /review -- 200 ReviewRecord(approved/rejected/needs-revision)
* /apply -- requires confirm=true + verdict=approved; 502 on apply failure
after saga compensation has run
* /resume -- runs the original gate via run_mcp_gate; green->RECOVERED,
red->ESCALATED; both paths thaw_run to release file locks
Service (recovery_controller.py): four new methods (propose_fix,
review_proposal, apply_proposal, resume_run), a `ProviderNotConfigured`
exception, swappable module-level adapter callables, version-tagged
proof events per phase via the post-PR #168 helper.
Saga compensation rule (Garcia-Molina + Salem 1987): apply failure ->
mark_recovery_outcome("retry_failed") + transition APPLYING -> RETRY_FAILED;
proposal stays addressable for forensic review; locks remain held until
operator-driven thaw or 30 min TTL.
Tests: 04_testing/pytest/integration/test_rc_v2_active_loop.py (8/8 pass).
All adapters mocked via monkeypatch on module-level callables; every
mocked LLM call carries credit_spent_usd: 0.0 per the no-paid-services
rule. No real LLM calls in the test path.
Doc: 03_implementation/docs/handoffs/HERMES_RC_V2_ACTIVE_LOOP_2026-05-09.md
covers route surface + auth + data flow + operator setup + saga
compensation + 2 sources cited.
Sources:
1. Saga pattern (Garcia-Molina + Salem 1987):
https://temporal.io/blog/saga-pattern-made-easy
2. FastAPI bigger-applications router pattern:
https://fastapi.tiangolo.com/tutorial/bigger-applications/
Hermes evidence chain: PASS
Task ID: W6-2-RC-V2-ACTIVE-LOOP-2026-05-09
hermes_run_gate: pytest 04_testing/pytest/integration/test_rc_v2_active_loop.py -- 8 passed
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Ghenghis
merged commit May 10, 2026
cb15d9c
into
feat/hermes3d-7-complete-gui-repo-wiring
1 check passed
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
Ships commits 3-5 of Recovery Controller v2: the active loop beyond drills. After this PR the controller can orchestrate the full sequence
failure -> freeze -> propose -> review -> apply -> resume -> thawwithout mocks in the source path. LLM provider calls go through swappable adapter callables; defaults raiseProviderNotConfiguredso unconfigured deployments surface503with a generic message rather than leaking which env var is missing.POSTunder/api/code-operator/recovery/):/propose,/review,/apply,/resumepropose_fix,review_proposal,apply_proposal,resume_run04_testing/pytest/integration/test_rc_v2_active_loop.py)03_implementation/docs/handoffs/HERMES_RC_V2_ACTIVE_LOOP_2026-05-09.mdPR #149 added commits 1+2 (state machine + freeze/thaw saga step 2). PR #154 added the read-only
GET /recovery/runsroute. PR #171 pinned cross-version saga semantics. PR #175 added the W5-5 drill that exercised the full sequence with mocks for fix/review/apply. W6-2 wires the actual route + service surface those drills proved out, so the loop can now run for real.Saga compensation rule
Apply failure (when
code_history.apply_reviewed_patch_proposalraises):recovery_apply_failedproof event written with redacted error class + summary.mark_recovery_outcome(status="retry_failed", ...)closes v1 ledger row.APPLYING -> RETRY_FAILED(terminal); proposal stays addressable for forensic review.thaw_run(or 30 min TTL).Test plan
pytest 04_testing/pytest/integration/test_rc_v2_active_loop.pytest_recovery_controller_freeze.pytest_recovery_controller_cross_version.pytest_recovery_runs_route.pytest_recovery_loop_drill.pytest_rc_v2_active_loop.py(new)monkeypatch.setattron_minimax_adapter/_deepseek_adapter)credit_spent_usd: 0.0Sources
apply_proposalfailure: rollback toRETRY_FAILED, locks held until operator review; proposal remains addressable. Reference: https://temporal.io/blog/saga-pattern-made-easycode_operatorAPIRouterinstance because they share the same prefix, tags, and validation chain. https://fastapi.tiangolo.com/tutorial/bigger-applications/Hermes evidence chain: PASS
W6-2-RC-V2-ACTIVE-LOOP-2026-05-09pytest 04_testing/pytest/integration/test_rc_v2_active_loop.py-- 8 passedclaude-w6-2-rc-active-loop03_implementation/src/hermes3d/services/recovery_controller.py03_implementation/src/hermes3d/api/routes/code_operator.py04_testing/pytest/integration/test_rc_v2_active_loop.py03_implementation/docs/handoffs/HERMES_RC_V2_ACTIVE_LOOP_2026-05-09.md🤖 Generated with Claude Code