-
Notifications
You must be signed in to change notification settings - Fork 132
π€ feat: route skills to model classes (Settings-managed large/medium/small) #3849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
asm
wants to merge
18
commits into
coder:main
Choose a base branch
from
asm:skill-model-classes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
05fc884
feat: route skills to model classes (modelClasses + skillModelClassesβ¦
asm b7c2bb4
π€ fix: address review findings in skill model-class routing
asm 667aa99
π€ fix: resolve one-shot thinking against the routed model, carry overβ¦
asm d73343d
π€ fix: reserve headroom for the pending turn in routed-send compaction
asm 9d67e2e
π€ fix: apply routed compaction policy mid-stream, pick a compaction mβ¦
asm eb0edc7
π€ fix: gate direct OpenAI routes by usable credentials
asm aed24f8
π€ fix: model-aware factory routing, defer PDF preflight, report routeβ¦
asm 93219c3
π€ fix: drop manual useCallback in useModelClasses, pin phone snapshotβ¦
asm d986532
π€ fix: persist class edits before publishing, report routed thinking β¦
asm 4e9a3e3
π€ fix: preserve queued PDF rejections, report post-policy routed thinβ¦
asm 5d76723
π€ fix: report the effective thinking level for every routed send
asm bab2b7d
π€ fix: carry routed compaction context across stream retries
asm f4bbc37
π€ fix: preserve the composed command prefix through compact-and-retry
asm 69ff119
π€ fix: exempt shadowing custom OpenAI providers from OAuth gating
asm f9c7dee
π€ fix: edit-safe gate rejections, pending-row locking, durable routedβ¦
asm 61574ed
π€ fix: restore persisted compaction context on relaunch, edit-guard tβ¦
asm acecc01
π€ fix: resume routed retries on the persisted class model in child woβ¦
asm c5e9f5a
π€ fix: export buildFollowUpFromSource with a null-ctx default
asm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
139 changes: 139 additions & 0 deletions
139
src/browser/features/ChatInput/utils.oneShotSkillComposition.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| import { describe, expect, test } from "bun:test"; | ||
|
|
||
| import { KNOWN_MODELS } from "@/common/constants/knownModels"; | ||
| import type { AgentSkillDescriptor } from "@/common/types/agentSkill"; | ||
| import { parseCommandWithSkillInvocation } from "./utils"; | ||
|
|
||
| function descriptor(name: string): AgentSkillDescriptor { | ||
| return { name, description: `${name} description`, scope: "project" }; | ||
| } | ||
|
|
||
| describe("parseCommandWithSkillInvocation one-shot composition", () => { | ||
| test("composes '/haiku+0 /done args' into a skill invocation with a one-shot override", async () => { | ||
| const result = await parseCommandWithSkillInvocation({ | ||
| messageText: "/haiku+0 /done now please", | ||
| agentSkillDescriptors: [descriptor("done")], | ||
| api: null, | ||
| discovery: null, | ||
| composeOneShot: true, | ||
| }); | ||
|
|
||
| expect(result.parsed).toBeNull(); | ||
| expect(result.skillInvocation?.descriptor.name).toBe("done"); | ||
| expect(result.skillInvocation?.userText).toBe("Using skill done: now please"); | ||
| // Arguments are relative to the skill token so $ARGUMENTS substitution | ||
| // sees "now please", not the one-shot prefix. | ||
| expect(result.skillInvocation?.argumentText).toBe("now please"); | ||
| expect(result.skillInvocation?.oneShot).toEqual({ | ||
| modelString: KNOWN_MODELS.HAIKU.id, | ||
| thinkingLevel: 0, | ||
| }); | ||
| }); | ||
|
|
||
| test("composes a thinking-only override ('/+2 /done')", async () => { | ||
| const result = await parseCommandWithSkillInvocation({ | ||
| messageText: "/+2 /done", | ||
| agentSkillDescriptors: [descriptor("done")], | ||
| api: null, | ||
| discovery: null, | ||
| composeOneShot: true, | ||
| }); | ||
|
|
||
| expect(result.parsed).toBeNull(); | ||
| expect(result.skillInvocation?.userText).toBe("Use skill done"); | ||
| expect(result.skillInvocation?.oneShot).toEqual({ thinkingLevel: 2 }); | ||
| }); | ||
|
|
||
| test("does not compose without the composeOneShot opt-in (creation composer)", async () => { | ||
| const result = await parseCommandWithSkillInvocation({ | ||
| messageText: "/haiku+0 /done now", | ||
| agentSkillDescriptors: [descriptor("done")], | ||
| api: null, | ||
| discovery: null, | ||
| }); | ||
|
|
||
| expect(result.skillInvocation).toBeNull(); | ||
| expect(result.parsed?.type).toBe("model-oneshot"); | ||
| }); | ||
|
|
||
| test("keeps valid registered-command invocations out of composition ('/haiku+0 /compact')", async () => { | ||
| const result = await parseCommandWithSkillInvocation({ | ||
| messageText: "/haiku+0 /compact", | ||
| agentSkillDescriptors: [descriptor("compact")], | ||
| api: null, | ||
| discovery: null, | ||
| composeOneShot: true, | ||
| }); | ||
|
|
||
| expect(result.skillInvocation).toBeNull(); | ||
| expect(result.parsed).toMatchObject({ type: "model-oneshot", message: "/compact" }); | ||
| }); | ||
|
|
||
| test("mirrors direct invocation for unknown-command remainders, even on command-colliding names", async () => { | ||
| // "/compact now" is an invalid compact usage: its handler returns | ||
| // unknown-command, and unknown commands are exactly what skill invocation | ||
| // consumes. Direct typing already resolves a skill named "compact" here, | ||
| // so the composed form must behave identically. | ||
| const direct = await parseCommandWithSkillInvocation({ | ||
| messageText: "/compact now", | ||
| agentSkillDescriptors: [descriptor("compact")], | ||
| api: null, | ||
| discovery: null, | ||
| composeOneShot: true, | ||
| }); | ||
| const composed = await parseCommandWithSkillInvocation({ | ||
| messageText: "/haiku+0 /compact now", | ||
| agentSkillDescriptors: [descriptor("compact")], | ||
| api: null, | ||
| discovery: null, | ||
| composeOneShot: true, | ||
| }); | ||
|
|
||
| expect(direct.skillInvocation?.descriptor.name).toBe("compact"); | ||
| expect(composed.skillInvocation?.descriptor.name).toBe("compact"); | ||
| expect(composed.skillInvocation?.oneShot).toEqual({ | ||
| modelString: KNOWN_MODELS.HAIKU.id, | ||
| thinkingLevel: 0, | ||
| }); | ||
| }); | ||
|
|
||
| test("keeps nested one-shots out of composition ('/haiku+0 /opus hi')", async () => { | ||
| const result = await parseCommandWithSkillInvocation({ | ||
| messageText: "/haiku+0 /opus hi", | ||
| agentSkillDescriptors: [descriptor("done")], | ||
| api: null, | ||
| discovery: null, | ||
| composeOneShot: true, | ||
| }); | ||
|
|
||
| expect(result.skillInvocation).toBeNull(); | ||
| expect(result.parsed).toMatchObject({ type: "model-oneshot", message: "/opus hi" }); | ||
| }); | ||
|
|
||
| test("falls back to a plain one-shot when the remainder is not a known skill", async () => { | ||
| const result = await parseCommandWithSkillInvocation({ | ||
| messageText: "/haiku+0 /nothere do it", | ||
| agentSkillDescriptors: [descriptor("done")], | ||
| api: null, | ||
| discovery: null, | ||
| composeOneShot: true, | ||
| }); | ||
|
|
||
| expect(result.skillInvocation).toBeNull(); | ||
| expect(result.parsed).toMatchObject({ type: "model-oneshot", message: "/nothere do it" }); | ||
| }); | ||
|
|
||
| test("plain skill invocations are unaffected by the composition flag", async () => { | ||
| const result = await parseCommandWithSkillInvocation({ | ||
| messageText: "/done now", | ||
| agentSkillDescriptors: [descriptor("done")], | ||
| api: null, | ||
| discovery: null, | ||
| composeOneShot: true, | ||
| }); | ||
|
|
||
| expect(result.parsed).toBeNull(); | ||
| expect(result.skillInvocation?.descriptor.name).toBe("done"); | ||
| expect(result.skillInvocation?.oneShot).toBeUndefined(); | ||
| }); | ||
| }); |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.