feat: session degradation watch - alert when an agent's model or permission mode slips#47
Conversation
…ission mode slips Per-machine daemon reading watched agents' session transcripts: message.model outside the accepted prefix set, or permissionMode differing from the expected one, posts an immediate room alert (CodeWatch push) with 30-min cooldown and a recovery note. Born from the 2026-07-18 incident where a session silently fell back to Haiku with manual permissions and the degraded agent looped for an evening undiagnosed. Tested: --dry-run healthy (silent), simulated model+permission slip (both alerts fire), live daemon running on the Mini watching claudemm. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a035e54fa
ℹ️ 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".
| await postAlert(cfg, badText); | ||
| st.lastAlert = now; |
There was a problem hiding this comment.
Retry alerts that fail to post
When GroupMind returns a non-2xx response, postAlert only logs and resolves, so this line still advances lastAlert and the first slip is suppressed for the full 30-minute cooldown even though no room/phone alert was delivered. In deployments where the API key is stale or GroupMind has a transient 5xx, the daemon records the signal as alerted and stays quiet; make postAlert report success or throw before updating the cooldown.
Useful? React with 👍 / 👎.
| @@ -0,0 +1,175 @@ | |||
| #!/usr/bin/env node | |||
There was a problem hiding this comment.
This new bin script has a shebang but was committed with mode 100644 (checked with git ls-tree; neighboring bin/cli.mjs and bin/iak-mcp-daemon.mjs are 100755). If the process supervisor follows the documented bin/iak-degradation-watch.mjs invocation instead of node ..., startup fails with EACCES, leaving machines unwatched.
Useful? React with 👍 / 👎.
What
Petrus (2026-07-18): "yes implement the settings degradation watch claudemm, with notification alert if a model has slipped".
A per-machine daemon (
bin/iak-degradation-watch.mjs) that tails watched agents' Claude Code session transcripts and posts a room alert (CodeWatch pushes it to the owner's phone) when:message.modelis outside the agent'saccepted_modelsprefix list (e.g. a silent Haiku fallback), orpermissionModediffers fromexpected_permission_mode(e.g. auto-approve silently became manual prompts).Why
Today an agent's session slipped to Haiku + manual permissions while the owner was out. The degraded agent kept posting - looping on stale tasks, reposting completed instructions - and it cost an evening to diagnose. Both signals were sitting in the transcript the whole time.
Design
degradation_watchblock in the daemon config), api key reusespoller.api_key.--once/--dry-runfor testing. No dependencies.Tested
Follow-ups (not this PR)
@codexmb adversarial review requested (cross-model rule).
🤖 Generated with Claude Code