Repository navigation
feat(fm-session-start): integrate parlay sweep into supervision surface #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -745,6 +745,35 @@ heartbeat_scan_finds_actionable() { | |||||||||||||||
| return 1 | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| # parlay_heartbeat_payload: build the heartbeat wake-queue payload including a | ||||||||||||||||
| # compact parlay sweep summary. When parlay is absent, returns plain "heartbeat". | ||||||||||||||||
| # Surfaces only needs-decision, blocked, and failed HOLD lines; truncates each | ||||||||||||||||
| # to 80 chars. Read-only and safe to call at any time. | ||||||||||||||||
| parlay_heartbeat_payload() { | ||||||||||||||||
| local sweep held count line summary | ||||||||||||||||
| command -v parlay >/dev/null 2>&1 || { printf 'heartbeat'; return 0; } | ||||||||||||||||
| sweep=$(parlay sweep 2>/dev/null) || sweep= | ||||||||||||||||
| held=$(printf '%s\n' "$sweep" | grep -E '^HOLD[[:space:]].*state=(needs-decision|blocked|failed)' || true) | ||||||||||||||||
| count=0 | ||||||||||||||||
| [ -n "$held" ] && count=$(printf '%s\n' "$held" | grep -c .) | ||||||||||||||||
| if [ "$count" -eq 0 ]; then | ||||||||||||||||
| printf 'heartbeat | parlay: none held' | ||||||||||||||||
| return | ||||||||||||||||
| fi | ||||||||||||||||
| summary="heartbeat | parlay: ${count} agent(s) held" | ||||||||||||||||
| while IFS= read -r line; do | ||||||||||||||||
| [ -n "$line" ] || continue | ||||||||||||||||
| if [ "${#line}" -gt 80 ]; then | ||||||||||||||||
| summary="${summary} | ${line:0:80}" | ||||||||||||||||
| else | ||||||||||||||||
| summary="${summary} | ${line}" | ||||||||||||||||
| fi | ||||||||||||||||
| done <<EOF | ||||||||||||||||
| $held | ||||||||||||||||
| EOF | ||||||||||||||||
| printf '%s' "$summary" | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| # event_wait_or_sleep: the terminal wait of each supervision cycle. For a home | ||||||||||||||||
| # with push-capable windows (herdr), it replaces the blind `sleep POLL` with a | ||||||||||||||||
| # bounded wait on the backend's native transition stream, so a crew going | ||||||||||||||||
|
|
@@ -1383,14 +1412,14 @@ EOF | |||||||||||||||
| # without exiting); the away-mode daemon, when present, owns triage and wants | ||||||||||||||||
| # every heartbeat. | ||||||||||||||||
| if afk_present; then | ||||||||||||||||
| fm_wake_append heartbeat heartbeat heartbeat || exit 1 | ||||||||||||||||
| fm_wake_append heartbeat heartbeat "$(parlay_heartbeat_payload)" || exit 1 | ||||||||||||||||
| touch "$STATE/.last-heartbeat" | ||||||||||||||||
| wake "heartbeat" | ||||||||||||||||
|
Comment on lines
+1543
to
1545
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Publish the generated payload. Line 1415 queues the Parlay-aware payload. Line 1417 publishes the fixed Build the payload once. Pass it to both Proposed fix- fm_wake_append heartbeat heartbeat "$(parlay_heartbeat_payload)" || exit 1
+ heartbeat_payload=$(parlay_heartbeat_payload)
+ fm_wake_append heartbeat heartbeat "$heartbeat_payload" || exit 1
touch "$STATE/.last-heartbeat"
- wake "heartbeat"
+ wake "$heartbeat_payload"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| elif heartbeat_scan_finds_actionable; then | ||||||||||||||||
| # Backstop: a captain-relevant status the per-wake path absorbed by mistake. | ||||||||||||||||
| # Enqueue first, then mark every captain-relevant status surfaced so the next | ||||||||||||||||
| # heartbeat does not re-fire them (enqueue-before-suppress preserved). | ||||||||||||||||
| fm_wake_append heartbeat heartbeat heartbeat || exit 1 | ||||||||||||||||
| fm_wake_append heartbeat heartbeat "$(parlay_heartbeat_payload)" || exit 1 | ||||||||||||||||
| touch "$STATE/.last-heartbeat" | ||||||||||||||||
| mark_all_captain_relevant_surfaced | ||||||||||||||||
| wake "heartbeat" | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Match complete Parlay state values.
The current regex accepts unsupported values such as
state=failed-retryablebecause it does not require a boundary after the allowed state. This conflicts with the documented exact-state filter.bin/fm-session-start.sh#L473-L473: require whitespace or end-of-line afterneeds-decision,blocked, orfailed.tests/fm-session-start.test.sh#L2049-L2055: add astate=failed-retryablefixture and assert that the digest suppresses it.Proposed fix
📝 Committable suggestion
📍 Affects 2 files
bin/fm-session-start.sh#L473-L473(this comment)tests/fm-session-start.test.sh#L2049-L2055🤖 Prompt for AI Agents