Repository navigation
feat(improve): start a cycle on the observe daemon's score regression - #1000
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Record a regression once per agent and revision across daemon restarts, keep a failed marker insert from costing the sweep its alerts, prune old markers, match an agent id before a name, and keep one live watcher entry per agent directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
S26 of the M4 plan (
m3-notes/m4/parity.md). Paper B detects within the session, while a 15-minute timer waiting forminNewFailuresreacts slowly. When the observe daemon's sweep raisesagent.score_regression(S9), the watcher should start a cycle on its next tick withtrigger: 'score'. The daemon stays read-only towards agent directories and spawns nothing.Changes
src/observe/schema.ts: a forward-only migration adding a smallscore_regressionstable (agent_id,revision,at,details). A table rather than rows inscores, so markers never show up as scores or low-score failures.src/observe/sweep.ts:agent.score_regressionthe sweep raises is recorded there, once per agent and revision, also across daemon restarts (the in-memory edge memory used to reset);startStatusSweepkeeps the score pass on even without an alert sink, so markers are written whether or not webhooks are configured;pruneBefore) prunes old markers;scoreRegressionsSince(db, agent, since)matches the agent id, else its registered name.src/improve/watch.ts: each tick polls the markers newer than the last one it acted on, for the current revision (or unstamped runs). One starts a cycle withtrigger: 'score', skipping the dedupe.healOncestill enforces the lock, the kill switch, the cooldown and every daily cap, and the marker is consumed only by a cycle that did work, so a blocked or paused tick retries it.src/improve/watchers.ts: the watcher registers{ agent, dir, owner, pid }inwatchers.jsonbeside the observe db while it runs (the CLI passes it). There is one entry per agent directory, and entries of dead processes are dropped. The file is informational for now.docs/observability.md.Testing
src/improve/watch.test.ts: a regression marker triggers a cycle with triggerscore(wherefailureswould be idle), and the next tick is back tofailures; a marker for another revision is ignored; a score cycle still hits the automatic-apply cap and the cooldown after an audited rollback; a paused tick keeps the marker for the next tick; the registry holds one entry per directory and drops a dead watcher;watchAgentregisters and unregisters.src/observe/scoreRegressionAlert.test.ts: the daemon records a marker without an alert sink and writes nothing outside the db (the agent directory and its parent are unchanged); lookup by id and by name; a restarted sweep doesn't record the same revision again; a steady series records nothing.idle, as documented.api:update+api:check,docs:llms+docs:llms:check,docs:verify-snippets -- --skip-build,docs:ratchet(1724), vitestsrc/improve src/cli src/observe,npx fallow audit --base origin/mainafter scoped coverage.🤖 Generated with Claude Code