Skip to content

Commit 2e2b803

Browse files
icecrasher321claude
andcommitted
fix(copilot): log a withheld in-band result even when it withheld a success
The cause was written only on the failure branch, but a withheld success keeps `projected.success` true — so the one case that leaves no other trace, where the model reads a bare success and nothing says why, was also the only one whose cause was never recorded. Report it on its own, as the resume driver already does. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 671f88e commit 2e2b803

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

  • apps/sim/app/api/copilot/tools/execute

apps/sim/app/api/copilot/tools/execute/route.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,27 @@ export const POST = withRouteHandler((request: NextRequest) =>
173173
if (projection.safe && toolRegistry.isComplete()) {
174174
turnRegistry.mergeToolCallRegistry(toolRegistry)
175175
}
176+
if (!projection.safe) {
177+
/**
178+
* Reported on its own rather than folded into the failure branch below: a withheld
179+
* SUCCESS keeps `projected.success` true, so gating on failure meant the one case
180+
* that leaves no other trace — the model reads a bare success — was also the one
181+
* case whose cause was never written down.
182+
*/
183+
logger.warn('In-band tool result withheld by egress projection', {
184+
toolName,
185+
toolCallId,
186+
runtimeSucceeded: result.success,
187+
...describeWithholdingCause(projection.cause),
188+
})
189+
}
176190
if (!projected.success) {
177191
logger.warn('In-band tool execution failed', {
178192
toolName,
179193
toolCallId,
180194
error: projected.error,
181195
runtimeSucceeded: result.success,
182196
projectionSafe: projection.safe,
183-
...(projection.safe ? {} : describeWithholdingCause(projection.cause)),
184197
})
185198
}
186199
if (result.success && chatId) {

0 commit comments

Comments
 (0)