Skip to content

Watchdog is blind inside Incus VMs: add guest-CPU activity signal so busy-but-silent agents aren't killed - #566

Merged
AdamFrisby merged 3 commits into
mainfrom
codeybox/2a07eb4d
Sep 24, 2026
Merged

AdamFrisby merged 3 commits into
mainfrom
codeybox/2a07eb4d

Conversation

@AdamFrisby

Copy link
Copy Markdown
Owner

Automated via CodeyBox — work item 2a07eb4dc99247e092b95c0bee4b605c

Initiated by CodeyBox operator


Co-Authored-By: CodeyBox noreply@codeybox.invalid
🤖 Generated with CodeyBox

AdamFrisby and others added 3 commits September 24, 2026 18:17
…signal so busy-but-silent agents aren't killed

CodeyBox-WorkItem: 2a07eb4dc99247e092b95c0bee4b605c
CodeyBox-Agent: antigravity/gemini-3.8-flash-high
CodeyBox-Prompt-Revision: 1
Co-Authored-By: CodeyBox <noreply@codeybox.invalid>
…guest-CPU activity signal so busy-but-silent agents aren't killed

CodeyBox-WorkItem: 2a07eb4dc99247e092b95c0bee4b605c
CodeyBox-Agent: antigravity/gemini-3.8-flash-high
Co-Authored-By: CodeyBox <noreply@codeybox.invalid>
…and add the required tests

Audit rework: the previous commit added the sampling machinery but never
connected it, so the watchdog signal could never fire.

- IncusSandboxProvider now overrides SnapshotActiveSandboxProgressAsync:
  per-owned-sandbox cpu.usage sampling via an injected
  IIncusInstanceStateReader, a per-sandbox cache gated by
  ActivitySampleInterval, serialized refreshes, bounded fan-out, and an
  epoch-countered status that changes only while the guest exceeds
  ActivityCpuThresholdPercent. Sync SnapshotActiveSandboxProgress reports the
  same last-known projection.
- DefaultIncusInstanceStateReader now validates the instance name and options
  identity before interpolating them into the incus query path.
- IncusCpuActivityEvaluator reduced to Evaluate + IsActive; dropped the
  lossy implicit bool, the redundant fraction/primitive overloads, and the
  unused CpuPercent; sample Timestamp is now consumed for elapsed.
- WorkerProgressActivitySource rethrows caller cancellation instead of
  downgrading it to no-signal; watchdog debug log collapsed to one template
  carrying the measured CPU fraction; CpuFraction units documented on both
  contracts; ReloadableSandboxProvider fans provider snapshots out in
  parallel.
- Tests: pure-function coverage of the evaluator (first sample, counter
  reset/regression, threshold boundary, bad elapsed/threshold), the state
  parser, and the reader's input guards; provider tests with a fake state
  reader (busy guest changes the signature, idle/failed/within-interval
  keep it stable); FakeTimeProvider watchdog integration proving a silent
  busy Incus guest is not recovered past ProgressTimeout while a silent
  idle guest is.

CodeyBox-WorkItem: 2a07eb4dc99247e092b95c0bee4b605c
CodeyBox-Agent: antigravity/gemini-3.8-flash-high
CodeyBox-Prompt-Revision: 1
Co-Authored-By: CodeyBox <noreply@codeybox.invalid>
@AdamFrisby
AdamFrisby merged commit afe6949 into main Sep 24, 2026
@AdamFrisby
AdamFrisby deleted the codeybox/2a07eb4d branch September 24, 2026 22:04
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.

1 participant