Skip to content

feat(monitor): add monitor primitive with poll-until-finalizer and state persistence#20

Merged
jorisjonkers-dev-agents[bot] merged 2 commits into
mainfrom
feat/monitor-primitive
Jul 12, 2026
Merged

feat(monitor): add monitor primitive with poll-until-finalizer and state persistence#20
jorisjonkers-dev-agents[bot] merged 2 commits into
mainfrom
feat/monitor-primitive

Conversation

@jorisjonkers-dev-agents

Copy link
Copy Markdown
Contributor

Summary

Adds a first-class monitor CLI command to the council orchestrator that replaces ad-hoc background polling loops with a structured, owned primitive.

  • monitor start --name <n> --interval <dur> --deadline <dur> --cmd <probe> --until <predicate> --then <finalizer> --exec-dir <dir> — synchronous poll loop; on predicate match runs the finalizer in the same process; on deadline fails loudly with last probe output
  • monitor status --name <n> --exec-dir <dir> — reads and prints current state from monitors/<name>.json
  • monitor list --exec-dir <dir> — lists all monitors with dead-monitor detection (last tick >2.5x interval ago while still polling)

Built-in probes: probe:actions-runs-for-sha, probe:pr-mergeable, probe:ghcr-package-visible.

State file persisted at <exec-dir>/monitors/<name>.json with fields: name, status, startedAt, deadline, lastTickAt, lastOutput, intervalMs, cmd, until, then.

Fixes #19

Test plan

  • 64 test files, 644 tests pass (npm test in council/ts/)
  • TypeScript type check clean (tsc --noEmit)
  • Domain unit tests: parseDuration, isMonitorDead, evaluatePredicate
  • Workflow tests: predicate-match→finalizer, deadline timeout, state file shape, dead-monitor detectability
  • CLI routing tests: monitor start/status/list subcommands
  • Composition integration tests: CouncilApp.monitor wiring

@jorisjonkers-dev-agents jorisjonkers-dev-agents Bot added the type: feature New user-facing or operator-facing capability. label Jul 12, 2026
…on in built-in probes

Avoids token exposure in process arguments visible to other processes on the host.
@jorisjonkers-dev-agents jorisjonkers-dev-agents Bot merged commit b1c06c3 into main Jul 12, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature New user-facing or operator-facing capability.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agent-kit: first-class monitor primitive (poll-until-condition with owned finalizer)

1 participant