Repository navigation
fix(coding-agent): restore the first-party x-session-id attribution - #383
Merged
Merged
Conversation
Requests to https://api.stepfun.com and https://api.stepfun.ai stopped carrying the session id as x-session-id, and the session id fell back to the allowlisted `x-step-session-id` name on every host. That is a regression from #370 (01adb40): the config-schema branch replaced `trace-headers.ts`, `features/step.ts`, and the two tests with byte-identical copies of their pre-#368 state, while the branch was cut from a commit that already contained #368. Deleting the implementation and its tests in the same commit is why no check failed. Restore #368 as it was merged, on top of the client-identity work that landed later: `STEP_FIRST_PARTY_TRACE_HOSTS`, `isStepFirstPartyTraceUrl`, the unconditional first-party `x-session-id`, and the single vendor-neutral name on the allowlisted path. The tests cover the first-party hosts, the non-matching hosts, an absent session id, and the allowlisted overlap. The provider-header comment and the queue test's placeholder header name now use the same `x-session-id` name the product actually sends.
liuedcson
requested review from
MelodyVAR,
Uking-xxx and
ZouR-Ma
as code owners
December 2, 2026 07:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Requests to Step's own hosts (
https://api.stepfun.com,https://api.stepfun.ai) stopped carrying the session id asx-session-id. The session id fell back to the allowlistedx-step-session-idname, so a first-party request no longer identified its session at all, and every host used a name the product no longer documents.This is a regression from #370 (
01adb40e), not an intentional change.How it happened
01adb40ewas cut from4701f964, which already contained #368 (d4138803). Its first commit47ed3be3nevertheless replaced four files with byte-identical copies of their pre-#368 state:d4138803^packages/coding-agent/src/step/trace-headers.ts23468cd823468cd8packages/coding-agent/src/features/step.tse684f6c8e684f6c8packages/coding-agent/test/step-extension.test.tsb2d98339b2d98339packages/coding-agent/test/step-trace-headers.test.ts7710b4f77710b4f7Those are #368's four files and nothing else, inside a 45-file config-schema commit, and #370's description never mentions trace headers. Deleting the implementation together with its 49 lines of tests in one commit is why no check failed: there was no assertion left to fail.
Because the names exist only inside
coding-agent, nothing broke at compile time either.What
Restore #368 as merged, on top of the client-identity work that landed later:
STEP_FIRST_PARTY_TRACE_HOSTSandisStepFirstPartyTraceUrlinpackages/coding-agent/src/step/trace-headers.ts:httpsonly, exact hostname match, soapi.stepfun.com.example,api.stepfun.com@evil.example, andother.stepfun.comdo not match.x-session-idindependently of the allowlist and field policy — first-party attribution, not third-party egress. Every other field stays gated, and an empty or omitted field list still sends none of them.session-idpath emitsx-session-idtoo, so a host that is both first-party and allowlisted gets one header, not two.test/step-trace-headers.test.tscovers the three first-party URLs, a non-matching host, an absent session id, the https-only and userinfo cases, and the allowlisted overlap.test/step-extension.test.tsasserts the extension boundary sendsx-session-idto the native Step endpoint and to an allowlisted product proxy.The provider-header comment now describes URL-host keying instead of provider-id keying, and the queue test's placeholder header uses the current name.
Validation
pnpm run checkpasses (biome,tsgo --noEmit, layer/boundary/entry-freeze guards,check:config-schema,check:browser-smoke).pnpm exec vitest --run test/step-trace-headers.test.ts test/step-extension.test.ts test/step-model-queue.test.tsfrompackages/coding-agent: 101 passed.mainand passes here;isStepFirstPartyTraceUrlis asserted directly as well as throughapplyStepTraceHeaders.Boundary
This restores behavior that
github-opensourceand the desktop branch already ship, so the trees agree again after this lands. No new header name is introduced and the client pair (x-step-client,x-step-client-version) is unchanged.