GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(claude): include provider notices in fallback completion · pingdotgg/t3code@0a4c3a7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/orchestration-v2
    • SubagentProjection.test.ts
  • packages/provider-core/src/server
    • subagentProjection.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/orchestration-v2/SubagentProjection.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/SubagentProjection.test.ts
+61-5Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
EventId,
99
TurnItemId,
1010
type OrchestrationV2Run,
11+
type OrchestrationV2TurnItem,
1112
type OrchestrationV2AppThread,
1213
ProjectId,
1314
ProviderInstanceId,
@@ -357,27 +358,42 @@ it("exposes the provider failure rather than a progress message from the failed
357358
});
358359

359360
it.each([
360-
{ requestedModel: "claude-opus-4-1", observedModel: undefined, provenance: "" },
361-
{ requestedModel: "claude-opus-4-1", observedModel: "claude-opus-4-1", provenance: "" },
361+
{
362+
requestedModel: "claude-opus-4-1",
363+
observedModel: undefined,
364+
fallbackNotice: null,
365+
provenance: "",
366+
},
367+
{
368+
requestedModel: "claude-opus-4-1",
369+
observedModel: "claude-opus-4-1",
370+
fallbackNotice: null,
371+
provenance: "",
372+
},
362373
{
363374
requestedModel: "claude-opus-5-5",
364375
observedModel: "claude-sonnet-5-5",
365-
provenance: "Requested model: claude-opus-5-5. Provider-reported model: claude-sonnet-5-5.\n\n",
376+
fallbackNotice:
377+
'Model "claude-opus-5-5" is restricted by your organization\'s settings. Using claude-sonnet-5-5 instead.',
378+
provenance:
379+
'Requested model: claude-opus-5-5. Provider-reported model: claude-sonnet-5-5.\nProvider notice: Model "claude-opus-5-5" is restricted by your organization\'s settings. Using claude-sonnet-5-5 instead.\n\n',
366380
},
367381
{
368382
requestedModel: "opus",
369383
observedModel: "claude-opus-4-1",
384+
fallbackNotice: null,
370385
provenance: "Requested model: opus. Provider-reported model: claude-opus-4-1.\n\n",
371386
},
372387
{
373388
requestedModel: "claude-opus-4-1",
374389
observedModel: "claude-opus-4-1[1m]",
390+
fallbackNotice: null,
375391
provenance:
376392
"Requested model: claude-opus-4-1. Provider-reported model: claude-opus-4-1[1m].\n\n",
377393
},
378394
])(
379395
"orders assistant messages and reports $requestedModel / $observedModel provenance",
380-
({ requestedModel, observedModel, provenance }) => {
396+
({ requestedModel, observedModel, fallbackNotice, provenance }) => {
381397
const { projection, run } = taskFixture();
382398
const at = DateTime.makeUnsafe("2026-07-24T10:05:00.000Z");
383399
const message = (id: string, text: string, ordinal: number) => {
@@ -401,11 +417,51 @@ it.each([
401417
};
402418
const progress = message("progress", "Starting step 0.", 1);
403419
const report = message("report", "All steps passed.", 2);
420+
421+
const notice = {
422+
id: TurnItemId.make("fallback-notice"),
423+
threadId: run.threadId,
424+
runId: run.id,
425+
nodeId: run.rootNodeId,
426+
providerThreadId: null,
427+
providerTurnId: null,
428+
nativeItemRef: null,
429+
parentItemId: null,
430+
ordinal: 0,
431+
type: "system_notice",
432+
status: "completed",
433+
title: null,
434+
message: fallbackNotice ?? "",
435+
startedAt: at,
436+
completedAt: at,
437+
updatedAt: at,
438+
} satisfies OrchestrationV2TurnItem;
439+
const notices = [
440+
{
441+
...notice,
442+
id: TurnItemId.make("other-run"),
443+
runId: RunId.make("other"),
444+
message: "Other run notice",
445+
},
446+
{
447+
...notice,
448+
id: TurnItemId.make("other-root"),
449+
nodeId: NodeId.make("previous-root"),
450+
message: "Previous attempt notice",
451+
},
452+
{
453+
...notice,
454+
id: TurnItemId.make("native-child"),
455+
parentItemId: TurnItemId.make("native-task"),
456+
message: "Native child notice",
457+
},
458+
notice,
459+
];
404460
const result = subagentResultForRun(
405461
{
406462
...projection,
407463
messages: [progress.message, report.message],
408-
turnItems: [report.turnItem, progress.turnItem],
464+
turnItems: [report.turnItem, ...notices, progress.turnItem],
409465
},
410466
{ ...run, modelSelection: { ...run.modelSelection, model: requestedModel }, observedModel },
411467
);
Collapse file

‎packages/provider-core/src/server/subagentProjection.ts‎

Copy file name to clipboardExpand all lines: packages/provider-core/src/server/subagentProjection.ts
+25-4Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,32 @@ export function subagentResultForRun(
214214
(run.status === "completed"
215215
? "Child task completed without an assistant result."
216216
: `Child task ended with status ${run.status}.`);
217+
218+
const hasModelMismatch =
219+
run.observedModel != null && run.observedModel !== run.modelSelection.model;
220+
const providerNotices = hasModelMismatch
221+
? projection.turnItems
222+
.filter(
223+
(item): item is Extract<OrchestrationV2TurnItem, { readonly type: "system_notice" }> =>
224+
item.type === "system_notice" &&
225+
item.runId === run.id &&
226+
run.rootNodeId !== null &&
227+
item.nodeId === run.rootNodeId &&
228+
item.parentItemId === null &&
229+
item.message.trim().length > 0,
230+
)
231+
.toSorted((left, right) => left.ordinal - right.ordinal)
232+
.map((item) => `Provider notice: ${item.message.trim()}`)
233+
: [];
234+
const provenance = hasModelMismatch
235+
? [
236+
`Requested model: ${run.modelSelection.model}. Provider-reported model: ${run.observedModel}.`,
237+
...providerNotices,
238+
].join("\n") + "\n\n"
239+
: "";
240+
217241
return {
218-
text:
219-
run.observedModel !== undefined && run.observedModel !== run.modelSelection.model
220-
? `Requested model: ${run.modelSelection.model}. Provider-reported model: ${run.observedModel}.\n\n${text}`
221-
: text,
242+
text: `${provenance}${text}`,
222243
messageId: failure === undefined ? (message?.id ?? turnItem?.messageId ?? null) : null,
223244
turnItemId: failure?.id ?? turnItem?.id ?? null,
224245
};

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.