Repository navigation
feat(maintenance): persistent op registry + status surface (#1197) - #1366
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (18)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a976268ff9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Adds a read surface over the replay state directory so CLI, daemon HTTP, and MCP can list and tail in-flight or recent maintenance operations. Substrate: - polylogue/maintenance/registry.py: MaintenanceOperationRegistry over ``<archive_root>/.maintenance-state/`` with list_operations(), get_operation(), prune_completed(older_than=7d default). Failed operations are retained until manually cleared. - BackfillOperation.from_dict() so persisted snapshots rehydrate. - replay.py: state payload upgraded to carry the full BackfillOperation.to_dict() under the ``operation`` key; failed runs now persist a final snapshot (success continues to clear). Surfaces: - CLI: ``polylogue maintenance status [--operation-id ID] [--all] [--output-format plain|json]``. - Daemon HTTP: ``GET /api/maintenance/status/<op_id>`` and ``GET /api/maintenance/operations`` (handlers delegated to daemon/maintenance_registry_http.py to keep daemon/http.py within budget). - MCP: ``maintenance_status(operation_id)`` and ``maintenance_list()`` return the shared MaintenanceOperationEnvelope plus the state-file metadata. Tests: - tests/unit/maintenance/test_registry.py — round-trip, ordering, TTL pruning, failure-sample persistence, scope round-trip. - tests/unit/daemon/test_maintenance_endpoints.py — extended for the new GET routes. - tests/unit/cli/test_maintenance_registration.py — extended for the status subcommand. - tests/unit/mcp/test_envelope_contracts.py + tests/infra/mcp.py — classify the two new MCP tools. - MCP tool wire-schema witness regenerated. Closes #1197 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
a976268 to
447706d
Compare
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Adds a persistent maintenance operation registry plus matching CLI,
daemon HTTP, and MCP status surfaces, so operators can list in-flight
and recent backfill operations and tail a specific one by id.
Problem
polylogue/maintenance/replay.pyalready checkpointed per-operationresume state to
<archive_root>/.maintenance-state/<op_id>.json, butthere was no surface that could list those files, retrieve one by id,
or prune the completed ones.
GET /api/maintenance/status/<op_id>wascalled out in the #871 reconnaissance and #996 AC #4 ("Progress and
outcomes are surfaced in CLI/daemon/MCP"); none of the three surfaces
exposed it. The state payload also only carried
{cursor, results, repaired_count, failure_count}, which was notenough to reconstruct the shared
MaintenanceOperationEnvelope.Solution
Substrate:
polylogue/maintenance/registry.py— newMaintenanceOperationRegistryover the state directory.list_operations()returns oneOperationRecordper persistedsnapshot (newest-first),
get_operation(op_id)returns one orNone,prune_completed(older_than=DEFAULT_COMPLETED_TTL=7d)removes only completed-successful operations past the TTL; failed
operations are retained for diagnosis.
polylogue/maintenance/planner.py—BackfillOperation.from_dictso persisted snapshots rehydrate, plus
_coerce_float/_coerce_inthelpers so the rehydration path avoids scatteringbracketed mypy suppressions.
polylogue/maintenance/replay.py— state payload upgraded to carrythe full
BackfillOperation.to_dict()under a newoperationkey(legacy top-level fields preserved for the existing resume code
path). Failed runs now persist a final snapshot so operators can
inspect them via the registry; successful runs still clear the
file.
Surfaces:
polylogue maintenance status [--operation-id ID] [--all] [--output-format plain|json](registered inpolylogue/cli/commands/maintenance.py).GET /api/maintenance/status/<op_id>andGET /api/maintenance/operations. Handlers delegated to a newpolylogue/daemon/maintenance_registry_http.pyto keepdaemon/http.pywithin its file-size budget; the budget reason isupdated to record the delegation.
maintenance_status(operation_id)andmaintenance_list()return the shared
MaintenanceOperationEnvelopeplus state-filemetadata (
updated_at,state_path). The envelope classificationmatrix and MCP tool wire-schema witness are updated accordingly.
Topology / budgets:
docs/plans/topology-target.yamlregenerated.docs/plans/file-size-budgets.yamlreason updated forpolylogue/daemon/http.pyto record the new delegation.Verification
devtools verify --quick— exit 0 (format, lint, mypy, render-allcheck, all five static lints pass).
devtools verify --seed-testmon --skip-slow— exit 0 (8345passed, 2 xfailed, 0 failed).
tests/unit/maintenance/test_registry.py— round-trip,newest-first listing, TTL pruning, failure-sample round-trip,
scope round-trip, end-to-end replay-writes-readable-state.
tests/unit/daemon/test_maintenance_endpoints.py— extendedwith
TestMaintenanceRegistryEndpointscovering the two newGET routes (route dispatch, 404 on missing, envelope shape).
tests/unit/cli/test_maintenance_registration.py— extendedfor the
statussubcommand (registration + help).tests/unit/mcp/test_envelope_contracts.py+tests/infra/mcp.py— classifymaintenance_statusandmaintenance_list.Closes #1197
🤖 Generated with Claude Code