fix: fire reminders via HTTP callback in RPC mode#23
Open
vers-landing-github-prod[bot] wants to merge 1 commit intofeat/reef-v2-orchestrationfrom
Open
fix: fire reminders via HTTP callback in RPC mode#23vers-landing-github-prod[bot] wants to merge 1 commit intofeat/reef-v2-orchestrationfrom
vers-landing-github-prod[bot] wants to merge 1 commit intofeat/reef-v2-orchestrationfrom
Conversation
In RPC mode, pi processes are ephemeral — reef kills them on agent_end. When remind_me schedules a setTimeout, the timer either fires after the process is dead, or fires during the turn but the followUp never executes because the process gets SIGTERMed. Fix: Pass REEF_CALLBACK_URL env var to spawned pi processes. When a reminder fires and this env var is set, POST to reef's /tasks endpoint to trigger a new independent task instead of calling sendUserMessage (which has nowhere to go in RPC mode). In interactive/TUI mode, sendUserMessage still works as before since REEF_CALLBACK_URL won't be set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
remind_meaccepts the call and returns success in RPC mode, but the reminder never fires. The agent has to receive a manual message to continue.Root cause
Two layers:
Reef kills the pi process on
agent_end(src/reef.ts:240). Pi processes are ephemeral — one process per task. Whenremind_meschedules asetTimeout, either:agent_end→ process is already deadsendUserMessagehas nowhere to go in RPC mode. Even if the process survived,sendUserMessageinjects a message into the session queue. But in RPC mode, reef is the conversation loop owner — it only reads events in response to commands it sends. Unsolicited agent turns stream to stdout but nobody is listening.In interactive/TUI mode this works fine because punkin owns the conversation loop and can inject new turns whenever it wants.
Fix
src/reef.ts: PassREEF_CALLBACK_URLenv var to spawned pi processes, pointing at reef's own HTTP server.extensions/reminders.ts: When a reminder fires andREEF_CALLBACK_URLis set, POST to{url}/tasksto trigger a new independent task with the reminder message as the prompt. Falls back tosendUserMessageif the callback fails or if the env var isn't set (interactive mode).This is the minimal fix — the reminder becomes a new task rather than trying to inject into a dead/disconnected process.
Companion PR
sendUserMessagein the agent session (broader fix for any extension, not just reminders)