Repository navigation
feat(ai): agent constellation quiesce & emergency failover controller (devops ai quiesce, devops ai failover) - #65
Merged
dan-petty merged 4 commits intoSep 8, 2026
Conversation
- Implement core constellation models (QuiesceState, AgentTaskType, SuspendedTask, QuiesceSnapshot, result schemas) in devops_cli.ai.controller.models - Implement ConstellationManager in devops_cli.ai.controller.manager with atomic state persistence in .data/agent/quiesce.json, supporting quiesce(), failover(), resume(), status(), is_quiesced(), and get_active_route() - Add strongly typed domain exceptions (ConstellationQuiesceError, ConstellationFailoverError, ConstellationResumeError) in devops_cli.exceptions.ai - Record lifecycle transitions to OpenTelemetry spans (ai.constellation.quiesce, ai.constellation.failover, ai.constellation.resume) and Prometheus counters (devops_cli_ai_quiesce_events_total, devops_cli_ai_failover_events_total, devops_cli_ai_resumptions_total) - Expose CLI commands devops ai quiesce, failover, resume, and constellation with rich table formatting and JSON output support - Expose FastMCP tools ai_quiesce, ai_failover, ai_resume, ai_constellation_status, and live resource resource://ai/constellation - Author comprehensive unit and integration test suite in tests/test_ai_controller.py (27/27 green, 100% controller coverage) - Synchronize documentation, CLI command matrix, and 94 FastMCP tool schemas
There was a problem hiding this comment.
🟡 Changes recommended
The controller’s dry-run paths and status reporting currently have real side effects/misreporting, and snapshot writing is not actually atomic despite claiming to be.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new “Agent Constellation” controller subsystem to DevOps CLI that can quiesce active AI/agent workloads, route work to a fallback provider/model during outages, and resume—exposed via both CLI commands and FastMCP tools/resources.
Changes:
- Introduces
devops_cli.ai.controllerdomain models and aConstellationManagerwith snapshot persistence (.data/agent/quiesce.json), plus telemetry + metrics. - Adds new
devops aisubcommands (quiesce,failover,resume,constellation) and FastMCP tools/resources for external automation. - Expands tests and documentation to cover the new controller features, CLI surface area, and MCP tool registration.
File summaries
| File | Description |
|---|---|
| tests/test_fastmcp_contracts.py | Extends tool/resource registration assertions for new MCP endpoints. |
| tests/test_ai_controller.py | Adds unit + CLI integration coverage for controller models/manager/commands. |
| src/devops_cli/lang/en/help.py | Adds help strings for new options and AI subcommands. |
| src/devops_cli/exceptions/ai.py | Adds typed constellation controller exceptions and re-exports. |
| src/devops_cli/exceptions/init.py | Re-exports new constellation exceptions at package root. |
| src/devops_cli/config/constants.py | Adds error-code constants for constellation exceptions. |
| src/devops_cli/commands/ai.py | Mounts the new controller commands under devops ai. |
| src/devops_cli/commands/ai_controller.py | Implements Typer CLI handlers and table/JSON output. |
| src/devops_cli/ai/mcp/server.py | Adds FastMCP tools and a live resource for constellation status. |
| src/devops_cli/ai/controller/models.py | Defines controller enums + Pydantic schemas for snapshot/results/status. |
| src/devops_cli/ai/controller/manager.py | Implements snapshot IO, quiesce/failover/resume logic, metrics, status routing. |
| src/devops_cli/ai/controller/init.py | Exposes the controller public API via __all__. |
| README.md | Adds new devops ai commands to the CLI command matrix. |
| docs/ROADMAP.md | Marks the controller milestone as completed. |
| docs/MCP_TOOLS.md | Documents the new MCP tools and parameters. |
| docs/LOG.md | Logs the new controller feature milestone entry. |
| docs/ERRORS.md | Documents new constellation error codes. |
| docs/DEVCONTAINER_USAGE.md | Updates devcontainer Dockerfile example tag usage. |
| docs/commands/ai.md | Adds generated docs sections for the new CLI commands. |
| docs/CLI_REFERENCE.md | Adds new commands/options to the CLI reference. |
| docs/agent/task.md | Updates internal task tracking to include Phase 49.6 completion status. |
Review details
Suppressed comments (2)
src/devops_cli/ai/controller/manager.py:180
failover(..., dry_run=True)can still mutate the in-memory registry becausesnapshot.tasksmay aliasself._registered_tasks.values()when there is no on-disk snapshot. This makes dry-run stateful. Deep-copy the snapshot for dry runs and avoid mutating_registered_tasksunlessdry_runis false.
snapshot = _read_snapshot_file(self.snapshot_file) or QuiesceSnapshot(
state=QuiesceState.FAILOVER,
reason="Automatic failover",
tasks=list(self._registered_tasks.values()),
)
src/devops_cli/ai/controller/manager.py:229
resume(..., dry_run=True)still mutates task objects (and can mutate_registered_taskswhen there is no snapshot). This makes dry runs stateful in long-running processes. Use deep copies for simulated operations and only apply mutations to_registered_tasks/ snapshot state whendry_runis false.
snapshot = _read_snapshot_file(self.snapshot_file)
tasks = snapshot.tasks if snapshot else list(self._registered_tasks.values())
resumed_count = len(tasks)
for task in tasks:
- Files reviewed: 21/21 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…immutability, and metrics cardinality
…n timeout in config defaults
This was referenced Sep 8, 2026
Merged
dan-petty
added a commit
that referenced
this pull request
Sep 9, 2026
* chore(release): prepare repository and roadmap for v0.2.13 milestone (#51) * chore(release): prepare repository and roadmap for v0.2.13 milestone * fix(review): address copilot review comments on exception clauses and unreleased changelog scope * Revert "fix(review): address copilot review comments on exception clauses and unreleased changelog scope" This reverts commit 8579f04. * docs(agents): mandate active milestone issue population and remote branch governance * docs(agents): mandate github issues views population and project board linkage * docs(agents): mandate github projects tab and issues views population * feat(ai): sub-agent local offloading engine & agent harness slots (#60) * feat(ai): implement sub-agent local offloading engine and harness slots Add modular harness slots (ModelSlot, SkillSlot, ToolSlot, SubAgentSlot) to dynamically offload token-intensive code exploration, AST syntax tree mapping, and symbol lookups to local open models. Implement the 'Big decides, small types, big checks' multi-tier synthesis protocol achieving 85%+ frontier token savings with automated calculation. Provide CLI commands under devops ai harness (status, offload, run) and expose FastMCP tools ai_harness_status and ai_subagent_offload. * fix(review): address copilot review comments on harness slots, offload metrics, and tool validation * fix(harness): enhance read-only tool sandboxing and tiered execution status reporting * fix(review): remediate review findings and harden self-improvement feedback loop (#62) * fix(review): remediate review findings and harden self-improvement feedback loop - Automatically mask sensitive dictionary fields in root DevOpsError representations - Harden AI agent step persistence, durable execution, prompt template injection sanitization, and tool argument validation - Eliminate Bandit B104 interface binding alert in Ollama provider and resolve strict Mypy typing constraints in test_gen - Catalog false-positive hallucinations into common hallucinations catalog (uninitialized variable in loop, Pathlib resolve FileNotFoundError, health endpoint version, stream event timestamp) - Expand deterministic pre-verification pipeline with conversational monologue and benign compliment heuristics - Add comprehensive unit test suites for GitHub projects, milestones, labels, and verification heuristics to exceed 90% code coverage requirement * fix(review): address review comments on GraphQL escaping, URL queries, path segments, and histogram deque - Escape GraphQL query and mutation string arguments with json.dumps in projects.py - Synchronize Direct Link query URLs with exact Issues Filter Query strings in gh.py - Inspect path parts instead of substring match to prevent false positives on valid filenames with double dots - Replace O(n) list pop(0) in InMemoryMetricsRegistry histogram with O(1) bounded deque - Assert emitted SSE event persona matches query parameter and verifies DEFAULT_STREAM_PERSONA fallback * feat(cli): interactive terminal UI dashboard (devops dashboard / tui) (#63) * feat(cli): interactive terminal UI dashboard (devops dashboard / tui) - Add responsive full-screen Textual dashboard application with 5 real-time tabs: Kubernetes pods, Docker containers, OpenTelemetry metrics, AI review findings queue, and Valkey cache - Implement subsystem status data providers in devops_cli.ui.data_providers - Expose devops dashboard and devops tui commands with automatic static summary fallback for non-TTY pipelines and --summary flag - Add keyboard navigation (1-5, r, q, ?) with accessible HelpScreen modal - Register dashboard and tui commands in main CLI and OpenTelemetry test suite - Author comprehensive unit and integration test suite with 100% passing quality gate * fix(dashboard): address review comments on subcommands, refresh interval, unverified count, and metrics snapshot - Remove redundant subcommands dashboard and tui from dashboard.py, ensuring direct top-level invocation - Clamp refresh_interval with max(0, refresh_interval) allowing disabling auto-refresh with 0 - Compute and set unverified_count on ReviewSummary - Add get_metrics_snapshot() to InMemoryMetricsRegistry and decouple fetch_telemetry_status from registry internals - Update test suite to 15 passing tests and synchronize command documentation * feat(ai): model dependency chaos engineering suite (devops ai chaos-model) (#64) * feat(ai): model dependency chaos engineering suite (devops ai chaos-model) - Implement core chaos models (ChaosMode, ChaosStatus, ChaosConfig, ChaosFaultResult, ModelChaosReport) in devops_cli.ai.chaos.models - Implement ModelChaosInjector in devops_cli.ai.chaos.injector simulating 4 real-world failure modes: synthetic network latency, HTTP 429 rate-limiting, connection timeouts/socket errors, and mid-stream malformed JSON - Verify automated local open model fallback routing (Ollama Qwen2.5-Coder/Granite) ensuring CI validation gates complete without human coaching - Record fault and recovery metrics to OpenTelemetry spans (ai.chaos.run, ai.chaos.inject) and Prometheus counters (devops_cli_ai_chaos_injections_total, devops_cli_ai_chaos_recoveries_total) - Expose devops ai chaos-model CLI command with table/json formatting and dry-run support - Expose FastMCP tool ai_chaos_model on FastMCP server - Author comprehensive unit and integration test suite tests/test_ai_chaos_model.py - Synchronize documentation, CLI command matrix, and FastMCP schemas * fix(ai): address review feedback on chaos model retries, spans, and validation - Forward ChaosConfig.max_retries to AIConfig and LLMClient.chat - Emit per-injection child spans (ai.chaos.inject) alongside run span (ai.chaos.run) - Honor error_rate in ModelChaosInjector to skip fault injection based on threshold - Add bounds validation for latency_ms (>= 0) and error_rate ([0.0, 1.0]) in ChaosConfig and CLI - Expand test suite in tests/test_ai_chaos_model.py covering spans, retries, error_rate, and validation bounds * feat(ai): agent constellation quiesce & emergency failover controller (#65) * feat(ai): agent constellation quiesce & emergency failover controller - Implement core constellation models (QuiesceState, AgentTaskType, SuspendedTask, QuiesceSnapshot, result schemas) in devops_cli.ai.controller.models - Implement ConstellationManager in devops_cli.ai.controller.manager with atomic state persistence in .data/agent/quiesce.json, supporting quiesce(), failover(), resume(), status(), is_quiesced(), and get_active_route() - Add strongly typed domain exceptions (ConstellationQuiesceError, ConstellationFailoverError, ConstellationResumeError) in devops_cli.exceptions.ai - Record lifecycle transitions to OpenTelemetry spans (ai.constellation.quiesce, ai.constellation.failover, ai.constellation.resume) and Prometheus counters (devops_cli_ai_quiesce_events_total, devops_cli_ai_failover_events_total, devops_cli_ai_resumptions_total) - Expose CLI commands devops ai quiesce, failover, resume, and constellation with rich table formatting and JSON output support - Expose FastMCP tools ai_quiesce, ai_failover, ai_resume, ai_constellation_status, and live resource resource://ai/constellation - Author comprehensive unit and integration test suite in tests/test_ai_controller.py (27/27 green, 100% controller coverage) - Synchronize documentation, CLI command matrix, and 94 FastMCP tool schemas * fix(ai): harden constellation controller snapshot atomicity, dry-run immutability, and metrics cardinality * feat(ai): localize agent constellation messages and quiesce reason via lang module * feat(ai): centralize fallback provider, model, and constellation drain timeout in config defaults * feat(devcontainer): isolate project ssh signing keys and install pre-commit globally (#67) * feat(ai): externalize fastmcp prompt templates to canonical markdown tasks * feat(devcontainer): isolate project ssh signing keys and install pre-commit globally * feat(ai): localize fastmcp tool descriptions and error strings via lang module * fix(devcontainer): check tool install returncodes, isolate local git signing, and remove unused CONFIG_DIR * feat(ai): multi-model LLM benchmark evaluation harness (#68) * feat(ai): multi-model LLM benchmark evaluation harness Implement automated evaluation suite devops ai benchmark --suite grounded in feedback datasets with quantitative precision, recall, hallucination rate, throughput, and AST architectural compliance scoring. * fix(ai): externalize benchmark prompts, sanitize credentials, standardize F1 scoring, and parse verdicts deterministically * fix(docs): resolve GitHub Pages table rendering, update badges, and deploy modern developer theme (#69) * fix(docs): resolve GitHub Pages table rendering, update badges, and deploy modern developer theme * fix(docs): invoke seo tag in layout, respect prefers-reduced-motion, and generalize table assertions * docs(agents): codify review feedback remediation mandate and harden docs theme layout (#70) * docs(agents): codify review feedback remediation mandate and harden docs theme layout * docs(task): reconcile Phase 49.7.2 state in task tracker to WIP during PR review * docs(task): consolidate duplicate Phase 49.7 entries in task tracker * docs(agents): enforce mandatory direct in-thread replies to PR review comments * feat(review): parallel async multi-file review worker pool & streaming diff parser (#71) * feat(review): parallel async multi-file review worker pool & streaming diff parser - Implement ReviewWorkerPool utilizing Python 3.14 asyncio.TaskGroup, Semaphore, and TokenBucketRateLimiter - Implement streaming generator diff_stream_chunks reducing memory consumption - Integrate ReviewWorkerPool into ReviewPipelineOrchestrator and persona review stage - Add --concurrency and --parallel options to review path, branch, and pr commands - Add ReviewPoolError domain exception and author TDD test suite * fix(review): clamp review workers to total files and restore deterministic persona progress output * feat(telemetry): logfire structured AI observability bridge (#72) * feat(telemetry): logfire structured AI observability bridge * fix(telemetry): address code review feedback on logfire bridge and bump httpx2 * feat(k8s): deploy in-cluster container registry and add non-blocking deploy-stack options - Deploy Docker Registry v2 with 50Gi local-path storage in registry namespace and expose via NodePort 30500. - Align PodSecurity admission labels and security contexts across namespaces (monitoring, llm, registry, argocd, otel), eliminating admission warnings. - Add --wait/--no-wait and --timeout flags to devops k8s deploy-stack, avoiding blocking when cluster nodes are temporarily offline. - Author unit tests for non-blocking deploy-stack and isolate embeddings test from ambient daemon. - Synchronize CLI references and task documentation. * fix(ai): bypass response cache and respect --url during ai test - Disable response caching during devops ai test so connectivity checks perform live inference and measure real network/compute latency. - Ensure --url option explicitly scopes LLMClient endpoint targeting. - Add unit test test_ai_test_disables_cache_and_targets_url. * feat(output): round to whole seconds on time outputs for durations 10s and above - Update format_duration in devops_cli.output to automatically round to whole seconds when total duration is 10 seconds or greater. - Preserve sub-second and decimal precision (e.g. 2.50s, 7.37s, 9.94s, ms, µs) for durations under 10 seconds. - Update duration assertions in tests/test_output.py. * refactor(config): deduplicate append_cache setting in AIConfig and AICacheConfig - Eliminate redundant top-level append_cache field on AIConfig in favor of AICacheConfig.append_cache (ai.cache.append_cache). - Expose append_cache property on AIConfig delegating to cache.append_cache and add before-validator migrating legacy YAML entries. - Add unit tests in tests/test_response_cache.py verifying serialization deduplication and backward-compatible migration. - Synchronize docs/CONFIGURATION.md. * refactor(config): table-driven child path rebasing in DataConfig and helper decomposition * chore(release): prepare v0.2.13 release * docs: remove emoji icons from section titles in README * docs: relocate command matrix table to bottom of README * fix(git): resolve known_hosts blank line injection and update release docs
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
Implements a centralized Agent Constellation Quiesce & Emergency Failover Controller for DevOps CLI, providing graceful pause, zero-state-loss emergency failover routing, and resumption mechanisms for multi-agent loops, file watchers, schedulers, and background task runners.
Closes #56
Architecture & Key Capabilities
devops_cli.ai.controller.models):QuiesceState: Comprehensive lifecycle states (IDLE,QUIESCED,FAILOVER,RESUMED).AgentTaskType: Task taxonomy (REVIEW_LOOP,CRON_JOB,FILE_WATCHER,SLOT_WORKER,SUBAGENT,BENCHMARK).SuspendedTaskandQuiesceSnapshot: Atomic state tracking preserved in.data/agent/quiesce.jsonadhering to sovereign agent workspace isolation.QuiesceResult,FailoverResult,ResumeResult,ConstellationStatus.devops_cli.ai.controller.manager):ConstellationManagersupportingquiesce(),failover(),resume(),status(),is_quiesced(), andget_active_route().ai.constellation.quiesce,ai.constellation.failover,ai.constellation.resume).devops_cli_ai_quiesce_events_total,devops_cli_ai_failover_events_total,devops_cli_ai_resumptions_total).devops_cli.exceptions.ai):ConstellationQuiesceError,ConstellationFailoverError,ConstellationResumeErrorre-exported in root exceptions package.devops_cli.commands.ai_controller):devops ai quiesce: Cleanly freeze running agent loops and background schedulers with reason logging and drain timeouts.devops ai failover: Safely re-route pending tasks to designated fallback endpoints (e.g. local Ollamaqwen2.5-coder:7b) with zero state loss.devops ai resume: Gracefully reactivate suspended tasks with updated routes.devops ai constellation: Render real-time fleet table and fallback route status (or JSON payload).devops_cli.ai.mcp.server):ai_quiesce,ai_failover,ai_resume,ai_constellation_status, and live resourceresource://ai/constellation.Standards & Quality Gate Verification
tests/test_ai_controller.pywith 27 unit, lifecycle, and CLI integration tests (100% green, 100% controller statement coverage).tests/test_fastmcp_contracts.py(100% green).devops scan complexityandtests/test_architectural_invariants.py.devops ci10/10 gates green (version, test, coverage >= 90.0%, lint, format, typecheck, audit, security, actionlint, docs).