Skip to content

feat(temporal): Gave a session a start that needs no client. - #19

Closed
moetemp wants to merge 1 commit into
moe/l3-detached-sessionsfrom
moe/scheduled-prompts
Closed

moetemp wants to merge 1 commit into
moe/l3-detached-sessionsfrom
moe/scheduled-prompts

Conversation

@moetemp

@moetemp moetemp commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

This PR adds opencode session schedule, a turn nobody starts.

session start still needs something running to hand the prompt to. A schedule does not: it creates a Temporal schedule whose firing runs scheduledPrompt, a workflow that admits the prompt itself and starts the session's supervisor as an abandoned child, or signals it when it is already running. At firing time there is no client and no serve process.

Admission is an activity, because a prompt is a row in the store and a workflow cannot write one. It carries no execution owner, so it leaves the runner's claim on the session alone, and the message id comes from the firing's own workflow id, so a re-drive admits the same prompt once. Overlapping firings are skipped rather than stacked; a firing that lands while the last turn is still working is queued and drained when that turn ends.

packages/opencode gains @temporalio/client and @temporalio/common for the command, loaded only when it runs. Tests: schedule-drain.test.ts, scheduled-prompt-workflow.test.ts, and step 6 of detached-session-check.sh.

@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

`session schedule` creates a Temporal schedule whose firing runs a workflow that admits the prompt itself and starts the session's supervisor, so at firing time there is no client and no serve process. Admission is an activity because a prompt is a row in the store, and the message id comes from the firing's workflow id so a re-drive admits the same prompt once.
@moetemp
moetemp force-pushed the moe/scheduled-prompts branch from 6dddbda to 99f8e00 Compare September 15, 2026 01:01
@moetemp
moetemp force-pushed the moe/l3-detached-sessions branch from c980eb6 to 494742b Compare September 15, 2026 01:01
@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

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