Skip to content

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
fix/rpc-reminder-callback
Open

fix: fire reminders via HTTP callback in RPC mode#23
vers-landing-github-prod[bot] wants to merge 1 commit intofeat/reef-v2-orchestrationfrom
fix/rpc-reminder-callback

Conversation

@vers-landing-github-prod
Copy link
Copy Markdown

Problem

remind_me accepts 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:

  1. Reef kills the pi process on agent_end (src/reef.ts:240). Pi processes are ephemeral — one process per task. When remind_me schedules a setTimeout, either:

    • The timer fires during the agent turn → queued as followUp, but the process gets SIGTERMed before the followUp executes
    • The timer fires after agent_end → process is already dead
  2. sendUserMessage has nowhere to go in RPC mode. Even if the process survived, sendUserMessage injects 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: Pass REEF_CALLBACK_URL env var to spawned pi processes, pointing at reef's own HTTP server.

extensions/reminders.ts: When a reminder fires and REEF_CALLBACK_URL is set, POST to {url}/tasks to trigger a new independent task with the reminder message as the prompt. Falls back to sendUserMessage if 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

  • punkin-pi#7 — adds generic RPC callback support to sendUserMessage in the agent session (broader fix for any extension, not just reminders)

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.
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.

0 participants