fix: stabilize agent and skill ordering in prompt descriptions#18261
Merged
rekram1-node merged 5 commits intoanomalyco:devfrom Mar 19, 2026
Merged
Conversation
Collaborator
|
For e2e stuff it doesn't seem like it's relataed to ur changes, I think our CI is flaky, let's avoid changing that in this PR |
Collaborator
|
/review |
Contributor
|
lgtm |
raf1hh
pushed a commit
to raf1hh/opencode
that referenced
this pull request
Mar 20, 2026
…lyco#18261) Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
demostanis
pushed a commit
to demostanis/opencode
that referenced
this pull request
Mar 20, 2026
…lyco#18261) Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
3 tasks
Open
3 tasks
pengzha0
pushed a commit
to pengzha0/dwtcode
that referenced
this pull request
Mar 23, 2026
…lyco#18261) Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
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
Closes #18215
Type of change
What does this PR do?
This makes the agent and skill lists deterministic anywhere they become part of the prompt.
The main fix is sorting subagents in
task.ts, sorting skills inskill.ts, and givingAgent.list()a stable secondary sort by agent name while still keeping the configured default agent first.I also sorted the skill list in
session/system.tsbecause that prompt section could still change byte-for-byte across calls even after fixing the tool descriptions, which would still hurt prompt cache reuse.Tests cover the new ordering behavior and repeated-call stability for agent listing, task tool descriptions, skill tool descriptions, and the system prompt skill section.
How did you verify your code works?
Ran in
packages/opencode:bun test test/agent/agent.test.ts test/tool/skill.test.ts test/tool/task.test.ts test/session/system.test.ts./node_modules/.bin/tsgo --noEmitbun testResults:
Screenshots / recordings
Not a UI change.
Checklist