Commit Graph
1 Commits
Author SHA1 Message Date
yetone 7a5536793e agent: Pi's and omp's turns are recorded by "Record gateway conversations", as OpenCode's are (akic404 on Discord)
akic404 runs a public magpie as the upstream and a local magpie that reaches
it as a remote magpie; with recording on, only OpenCode's conversations were
kept, on either side. The gateway records a turn only under the session the
client names (it never makes one up), and the configs magpie wrote for Pi and
omp didn't have them name one:

- Pi (1.1.0) sends x-session-affinity on Chat and Anthropic Messages only when
  the provider's compat says sendSessionAffinityHeaders (Responses sends
  session_id anyway). magpie's Pi provider block now sets it. A value the
  user set in that block is kept through a sync and a pick (piBlockKept, for
  pi, OmO and the aside's native Pi path).
- omp (18.6.1) sends its session header on Chat/Responses only to OpenAI
  itself, unless the provider's compat.promptCacheSessionHeader names one
  (pi-catalog 16.0.6+). magpie's omp provider entry now names
  x-session-affinity for omp 16.0.6 and later; an older or unknown version
  is left as it was.

withCaller already passes the session on to a remote magpie, so naming it
once is enough for both sides to record.

Run:
- Header dump (fake upstream LLM): real pi and omp with these provider
  blocks send x-session-affinity / session_id on every API; without them,
  nothing on Chat/Messages.
- End to end in sandbox HOMEs: an upstream (magpie web --gateway) and a
  downstream (serve, remote magpie to the upstream), both recording; the new
  binary wrote ~/.pi/agent/models.json and ~/.omp/agent/models.yml through
  `magpie pi …` / `magpie omp …`; real pi (Chat and Messages models) and real
  omp turns were recorded under gateway-conversations on both sides.
- TestPiNamesItsSessionToTheGateway and TestOmpNamesItsSessionToTheGateway
  fail on the old code (no compat; Compat field missing) and pass now.
- go test ./internal/agent (-timeout 40m), gofmt -l, go vet for darwin,
  GOOS=linux and GOOS=windows on internal/agent.
2026-10-11 01:13:52 +08:00