Repository navigation
fix(webview): show modes skeleton until view state loads (vps2 F7) #1567
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
base: main
Are you sure you want to change the base?
Changes from all commits
4d78040
fa29612
d6330bf
8a9150b
e9e517c
fbcd519
0bacabe
aa15e2f
d5ef9f6
cd5f076
3d656f0
f460ab4
c1a91f3
712908c
8abca52
7af314e
f5ef758
6a5f56b
6f42165
0718414
3211c95
5160459
0fd3161
019a668
89e0499
7929587
77c81ba
f015cc8
a3e32f4
1360563
b179c9c
c89a347
a935620
bf0ff21
c80560c
5430c06
086bbb0
70996d5
063c6ed
32dacbf
774d65f
36dcc8d
c50ef85
6e749ec
01506e9
042de98
f46c106
868a23e
9519522
c69978c
eabeffa
59062a7
5ef57e2
cdf214f
0ecff8b
cd5d132
84da1fb
2675a7d
b9bef62
8a0c72c
03b1801
6532bad
0db5c79
c9a3989
4a672a2
1d2313e
b248c1a
3a469b8
c7e093a
24c53b5
43896ab
d9f2b20
98a2f61
5fee410
0864e96
a8d4421
be03168
aa2da74
b5f7dac
8b544b8
7db2ecd
6063622
44d7a56
92ae27e
6c80da1
b7ce0b1
ee13e84
1125397
6f571f6
8d03bda
d3ef740
241cf49
43339f5
57bb768
31c5381
23a7104
58c5217
17de4f5
6aa8f9c
29fb826
f74c502
a5650dc
b8e0a86
020a339
2626e1c
ff7b821
f156261
a3420ba
607131b
4acc103
6cf405a
15d9ab6
b8d23fa
d4f2db9
6370bca
bd0b893
2e1ed86
d2f7da2
60cb846
61d279c
1c90e8b
3140061
89576d6
c13b80a
cfd0bc9
6534c28
b4911c6
c06092c
75598a7
fb508b0
fc4f9a4
38a9b70
1d55a60
167534a
4cf697b
f19dd84
e6b39fa
bff052f
65c0a52
db2fd2b
82859b4
53714a5
294c37b
34b9381
6160a47
e1bf7bf
08acf50
c9d7217
a85f1f1
987388b
19017ef
beaa44e
1c44c07
619ff56
266aaf1
0acb592
9a99875
f7ea23f
c77a8b9
5cbf406
ed0d4e1
2eed984
2ff75cc
b91e45b
3b28604
0c2aeb9
cc232b5
4d20ce8
ffeeec8
e92c165
8a15cbf
3351ffd
615903c
230b69d
f0ed39f
9d914ac
80bef8f
3114d1d
35f220b
cb1576a
11d64e0
7ce557f
5b73d22
56d9493
67fb3ba
02b733d
9321a0a
6f6f84e
34560d5
524a99e
02d59c9
3b94f99
2787eb9
97d3481
9dd1e57
afb0fe9
8953c58
f7a816e
e705eef
fda1600
73b7657
c8fc899
a6efa5b
a92d8b2
0dd791e
5ccce92
152fad9
906cb95
e1c2560
de05ff0
312e688
d58af6a
ee4b4df
770929c
4608faf
1a1dd23
ae7ff52
7cd56ca
be3e140
557f1c9
232949c
4770161
ec2fb37
f555d04
94bef37
b0e1c67
c79048c
8cc8f33
17890eb
cf80e4b
152e5e1
97a174f
96e93e5
057e866
6b293d8
55af762
d76f001
ce3b00a
ba2e9db
b61788a
7efab38
3bf117a
7565af3
71d7b57
cef38f5
d34a654
aa6e0a4
ec3589e
1fa4e5a
24dee10
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import type { ChatCompletionRequest, ChatMessage, LLMock } from "@copilotkit/aimock" | ||
|
|
||
| const TASKS = ["A", "B", "C"] as const | ||
| const ROUNDS = 10 | ||
|
|
||
| const MODE_SEQUENCES: Record<(typeof TASKS)[number], string[]> = { | ||
| A: ["ask", "debug", "architect", "orchestrator", "code", "ask", "debug", "architect", "orchestrator", "code"], | ||
| B: ["debug", "architect", "orchestrator", "code", "ask", "debug", "architect", "orchestrator", "code", "ask"], | ||
| C: ["architect", "orchestrator", "code", "ask", "debug", "architect", "orchestrator", "code", "ask", "debug"], | ||
| } | ||
|
|
||
| const markerFor = (taskName: (typeof TASKS)[number]) => `FOLLOWUP_MODE_ISOLATION_${taskName}` | ||
| const answerFor = (taskName: (typeof TASKS)[number], round: number) => `${taskName} follow-up round ${round}` | ||
| const callIdFor = (taskName: (typeof TASKS)[number], round: number) => | ||
| `call_followup_mode_${taskName.toLowerCase()}_${String(round).padStart(2, "0")}` | ||
|
|
||
| const lastToolResultContains = (req: ChatCompletionRequest, toolCallId: string, expected: string[]) => { | ||
| const messages = Array.isArray(req?.messages) ? req.messages : [] | ||
| const toolMessage = messages.filter((message: ChatMessage) => message?.role === "tool").at(-1) | ||
| const content = toolMessage?.content | ||
|
|
||
| return ( | ||
| toolMessage?.tool_call_id === toolCallId && | ||
| typeof content === "string" && | ||
| expected.every((text) => content.includes(text)) | ||
| ) | ||
| } | ||
|
|
||
| const followupToolCall = (taskName: (typeof TASKS)[number], round: number) => ({ | ||
| name: "ask_followup_question", | ||
| arguments: JSON.stringify({ | ||
| question: `Task ${taskName}: choose mode for round ${round}`, | ||
| follow_up: [ | ||
| { | ||
| text: answerFor(taskName, round), | ||
| mode: MODE_SEQUENCES[taskName][round - 1], | ||
| }, | ||
| ], | ||
| }), | ||
| id: callIdFor(taskName, round), | ||
| }) | ||
|
|
||
| export const getFollowupModeIsolationPlan = () => | ||
| TASKS.map((taskName) => ({ | ||
| taskName, | ||
| marker: markerFor(taskName), | ||
| rounds: MODE_SEQUENCES[taskName].map((mode, index) => ({ | ||
| round: index + 1, | ||
| answer: answerFor(taskName, index + 1), | ||
| mode, | ||
| })), | ||
| })) | ||
|
|
||
| export function addViewStateFixtures(mock: InstanceType<typeof LLMock>) { | ||
| for (const taskName of TASKS) { | ||
| mock.addFixture({ | ||
| match: { | ||
| userMessage: markerFor(taskName), | ||
| }, | ||
| response: { | ||
| toolCalls: [followupToolCall(taskName, 1)], | ||
| }, | ||
| }) | ||
|
|
||
| for (let round = 1; round < ROUNDS; round++) { | ||
| mock.addFixture({ | ||
| match: { | ||
| predicate: (req) => | ||
| lastToolResultContains(req, callIdFor(taskName, round), [answerFor(taskName, round)]), | ||
| }, | ||
| response: { | ||
| toolCalls: [followupToolCall(taskName, round + 1)], | ||
| }, | ||
| }) | ||
| } | ||
|
|
||
| mock.addFixture({ | ||
| match: { | ||
| predicate: (req) => | ||
| lastToolResultContains(req, callIdFor(taskName, ROUNDS), [answerFor(taskName, ROUNDS)]), | ||
| }, | ||
| response: { | ||
| toolCalls: [ | ||
| { | ||
| name: "attempt_completion", | ||
| arguments: JSON.stringify({ | ||
| result: `Task ${taskName} completed ${ROUNDS} follow-up mode switches.`, | ||
| }), | ||
| id: `call_followup_mode_${taskName.toLowerCase()}_complete`, | ||
| }, | ||
| ], | ||
| }, | ||
| }) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,8 @@ import { | |
| removeScenarioWorkspace, | ||
| } from "./restart/scenarioWorkspace" | ||
| import { runRestartScenario } from "./restart/vscodeCoordinator" | ||
| import { toolResultContains } from "./fixtures/tool-result" | ||
| import { addViewStateFixtures } from "./fixtures/view-state" | ||
|
|
||
| function getCliFlagValue(flag: string) { | ||
| return process.argv.find((arg, index) => process.argv[index - 1] === flag) | ||
|
|
@@ -148,6 +150,41 @@ async function main() { | |
| addUseMcpToolResultFixtures(mock) | ||
| addWriteToFileResultFixtures(mock) | ||
| addDeepSeekV4Fixtures(mock) | ||
| addViewStateFixtures(mock) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| // Model-agnostic predicate fixtures for the view-state suite's post-switch | ||
| // turns. They coexist with the legacy model-scoped regex fixture below | ||
| // (shared response id call_modes_post_switch_001) so the modes suite keeps | ||
| // its OpenRouter-scoped match while view-state runs under any default model. | ||
| mock.addFixture({ | ||
| match: { | ||
| predicate: (req) => toolResultContains(req, "call_modes_switch_001", []), | ||
| }, | ||
| response: { | ||
| toolCalls: [ | ||
| { | ||
| name: "attempt_completion", | ||
| arguments: JSON.stringify({ result: "Switched to ❓ Ask mode as requested." }), | ||
| id: "call_modes_post_switch_001", | ||
| }, | ||
| ], | ||
| }, | ||
| }) | ||
|
|
||
| mock.addFixture({ | ||
| match: { | ||
| predicate: (req) => toolResultContains(req, "call_modes_switch_002", []), | ||
| }, | ||
| response: { | ||
| toolCalls: [ | ||
| { | ||
| name: "attempt_completion", | ||
| arguments: JSON.stringify({ result: "Switched to 🪲 Debug mode as requested." }), | ||
| id: "call_modes_post_switch_002", | ||
| }, | ||
| ], | ||
| }, | ||
| }) | ||
|
|
||
| // The modes test (switch_mode → ask) triggers a second API call whose last | ||
| // user message starts with <environment_details> directly — no <user_message> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.