Skip to content

feat(diagnostics): Wave 2 autonomy stall probes, doctor budget, day/summary separation, and triage dedup [ticket-137] - #166

Merged
ifuri-validator-agent[bot] merged 1 commit into
mainfrom
ticket/137-wave2-autonomy-diagnostics
Nov 14, 2026
Merged

ifuri-validator-agent[bot] merged 1 commit into
mainfrom
ticket/137-wave2-autonomy-diagnostics

Conversation

@tom-sapletta-com

Copy link
Copy Markdown
Contributor

Summary

Implements Wave 2 operational diagnostics and reliability fixes across monag (MON-01..MON-04):

  • MON-01 (#162 — Autonomy stall probes in autodiagnose):
    • Adds deterministic, read-only probes for systemd --user status of known autonomy units (subactor-coding-agent.service, subactor-pr-controller.service, subactor-repair-agent.service, subactor-autonom-user.service, heyasa.service) with graceful timeout/degradation.
    • Probes loopback Heyasa daemon status (http://127.0.0.1:8765/v1/daemon/status, loopback-restricted, short timeout) for eligible_projects == 0, admitted_slots == 0 with blocked candidates, and velocity_status stall states.
    • Checks host CPU load saturation (os.getloadavg()[0] vs os.cpu_count(), warning > 1.5x, critical > 2.0x).
    • Ranks operational autonomy stall anomalies strictly above repository hygiene defects (LICENSE, worktree count) in diagnose_fleet, synthesize_dsl, and build_todo2code_tickets.
  • MON-02 (#163 — Time budget, O(N^2) lease hoist, and partial output in monag doctor):
    • Hoists worktrees.get_repo_leases(repo) and resolve_default_target_branch(repo) outside for wt in parsed_entries: (O(1) per repo instead of O(N) per worktree).
    • Adds monotonic --timeout / budget_seconds (default 60.0s) and per-phase deadline tracking in doctor.diagnose(), returning valid structured partial diagnostics (timed_out, completed_phases, timed_out_phases, skipped_phases, skipped_repositories) when budget expires.
  • MON-03 (#164 — Separate day vs summary reports and label task count sources):
    • Separates monag day (24h operational delta: completed/new-blocker Planfile tasks in window, completed/failed local agent task runs in <state_dir>/tasks/*.json, and 24h merged/opened PRs) from monag summary (current portfolio/queue snapshot, active .subactor/leases, and open PR queue).
    • Attaches explicit source, scope, and filter metadata to every count in JSON (counts_labeled) and Markdown output while preserving gather_planfile_daily compatibility for the frozen acceptance probe.
  • MON-04 (#165 — Deduplicate and impact-sort triage steps):
    • Collapses repeated findings by (repository, cause) with affected_count, sample_items, and estimated_unblock_impact, sorting deterministically by unblock impact and severity descending across candidates, recommendations, guidance_steps, and triage_markdown.

Closes #162
Closes #163
Closes #164
Closes #165

Verification

  • pytest (including new tests/test_wave2_mon01_mon04.py and frozen tests/test_summary_acceptance_probe.py)
  • ./project/governance-check.sh --base main --head HEAD -> GOV-PASS
  • wellman check --root . -> passed

@ifuri-validator-agent ifuri-validator-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validator approval after policy checks for exact head ed005ba859413f4129173f9d9ccd2d507aac0304.

Ticket: ticket-137
Correlation ID: local-semcod-monag-pr-166-ticket-137
Model: openai/cursor-auto
Reviewed diff chunks: 13
Advisory LLM verdict: REQUEST_CHANGES
Advisory summary: Reviewed all 13 diff chunk(s). The visible chunk correctly introduces governed ticket metadata, deterministic operational weighting, and a bounded read-only systemd user-unit probe with graceful degradation. No unresolved code or security defects are evident in this chunk. | The new autonomy probes are generally read-only and bounded, and all required checks passed, but the visible velocity-status parsing can crash diagnostics on malformed or schema-drifted daemon data. | The visible chunk consistently integrates autonomy anomalies into fleet diagnosis, adds anomaly-specific remediation verification, safely handles autonomy targets outside the workspace, separates day and summary CLI modes, and introduces bounded doctor execution plumbing. No unresolved correctness or security defect is evident in the reviewed code. | The visible worktree-audit changes correctly hoist per-repository lease and target resolution, add bounded subprocess handling, preserve active-lease and dirty-worktree safety checks, and return structured partial storage diagnostics when the deadline is exhausted. No unresolved correctness or security defect is evident in this chunk. | The phased partial-diagnostics structure is coherent, but the visible repository phase violates the advertised execution budget after timeout and does not implement the stated lease lookup hoist. | The visible chunk safely adds bounded doctor diagnostics with structured partial results and introduces provenance-aware Planfile and local agent-run scanning. No blocking correctness or security defect is evident in the reviewed code. | The visible chunk safely adds scoped agent-run and lease snapshots, distinguishes day-delta and summary reporting, labels count provenance and filters, and extends GitHub metrics with newly opened PRs. Error handling degrades gracefully, repository scoping is enforced for task records, and no unresolved correctness or security defect is evident in the reviewed code. | The visible chunk correctly separates 24-hour operational-delta formatting from the portfolio/queue snapshot, preserves compatibility fallbacks for older data shapes, and adds explicit source/scope/filter metadata for displayed counts. No unresolved correctness or security defect is evident in this chunk. | The visible triage changes correctly add stable cause derivation, repository-scoped deduplication, deterministic impact scoring, representative selection, bounded samples, collision-aware ranking, and shell-quoted worktree inspection commands. No unresolved correctness or security defects are evident in this chunk. | The visible changes correctly add bounded Git-command timeouts, fail-closed ancestor checks, reusable default-target resolution, lease reuse during worktree audits, deterministic deduplicated triage metadata, and corresponding report/test updates. No unresolved correctness or security defects are evident in this chunk. | The visible chunk adds focused regression coverage for autonomy-stall prioritization, graceful probe degradation, loopback-only daemon access, per-repository lease-read efficiency, structured timeout behavior, and CLI JSON output. No unresolved code or security defect is evident in this chunk. | The visible chunk adds focused tests for distinct day versus summary reporting, explicit count provenance labels, CLI output separation, and triage deduplication with deterministic impact ordering. No code or security defects are evident in this chunk. | The visible chunk adds straightforward assertions verifying the expected deduplicated-action Markdown content and a conventional unittest entry point. No correctness or security defects are evident in this chunk.
Advisory findings: In _probe_heyasa_daemon_status, the velocity_status dictionary branch calls int(open_cands) and int(target_cap) without validation or exception handling. Non-numeric values from the local HTTP JSON payload (for example "unknown", an object, or a list) raise ValueError or TypeError, aborting probe_autonomy_health and potentially the entire fleet diagnosis instead of degrading gracefully. Normalize these fields with guarded conversion, as is already done for the flowguard metrics, and treat invalid values as unavailable.; When the overall deadline has already expired before the repositories phase, the skipped-phase branch still calls find_git_repositories(root). Repository discovery may be expensive and is not deadline-bounded, so diagnose() can continue running beyond its timeout merely to populate skipped_repositories. Avoid discovery after expiration or make discovery itself deadline-aware.; The repository loop initializes repo_leases to None and passes it to audit_worktrees() and prune_and_remediate(); it never calls get_repo_leases(repo). This does not implement the claimed once-per-repository lease lookup and can preserve the repeated per-worktree lookup behavior that MON-02 is intended to eliminate. Fetch leases once per repository within the remaining budget and pass the resulting mapping through.
The LLM output above is advisory and was not used as the approval trust root.
Semantic review prerequisite: not_required; policy 676cb4516bbfed2a000e40b9b1b6e4a430ecc761ec546aeb53d721a1905cfdd7.

Actual PR impact radar

Exact range: d7533c57ab3d5b6505fbfae7fd81ae44da54c468...ed005ba859413f4129173f9d9ccd2d507aac0304
Change digest: ec9a8042f474cc7d2698ba0d38dcc0d135bd8c7c9a4dd798f610291959726be6
Score: 64/100 (L), estimated 150 min, split recommended: true
Affected services/components: repository-wide/unclassified

Machine-readable radar JSONL and SVG
{"actual_change":{"additions":2451,"base_sha":"d7533c57ab3d5b6505fbfae7fd81ae44da54c468","binary_files":0,"categories":{"code":6,"configuration":1,"docs":2,"tests":2},"change_digest":"ec9a8042f474cc7d2698ba0d38dcc0d135bd8c7c9a4dd798f610291959726be6","comparison":"d7533c57ab3d5b6505fbfae7fd81ae44da54c468...ed005ba859413f4129173f9d9ccd2d507aac0304","deletions":191,"file_count":11,"files":["project/TICKETS.md","project/ticket-137/README.md","project/ticket-137/intent.json","src/monag/autodiagnosis.py","src/monag/cli.py","src/monag/doctor.py","src/monag/summary.py","src/monag/triage.py","src/monag/worktrees.py","tests/test_summary_and_subllm_routes.py","tests/test_wave2_mon01_mon04.py"],"head_sha":"ed005ba859413f4129173f9d9ccd2d507aac0304","service_count":0,"services":[]},"assessment_mode":"observed-pr","axes":{"coupling":5,"delivery":2,"scope":5,"uncertainty":3,"validation":1},"complexity":"L","confidence":0.9,"diagnostics":["RADAR-ACCEPTANCE-MISSING","RADAR-BUDGET-EXCEEDED"],"estimate":{"budget_minutes":30,"minutes":150,"within_budget":false},"impact":{"components":["8765","completed","day","merged","portfolio","project","src/monag","subactor","tests","timeout"],"files":["8765/v1/daemon/status","completed/failed","completed/new-blocker","day/summary","merged/opened","portfolio/queue","project/TICKETS.md","project/governance-check.sh","project/ticket-137/README.md","project/ticket-137/intent.json","src/monag/autodiagnosis.py","src/monag/cli.py","src/monag/doctor.py","src/monag/summary.py","src/monag/triage.py","src/monag/worktrees.py","subactor/leases","tests/test_summary_acceptance_probe.py","tests/test_summary_and_subllm_routes.py","tests/test_wave2_mon01_mon04.py","timeout/degradation"],"public_interfaces":[],"runtime_dependencies":0},"schema":"subactor.ticket-radar/v1","score":64,"split":{"parts":[{"estimated_minutes":14,"name":"Implement 8765","scope":["8765"]},{"estimated_minutes":14,"name":"Implement completed","scope":["completed"]},{"estimated_minutes":14,"name":"Implement day","scope":["day"]},{"estimated_minutes":14,"name":"Implement merged","scope":["merged"]},{"estimated_minutes":14,"name":"Implement portfolio","scope":["portfolio"]},{"estimated_minutes":15,"name":"Validate and project to trackers","scope":["tests","planfile","github/gitlab/jira projections"]}],"reason":"estimated_minutes_exceed_budget","recommended":true},"standards":[{"id":"wellmanifest/dsl","revision":"6c60fc4e0dd1f1bb74f46a7745e28019908d1203","version":"0.1.0-dev"},{"id":"wellmanifest/ticket-lifecycle","revision":"5bf581907a87b46a13a73e6c033d3abe4d9a306f","version":"0.1.0-dev"},{"id":"wellmanifest/git-lifecycle","revision":"7d77d4b7af57e69bc75c3a0290b3a4805c5c4438","version":"0.2.0-dev"},{"id":"wellmanifest/logs","revision":"48c284ef7a069055c0bcb6b900147ce5e65f8b43","version":"0.3.0"}],"ticket_ref":"ticket-137"}
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128" role="img"><title>ticket-137: feat(diagnostics): Wave 2 autonomy stall probes, doctor budget, day/summary separation, and triage dedup [ticket-137]</title><rect width="128" height="128" rx="12" fill="#f8fafc"/><g stroke-width="1"><polygon points="64,55 72,61 69,71 59,71 56,61" fill="none" stroke="#d7dde5"/><polygon points="64,47 80,59 74,78 54,78 48,59" fill="none" stroke="#d7dde5"/><polygon points="64,38 89,56 79,85 49,85 39,56" fill="none" stroke="#d7dde5"/><polygon points="64,30 97,53 84,92 44,92 31,53" fill="none" stroke="#d7dde5"/><polygon points="64,21 105,51 89,99 39,99 23,51" fill="none" stroke="#d7dde5"/><line x1="64" y1="64" x2="64" y2="21" stroke="#aab4c0"/><line x1="64" y1="64" x2="105" y2="51" stroke="#aab4c0"/><line x1="64" y1="64" x2="89" y2="99" stroke="#aab4c0"/><line x1="64" y1="64" x2="39" y2="99" stroke="#aab4c0"/><line x1="64" y1="64" x2="23" y2="51" stroke="#aab4c0"/></g><polygon points="64,21 105,51 79,85 59,71 48,59" fill="#fb923c" fill-opacity="0.45" stroke="#c2410c" stroke-width="2"/><circle cx="64" cy="64" r="3" fill="#c2410c"/><g font-family="sans-serif" font-size="7" fill="#334155"><text x="64" y="11" text-anchor="middle">SCO</text><text x="114" y="48" text-anchor="middle">COU</text><text x="95" y="107" text-anchor="middle">UNC</text><text x="33" y="107" text-anchor="middle">VAL</text><text x="14" y="48" text-anchor="middle">DEL</text></g><text x="64" y="124" text-anchor="middle" font-family="sans-serif" font-size="8" fill="#0f172a">L · 150m</text></svg>
Merge will be attempted after this approval when explicitly authorized. ## Decision record (recomputable)
DECISION D-137-8853
TICKET ticket-137
HEAD_SHA ed005ba859413f4129173f9d9ccd2d507aac0304
CORRELATION_ID local-semcod-monag-pr-166-ticket-137
ACTOR agent:ifuri-validator-agent[bot]
APPLIED_RULE P-CORE-015
INPUT author_login = "tom-sapletta-com"
INPUT observed_checks = ["governance / remote lifecycle=PASS","governance / enforce=PASS","onedev/local-verify=PASS"]
INPUT required_checks = ["onedev/local-verify","governance / remote lifecycle","governance / enforce"]
INPUT required_checks_source = "protected registry (env/request)"
INPUT reviewer_login = "ifuri-validator-agent[bot]"
INPUT semantic_review_assessment = {"schema":"subactor.validator/semantic-review-assessment/v1","subject":{"repository":"semcod/monag","pull_request":166,"head_sha":"ed005ba859413f4129173f9d9ccd2d507aac0304","base_sha":"d7533c57ab3d5b6505fbfae7fd81ae44da54c468","diff_sha256":"49f27641608ef84434c259b3c8c242897079f6fb0468df9ec045084d34f59826"},"policy":{"policy_schema":"subactor.validator/semantic-review-policy/v1","policy_version":1,"policy_sha256":"676cb4516bbfed2a000e40b9b1b6e4a430ecc761ec546aeb53d721a1905cfdd7","required":false,"critical_paths":[],"observed_paths":["project/TICKETS.md","project/ticket-137/README.md","project/ticket-137/intent.json","src/monag/autodiagnosis.py","src/monag/cli.py","src/monag/doctor.py","src/monag/summary.py","src/monag/triage.py","src/monag/worktrees.py","tests/test_summary_and_subllm_routes.py","tests/test_wave2_mon01_mon04.py"]},"grounding":"full-diff-not-per-finding-proof","execution_authority":false,"status":"not_required","reason":null,"review_sha256":null,"unresolved":[]}
INPUT superseded_checks = []
INPUT ticket_radar_receipt = {"schema":"subactor.ticket-radar/v1","base_sha":"d7533c57ab3d5b6505fbfae7fd81ae44da54c468","head_sha":"ed005ba859413f4129173f9d9ccd2d507aac0304","change_digest":"ec9a8042f474cc7d2698ba0d38dcc0d135bd8c7c9a4dd798f610291959726be6","score":64,"complexity":"L","estimated_minutes":150,"split_recommended":true,"services":[],"authority":"ADVISORY","promotion":"FORBIDDEN"}
VERDICT APPROVE AUTHORITY DETERMINISTIC
REJECTED REQUEST_CHANGES BECAUSE NO_UNSAFE_CHANGE_REASON_FOUND
ADVISORY llm_verdict = "REQUEST_CHANGES" MODEL "openai/cursor-auto"
ASSERT VERDICT_AUTHORITY != "ADVISORY"

@ifuri-validator-agent
ifuri-validator-agent Bot merged commit ee1cff9 into main Nov 14, 2026
3 checks passed
@ifuri-validator-agent
ifuri-validator-agent Bot deleted the ticket/137-wave2-autonomy-diagnostics branch November 14, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment