Skip to content

Queue injected messages behind active agent turns#341

Merged
marccampbell merged 3 commits into
mainfrom
fix-stuck-review-injections
Jun 3, 2026
Merged

Queue injected messages behind active agent turns#341
marccampbell merged 3 commits into
mainfrom
fix-stuck-review-injections

Conversation

@marccampbell

Copy link
Copy Markdown
Contributor

Summary

  • treat model_started and active tool activity as a busy agent turn, even before assistant chunks arrive
  • clear busy state when any completed claw message arrives, including silent/no-chunk turns
  • persist and display PR watcher injected messages immediately, but queue them behind active turns instead of writing directly to the bridge

Tests

  • env GOCACHE=/private/tmp/elasticclaw-go-build go test ./pkg/hub

@greptile-apps

greptile-apps Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff (2)

  1. pkg/hub/server.go, line 4780-4784 (link)

    P2 sendNextQueuedMessage duplicates the busy-check inline instead of calling the new isBusyLocked() helper. If the predicate ever changes (e.g. a third field is added to the busy state), this copy would silently diverge.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

  2. pkg/hub/pr_watcher.go, line 613-640 (link)

    P2 delivered flag and "delivered" log are misleading in the failure branch

    delivered = true is set unconditionally in both the happy path and the error path (after re-queuing a failed write). The subsequent log.Printf("[pr-watcher] delivered injected message …") then fires even though the message was only prepended to the retry queue. During incident investigation, a log that says "delivered" when the message was actually queued-after-failure can send debugging in the wrong direction.

Reviews (1): Last reviewed commit: "Queue injected messages behind active tu..." | Re-trigger Greptile

Comment thread pkg/hub/pr_watcher.go Outdated
@marccampbell marccampbell merged commit 6b8d992 into main Jun 3, 2026
10 checks passed
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