Skip to content

fix: preserve agent for scheduled reminders#4

Open
kernel-oops wants to merge 1 commit into
zelenkovsky:mainfrom
kernel-oops:fix/preserve-reminder-agent
Open

fix: preserve agent for scheduled reminders#4
kernel-oops wants to merge 1 commit into
zelenkovsky:mainfrom
kernel-oops:fix/preserve-reminder-agent

Conversation

@kernel-oops

Copy link
Copy Markdown

Summary

Preserve the agent that scheduled a reminder and use it when the reminder fires.

  • capture ToolContext.agent when reminderadd creates a reminder
  • persist the agent in the reminder record
  • pass the saved agent to session.prompt() during execution
  • keep legacy persisted reminders compatible by making the field optional and omitting body.agent when it is absent

Root cause

Reminder execution submitted only body.parts. OpenCode therefore fell back to the configured default agent, so a reminder scheduled from one agent could unexpectedly run as another agent and inherit different permissions or behavior.

Tests

  • reminder creation persists the scheduling agent
  • execution forwards the saved agent
  • legacy reminder records still parse and omit the prompt agent field

Verified locally:

bun test
49 pass, 0 fail

bun x tsc --noEmit
pass

git diff --check
pass

Relationship to #2 and #3

This PR is intentionally based directly on main and addresses a separate agent-selection issue. It does not depend on the cancellation-race changes in #2 or the cross-process coordination changes in #3, though overlapping scheduler/test files may require integration after another PR merges.

@kernel-oops

Copy link
Copy Markdown
Author

A consolidated integration PR is now available at #5. It deliberately combines #2, #3, and #4, resolves their overlapping scheduler changes, and adds regression fixes found while stress-testing the combined lifecycle. This PR is left open for history/discussion, but the consolidated PR is the recommended merge path.

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.

2 participants