Repository navigation
fix(client-runtime): Pi subagents show their thinking level #33346
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
7b225a2
c75efc4
6cbd285
6a813e3
24060fb
2a89dc8
f795b41
bdec1b1
9d8689d
a948b46
d669396
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 | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3614,6 +3614,17 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> = | |||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
| // Settled children leave the shell stream, so their own selection travels with the task. | ||||||||||||||||||||||||||||||||||||||||||||||||
| const subagentPayload = sql`CASE | ||||||||||||||||||||||||||||||||||||||||||||||||
| WHEN subagent.origin = 'app_owned' | ||||||||||||||||||||||||||||||||||||||||||||||||
| AND child.provider_instance_id = subagent.provider_instance_id | ||||||||||||||||||||||||||||||||||||||||||||||||
| AND (json_extract(subagent.payload_json, '$.model') IS NULL | ||||||||||||||||||||||||||||||||||||||||||||||||
| OR json_extract(child.payload_json, '$.modelSelection.model') | ||||||||||||||||||||||||||||||||||||||||||||||||
| = json_extract(subagent.payload_json, '$.model')) | ||||||||||||||||||||||||||||||||||||||||||||||||
| THEN json_set(subagent.payload_json, '$.modelSelection', | ||||||||||||||||||||||||||||||||||||||||||||||||
| json_extract(child.payload_json, '$.modelSelection')) | ||||||||||||||||||||||||||||||||||||||||||||||||
| ELSE subagent.payload_json | ||||||||||||||||||||||||||||||||||||||||||||||||
| END AS payload_json`; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+3617
to
+3627
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. Keep a stored subagent For an Prefer the stored selection. Apply the overlay only when it is absent: Suggested fix
Extend the existing guard table in for (const [origin, instanceId, model] of [
["provider_native", providerInstanceId, modelSelection.model],
["app_owned", ProviderInstanceId.make("other-instance"), modelSelection.model],
["app_owned", providerInstanceId, "older-model"],
+ ["app_owned", providerInstanceId, modelSelection.model],
] as const) {This case fails on the current code, because the overlay replaces the stored Committable suggestion
|
||||||||||||||||||||||||||||||||||||||||||||||||
| const cohortJson = (field: string) => | ||||||||||||||||||||||||||||||||||||||||||||||||
| JSON.stringify( | ||||||||||||||||||||||||||||||||||||||||||||||||
| turnItems.flatMap((payload) => { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -3889,30 +3900,35 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> = | |||||||||||||||||||||||||||||||||||||||||||||||
| ? Effect.succeed([]) | ||||||||||||||||||||||||||||||||||||||||||||||||
| : window === undefined | ||||||||||||||||||||||||||||||||||||||||||||||||
| ? sql<PayloadRow>` | ||||||||||||||||||||||||||||||||||||||||||||||||
| SELECT payload_json | ||||||||||||||||||||||||||||||||||||||||||||||||
| SELECT ${subagentPayload} | ||||||||||||||||||||||||||||||||||||||||||||||||
| FROM orchestration_v2_projection_subagents AS subagent | ||||||||||||||||||||||||||||||||||||||||||||||||
| WHERE ${threadColumn(filter?.subagentIds)} = ${threadId} | ||||||||||||||||||||||||||||||||||||||||||||||||
| ${filter?.subagentIds === undefined ? sql`` : sql`AND subagent_id IN (SELECT value FROM json_each(${encodeIdList(filter.subagentIds)}))`} | ||||||||||||||||||||||||||||||||||||||||||||||||
| ${filter?.subagentRunIds === undefined ? sql`` : sql`AND run_id IN (SELECT value FROM json_each(${encodeIdList(filter.subagentRunIds)}))`} | ||||||||||||||||||||||||||||||||||||||||||||||||
| LEFT JOIN orchestration_v2_projection_threads AS child | ||||||||||||||||||||||||||||||||||||||||||||||||
| ON child.thread_id = subagent.child_thread_id | ||||||||||||||||||||||||||||||||||||||||||||||||
| WHERE ${threadColumn(filter?.subagentIds, "subagent.thread_id")} = ${threadId} | ||||||||||||||||||||||||||||||||||||||||||||||||
| ${filter?.subagentIds === undefined ? sql`` : sql`AND subagent.subagent_id IN (SELECT value FROM json_each(${encodeIdList(filter.subagentIds)}))`} | ||||||||||||||||||||||||||||||||||||||||||||||||
| ${filter?.subagentRunIds === undefined ? sql`` : sql`AND subagent.run_id IN (SELECT value FROM json_each(${encodeIdList(filter.subagentRunIds)}))`} | ||||||||||||||||||||||||||||||||||||||||||||||||
| ${ | ||||||||||||||||||||||||||||||||||||||||||||||||
| filter?.omitSettledSubagents === true | ||||||||||||||||||||||||||||||||||||||||||||||||
| ? sql`AND subagent.rowid IN (${unsettledSubagentRowids(threadId)})` | ||||||||||||||||||||||||||||||||||||||||||||||||
| : filter?.omitSettledSubagents !== undefined | ||||||||||||||||||||||||||||||||||||||||||||||||
| ? sql`AND ( | ||||||||||||||||||||||||||||||||||||||||||||||||
| subagent_id IN (SELECT value FROM json_each(${encodeIdList(filter.omitSettledSubagents.except)})) | ||||||||||||||||||||||||||||||||||||||||||||||||
| subagent.subagent_id IN (SELECT value FROM json_each(${encodeIdList(filter.omitSettledSubagents.except)})) | ||||||||||||||||||||||||||||||||||||||||||||||||
| OR NOT ${settledSubagent(sql`subagent`)} | ||||||||||||||||||||||||||||||||||||||||||||||||
| )` | ||||||||||||||||||||||||||||||||||||||||||||||||
| : sql`` | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| ORDER BY COALESCE(started_at, ''), subagent_id ASC | ||||||||||||||||||||||||||||||||||||||||||||||||
| ORDER BY COALESCE(subagent.started_at, ''), subagent.subagent_id ASC | ||||||||||||||||||||||||||||||||||||||||||||||||
| ` | ||||||||||||||||||||||||||||||||||||||||||||||||
| : sql<PayloadRow>` | ||||||||||||||||||||||||||||||||||||||||||||||||
| SELECT payload_json FROM orchestration_v2_projection_subagents | ||||||||||||||||||||||||||||||||||||||||||||||||
| WHERE thread_id = ${threadId} | ||||||||||||||||||||||||||||||||||||||||||||||||
| AND (status IN ('pending','starting','running','waiting') | ||||||||||||||||||||||||||||||||||||||||||||||||
| OR run_id IN (SELECT value FROM json_each(${cohortRunIds})) | ||||||||||||||||||||||||||||||||||||||||||||||||
| OR parent_node_id IN (SELECT value FROM json_each(${cohortNodeIds}))) | ||||||||||||||||||||||||||||||||||||||||||||||||
| ORDER BY COALESCE(started_at, ''), subagent_id ASC | ||||||||||||||||||||||||||||||||||||||||||||||||
| SELECT ${subagentPayload} | ||||||||||||||||||||||||||||||||||||||||||||||||
| FROM orchestration_v2_projection_subagents AS subagent | ||||||||||||||||||||||||||||||||||||||||||||||||
| LEFT JOIN orchestration_v2_projection_threads AS child | ||||||||||||||||||||||||||||||||||||||||||||||||
| ON child.thread_id = subagent.child_thread_id | ||||||||||||||||||||||||||||||||||||||||||||||||
| WHERE subagent.thread_id = ${threadId} | ||||||||||||||||||||||||||||||||||||||||||||||||
| AND (subagent.status IN ('pending','starting','running','waiting') | ||||||||||||||||||||||||||||||||||||||||||||||||
| OR subagent.run_id IN (SELECT value FROM json_each(${cohortRunIds})) | ||||||||||||||||||||||||||||||||||||||||||||||||
| OR subagent.parent_node_id IN (SELECT value FROM json_each(${cohortNodeIds}))) | ||||||||||||||||||||||||||||||||||||||||||||||||
| ORDER BY COALESCE(subagent.started_at, ''), subagent.subagent_id ASC | ||||||||||||||||||||||||||||||||||||||||||||||||
| `, | ||||||||||||||||||||||||||||||||||||||||||||||||
| fields !== undefined && !fields.includes("providerSessions") | ||||||||||||||||||||||||||||||||||||||||||||||||
| ? Effect.succeed([]) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.