@@ -149,20 +149,23 @@ function isWithheldPath(span: QueryTraceSpan, path: string): boolean {
149149 return false
150150}
151151
152- /** The path as given first; under `output.` when the head is not a span-level key. */
152+ /**
153+ * The path as given first; under `output.` when the head is not a span-level key. A
154+ * direct path through a withheld content field (`thinking`) stays unknown rather than
155+ * falling back to a same-named key under output.
156+ */
153157function resolveSpanPathWithFallback ( span : QueryTraceSpan , path : string ) : ResolvedSpanPath {
154158 const direct = resolveSpanPath ( span , path )
155159 if ( direct !== undefined ) return { value : direct , path }
160+ if ( isWithheldPath ( span , path ) ) return { value : undefined , path, withheld : true }
156161 const head = path . split ( '.' ) [ 0 ] ?? ''
157- const unresolved = ( candidates : string [ ] ) : ResolvedSpanPath =>
158- candidates . some ( ( candidate ) => isWithheldPath ( span , candidate ) )
159- ? { value : undefined , path, withheld : true }
160- : { value : undefined , path }
161- if ( SPAN_LEVEL_KEYS . has ( head ) ) return unresolved ( [ path ] )
162+ if ( SPAN_LEVEL_KEYS . has ( head ) ) return { value : undefined , path }
162163 const underOutput = `output.${ path } `
163164 const value = resolveSpanPath ( span , underOutput )
164- if ( value === undefined ) return unresolved ( [ path , underOutput ] )
165- return { value, path : underOutput , resolvedUnder : 'output' }
165+ if ( value !== undefined ) return { value, path : underOutput , resolvedUnder : 'output' }
166+ return isWithheldPath ( span , underOutput )
167+ ? { value : undefined , path, withheld : true }
168+ : { value : undefined , path }
166169}
167170
168171function clipValue ( value : unknown ) : unknown {
0 commit comments