Skip to content

feat(watcher): add fm-jules-check.sh poll arm for Jules coding-agent sessions - #511

Closed
blazingbunny wants to merge 3 commits into
kunchenguid:mainfrom
blazingbunny:fm/fm-jules-watch-wire
Closed

blazingbunny wants to merge 3 commits into
kunchenguid:mainfrom
blazingbunny:fm/fm-jules-watch-wire

Conversation

@blazingbunny

Copy link
Copy Markdown

Intent

Add watcher poll arm for Jules coding-agent sessions so firstmate can wake on session state transitions instead of manually polling jules-axi

What Changed

  • Added bin/fm-jules-check.sh, a watcher poll-arm script (same pattern as fm-pr-check.sh) that calls jules-axi watch and records jules_session= in state/<id>.meta so the watcher can wake firstmate on Jules session state transitions instead of manual polling.
  • Fixed a re-arm bug where invoking the script again for the same task id with a different jules_session left the previous poll's watermark file (state/<id>.jules.state) in place; the watermark is now cleared on re-arm so a changed session doesn't inherit a stale state.
  • Registered the new script and its jules_session= meta field in docs/scripts.md's toolbelt table and AGENTS.md's state/<id>.meta field list, and fixed 3 other stale doc references to check-poll wake mechanics that omitted the Jules session poll.
  • Added tests/fm-jules-check.test.sh covering the script's behavior.

Risk Assessment

✅ Low: Round-1 findings (stale watermark on re-arm, missing docs registration) are both correctly fixed, tests cover the fix, and the new script/doc entries closely mirror the existing fm-pr-check.sh pattern with no new issues introduced.

Testing

  • ⏭️ Test - skipped

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 2 issues found → auto-fixed ✅
  • ⚠️ bin/fm-jules-check.sh:23 - When fm-jules-check.sh is invoked again for the same task id with a different jules_session (a legitimate re-arm, e.g. a retried Jules run), the previous poll's watermark file state/<id>.jules.state is never removed. jules-axi watch is handed a state file that was populated while watching a different session id. If jules-axi's state format doesn't itself key on session id, this can suppress the first real transition of the new session (watcher stays silent) or otherwise misreport transitions. The idempotency check only guards exact-duplicate session values (line 19), not a changed session for the same id.
  • ℹ️ docs/scripts.md - bin/fm-jules-check.sh follows the same 'arm the watcher's poll' pattern as fm-pr-check.sh, which is listed in docs/scripts.md's bin/ toolbelt table and whose meta field (pr=/pr_head=) is called out in AGENTS.md section 2's state/<id>.meta field list. The new script and its jules_session= meta field aren't added to either, breaking that documentation convention and making the new tool undiscoverable via the toolbelt table.

🔧 Fix: fix: clear stale jules watermark on session re-arm, register script in docs
✅ Re-checked - no issues remain.

⏭️ **Test** - skipped

Step was skipped.

✅ **Document** - passed

✅ No issues found.

🔧 **Lint** - 1 issue found → auto-fixed (2) ✅
  • ⚠️ linter found issues (exit code 1)

🔧 Fix: No fix needed: shellcheck 0.11.0 run is clean, local binary was stale
1 warning still open:

  • ⚠️ linter found issues (exit code 1)

🔧 Fix: No fix needed: shellcheck 0.11.0 confirmed clean on full run
✅ Re-checked - no issues remain.

✅ **Push** - passed

✅ No issues found.

bin/fm-jules-check.sh mirrors fm-pr-check.sh's structure: appends
jules_session= to state/<id>.meta idempotently, then writes
state/<id>.check.sh that polls jules-axi watch for state transitions.
The generated check.sh is thin (4 lines) — jules-axi watch already owns
the no-change-is-silent contract.

tests/fm-jules-check.test.sh covers: first-arm meta append, idempotent
re-arm, check.sh invocation shape, silence-on-no-output, transition echo,
and graceful exit when jules-axi is absent.
…e mechanics that omitted the new Jules session poll; no gaps remain unresolved.
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