Skip to content

Pi: add session-affinity headers and sanitized prompt-cache diagnostics #331

Description

@dgokeeffe

Problem

Pi sessions can be routed across multiple AI Gateway destinations when traffic splitting is configured. Prompt caches are destination-local, so a conversation needs session-affinity headers to avoid avoidable cache misses.

Cache-retention investigations also need reproducible, sanitized tooling. Current observations do not prove that GPT subagents have short retention: GPT-5.6 Sol rejects explicit in_memory, and observed expiry may be caused by UAG forwarding, backend eviction, or prefix matching.

Expected behavior

  • Enable Pi's production-safe session-affinity compatibility behavior.
  • Add opt-in diagnostic scripts that send stable prompt-cache prefixes and report cache usage without printing bearer tokens.
  • Cover 24h, provider-default, and explicit in_memory request construction.
  • Validate phase-separated saved state and fail cleanly on malformed state.
  • Preserve the measured 45/50/60-minute evidence without claiming a backend retention guarantee.
  • Do not force PI_CACHE_RETENTION or install a child/subagent short-cache policy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions