fix(bench): forward trace headers in DRACO and search response layers - #63
fix(bench): forward trace headers in DRACO and search response layers#63jamespsterling wants to merge 4 commits into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
| apiKey: input.apiKey, | ||
| ...(input.baseUrl !== undefined && { baseUrl: input.baseUrl }), | ||
| sessionId: input.sessionId, | ||
| ...(input.traceHeaders !== undefined && { |
There was a problem hiding this comment.
@devin pre-existing, but this PR makes the layer path the source of truth for trace headers, so the other inference path is worth naming. All 10 layer call sites now forward. The agent-CLI path forwards none: buildAgentCliEnv at src/benchmarks/agent-cli/runner.ts:114 sets OPENROUTER_API_KEY, TB_MODEL and ORI_OPENROUTER_SESSION_ID but no traceparent, so sandboxed inference is untraced for terminal_bench always, and for deep_swe / swe_atlas whenever the agent is an ori agent (deep-swe/solver.ts:198 branches on cliHarness). sessionId already crosses that boundary as an env var, so the mechanism exists. Is the exclusion deliberate?
There was a problem hiding this comment.
Yes, deliberate for this PR. Two reasons the agent-CLI env boundary is excluded:
- Trust-key exposure:
x-benchmark-traceis the shared secret cfw-api uses to gate trace continuation + force-sampling. Env vars in the sandbox are readable by arbitrary agent-executed code (and by anything the agent shells out to), so exporting it there widens the secret's exposure surface in a way the header-per-request paths don't.sessionIdcrosses that boundary because it's not a secret. - Static context vs. per-request headers: a
traceparentenv var would be captured once at sandbox launch and replayed verbatim on every inference request the CLI makes, so all sandboxed requests would claim the same parent span id with no per-request client spans — trace stitching would be misleading rather than partial.
So sandboxed inference (terminal_bench always; deep_swe/swe_atlas on ori-agent harnesses) stays untraced for now, and the new tests assert non-leakage on purpose. If we want coverage there, the cleaner follow-up is for the ori agent CLI to accept trace context via a dedicated flag/env and mint its own child spans per request rather than replaying a fixed traceparent. Happy to file that as a follow-up issue if you want it.
…de lint Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…guard Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
TL;DR
DRACO and search (BrowseComp/HLE/DSQA/WideSearch) inference requests now carry the caller-supplied trace headers, closing the last gap in benchmark trace propagation (#45).
What changed?
src/benchmarks/draco/benchmark.tsandsrc/benchmarks/search/core/benchmark.tsnow passinput.traceHeadersintomakeResponsesLayer, matching the pattern already used byresponses-model.ts:fetchand asserttraceparent,x-or-traceparent/x-benchmark-tracereach the request while SDK-managedauthorizationis preserved. Each test fails without its fix.Why?
#45 threaded
traceHeadersfrom the runner intoBenchmarkRunInput, but these two benchmark families built their ownmakeResponsesLayerand dropped the field, so their requests never stitched to the worker trace.How to test
bun test src/benchmarks/draco/benchmark.test.ts src/benchmarks/search/core/benchmark.test.tsExpected: all pass; reverting either source change fails the corresponding new test.
Reviewer focus
benchmark.tsfiles (behavioral change is only these).Checklist
Link to Devin session: https://openrouter.devinenterprise.com/sessions/8669b85c73fb4378aebc0b5476836b6e
Open in Devin Desktop: https://openrouter.devinenterprise.com/desktop/session/8669b85c73fb4378aebc0b5476836b6e?variant=devin
Requested by: @jamespsterling