fix(queue): deliver a queued slash command with context as a prompt
OpenCode's command route accepts file parts only. The server queue was attaching captured context as text parts to POST /session/:id/command, so a slash command queued with a comment, quote, or PR diff was rejected with 400 and retried forever. A command queued without context still takes the command route with its files. One queued with context now takes the prompt route the way the composer does: the command's template is expanded with its arguments, a skill keeps its text and gets the explicit skill-invocation instruction, and the context rides along. Claude-Session: https://claude.ai/code/session_01VqV56Hez25hTxXH4ipJfzH
This commit is contained in:
@@ -95,13 +95,19 @@ persisted "sending" flag would strand a message forever.
|
||||
the tick re-arms with backoff.
|
||||
5. The head is marked in flight (broadcast), then sent:
|
||||
- text starting with `/` that names a command in OpenCode's `/command`
|
||||
list (skills included) goes to `POST /session/:id/command` with the
|
||||
captured model, agent, variant, and file parts;
|
||||
list (skills included) and carries no captured context goes to
|
||||
`POST /session/:id/command` with the captured model, agent, variant, and
|
||||
file parts. That route accepts file parts only, so a command queued
|
||||
**with** context takes the prompt route instead, the same rule the
|
||||
composer applies: the command's template is expanded with its arguments
|
||||
(`$ARGUMENTS`, `$1..$N`, or appended), a skill keeps its `/name args` text
|
||||
and gets an explicit "the user invoked this skill" synthetic part after
|
||||
the context;
|
||||
- otherwise `POST /session/:id/prompt_async` with the parts in the same
|
||||
order a UI send uses: text, files, the captured context, pending project
|
||||
knowledge (`sessionKnowledgeRuntime.resolvePendingForSession`, synthetic,
|
||||
recorded as delivered only after the prompt is accepted), then the agent
|
||||
mention. The command path sends files and captured context as `parts`.
|
||||
order a UI send uses: text, files, the captured context, the skill
|
||||
invocation when there is one, pending project knowledge
|
||||
(`sessionKnowledgeRuntime.resolvePendingForSession`, synthetic, recorded
|
||||
as delivered only after the prompt is accepted), then the agent mention.
|
||||
Success removes the item, persists, broadcasts, and marks the user
|
||||
message sent for notifications. Failure keeps the item, backs off
|
||||
2 s → 60 s (doubling per consecutive failure of that item), and re-arms.
|
||||
|
||||
Reference in New Issue
Block a user