Commit Graph

2 Commits

Author SHA1 Message Date
teknium1
2828e19a02 feat: slim the per-provider session header to the route seam and document it
Trim of the cherry-picked #104566 so it clears the salvage bar and covers #86241:

- The config getter matches entries the way every sibling per-provider knob does
  (`_entries_for_route`, route identity only) instead of a second provider-name axis;
  returns "" like `get_custom_provider_extra_headers` returns {}.
- `merge_opencode_session_headers` becomes `merge_session_affinity_headers` at both
  call sites (main `build_api_kwargs`, auxiliary `_build_call_kwargs`); the alias line
  is gone. Both sources merge (an OpenCode target that also declares a header gets both).
- Tests cut from six to two invariants: configured header carries one value per
  conversation on chat_completions, anthropic_messages and auxiliary kwargs (different
  for another session, caller-pinned wins); unconfigured → no header on any path.
- Docs: `configuring-models.md` per-provider options, `providers.md` entry key list,
  `cli-config.yaml.example` — the key is opt-in, default off, so DEFAULT_CONFIG is unchanged.

Why: a session-aware proxy classifies a request with no session id whose last message is a
tool_result as a NEW conversation and re-sends the whole history upstream (cache_write ≈
cache_read). Hermes already derives a rotation-stable conversation key for OpenCode; naming
the header per provider lets any proxy receive it without shipping an identifier by default.

Co-authored-by: 0xAlyDev <agentai891@gmail.com>
2026-09-19 01:02:31 -07:00
0xAlyDev
ece07d24fa feat(agent): per-provider session_affinity_header (#104449) 2026-09-19 00:55:34 -07:00