buzz-acp: heartbeat feed mentions have no thread context — responses go unthreaded or silent
- Dominant language
- Rust
- Stars
- 32.7k
- Forks
- 4.3k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 253
Description
## Summary
Agents processing @mentions during **heartbeat turns** have no thread context and send unthreaded replies (or no replies at all), even though the triggering mention was in a thread. This is a distinct issue from #3825/#3908, which fixed the **normal dispatch path**.
## Root Cause
`dispatch_heartbeat` (`lib.rs:3923-3956`) calls `default_heartbeat_prompt` (`lib.rs:4012-4028`) with `batch=None`. The prompt instructs the agent to call `buzz feed get --types mentions`, but gives **no `--reply-to` instruction** for how to reply to those mentions.
The normal dispatch path injects `IMPORTANT: For ordinary replies in this turn, use --reply-to ` via `append_reply_instruction` (`queue.rs:1149-1156`), but that function is **never called** in the heartbeat path.
**Result:** When an agent finds an @mention in `buzz feed get` during a heartbeat, it has no thread root and either:
- Sends a reply without `--reply-to` (creating a new top-level message instead of threading), or
- Sends no reply at all
## Observed Symptom
Users see agent activity in the observer/activity feed (kind:24200 encrypted frames) showing the agent processed a turn, but **no channel message** appears in the thread.
Confirmed in channel COMPDE-454 — Osmosmith messages appeared in the activity feed but not in the thread for several mentions processed during heartbeat turns.
## Suggested Fix
Extend `default_heartbeat_prompt` (`lib.rs:4012-4028`) to explicitly instruct:
> For each actionable feed @mention:
> 1. Call `buzz messages thread --channel --event ` to resolve the thread root
> 2. Send your reply using `--reply-to `
**Do NOT pre-resolve in the harness** — the harness does not know which feed items the agent will retrieve or act on. The instruction must be in the prompt.
If custom persona `heartbeat_prompt` overrides exist, the durable rule should also live in the shared base prompt to cover all heartbeat turns.
## Test Gap
- No test exercises the heartbeat path where an agent replies to a feed-sourced @mention and verifies `--reply-to` is present or instructed
- `test_format_prompt_single` tests normal dispatch but not the heartbeat code path
## PR Overlap Check
- **PR #3908** fixes top-level vs threaded replies in the **normal dispatch path** (`queue.rs`). It does NOT touch the heartbeat path.
- **PR #3183** propagates automatic reply context for normal batches but **explicitly clears it** for heartbeat turns. It does NOT fix feed-driven heartbeat replies.
## Affected Code
| File | Lines | Issue |
|------|-------|-------|
| `crates/buzz-acp/src/lib.rs` | 3923-3956 | `dispatch_heartbeat` — passes `batch=None`, no thread context injected |
| `crates/buzz-acp/src/lib.rs` | 4012-4028 | `default_heartbeat_prompt` — no `--reply-to` hint for feed-driven replies |
| `crates/buzz-acp/src/queue.rs` | 1149-1156 | `append_reply_instruction` only fires on normal dispatch, not heartbeat |
## Confidence: High
Confirmed against `origin/main@07a3c768` (2026-08-10) by Grumplestiltzkin.
## Related Issues
- #3825 — "Agent reply visible in Activity log but not displayed in channel/thread" (symptom)
- #3908 — Fixes the **normal dispatch path**, not the heartbeat path
## Research
Full investigation: `RESEARCH/AGT_01_AGENT_ACTIVITY_NOT_THREAD.md` in the Buzz workspace
Contributor guide
Research direction
Start in crates/buzz-acp/src/lib.rs at dispatch_heartbeat and default_heartbeat_prompt, then compare the normal dispatch behavior in queue.rs at append_reply_instruction. Update the heartbeat guidance for feed-sourced mentions and add coverage for this heartbeat path alongside test_format_prompt_single. Done means actionable mentions can resolve their thread and replies include the appropriate --reply-to context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100