Repository navigation
feat(opencode): add /loop command - #51974
Closed
rudolf-blue wants to merge 3 commits into
Closed
rudolf-blue wants to merge 3 commits into
rudolf-blue wants to merge 3 commits into
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
|
Just moved from CC to OpenCode, with one foot still in CC, mostly because of the /loop. We need this. |
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
3 of 6 tasks
rudolf-blue
added a commit
to rudolf-blue/opencode
that referenced
this pull request
Oct 11, 2026
Sends a prompt now and again on an interval, e.g. /loop 5m check the deploy. Port of anomalyco#51974 to v2 as a built-in command plugin.
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.
Issue for this PR
Refs #41907. That issue asks for a count or retry-until-pass loop. This PR covers the timer form from #18001 and #23578, which were both auto-closed for inactivity.
Type of change
What does this PR do?
Adds a built-in
/loopcommand that sends a prompt right away and then again on a fixed interval, e.g./loop 5m check whether the deploy finished. The interval is optional (defaults to 10m), and the prompt can be another command, so/loop 30m /reviewworks./loop stopends it, and so does interrupting the session.It lives on the server side, in
SessionPrompt.command, so the TUI and web app get it without client changes. The registry entry has no template;command()spots it and runs the timer itself. Each session gets at most one timer, kept in aFiberMap: starting a new loop replaces the old one, andcancel()clears it. When a tick fires while the session is busy, it is skipped instead of queued behind the current turn. Customloopcommands from config or MCP still take precedence, because the check compares against the built-in entry, not the name.This is narrower than #23575. There is no self-paced mode, no continue markers parsed out of model output, and no project default prompt file. It is only a timer.
How did you verify your code works?
test/session/prompt.test.ts: repeat until/loop stop, cancel stops the loop, cancel and stop both return promptly while a tick is mid-turn, looping another command, and the usage error for an empty prompt. I checked that the cancel test fails when theFiberMap.removeincancel()is taken out.bun testfortest/session/prompt.test.ts,test/command,test/server,test/acpandtest/cli/runpasses, andbun run typecheckinpackages/opencodeis clean.opencode serveagainst a local OpenAI-compatible stub and drove it over HTTP:/loop 3s say hiticked every ~3s,/loop stopandPOST /session/:id/abortboth ended it, and/loopshows up inGET /command.Screenshots / recordings
Not a UI change.
Checklist