Skip to content

server: resolve Responses response ids to KV prefixes - #752

Open
perfloop-agent wants to merge 2 commits into
antirez:mainfrom
perfloop:perfloop-pr-open-f6q95834h9
Open

server: resolve Responses response ids to KV prefixes#752
perfloop-agent wants to merge 2 commits into
antirez:mainfrom
perfloop:perfloop-pr-open-f6q95834h9

Conversation

@perfloop-agent

@perfloop-agent perfloop-agent commented Aug 9, 2026

Copy link
Copy Markdown

Summary

  • Add a bounded, server-local response-state index for /v1/responses. Compatible append-only requests with previous_response_id restore the exact KV frontier and parse, render, and tokenize only their new input tail.
  • Generate the same id before streaming or buffered serialization, retain tool-call bindings and prompt configuration, and persist eligible frontiers at the existing continued-cache cadence so retained ids can resume after restart.
  • Keep full replay for first requests, edits, configuration mismatches, and unavailable or evicted state. Response ids are opaque local handles rather than authorization; a missing retained checkpoint after restart asks the client to replay.

Test plan

  • make -B cpu -j2
  • make -B ds4_test -j2 && ./ds4_test --server
  • make -B tests/responses_replay_bench -j2 && ./tests/responses_replay_bench --turns 171 --iterations 20 --disk-cache-mb 1024 --continued-interval-tokens 8192 --checkpoint-tokens 8198 --checkpoint-bytes 136806400 --expect-checkpoint-saved
  • make -B tests/responses_replay_bench -j2 && ./tests/responses_replay_bench --turns 171 --iterations 2 --disk-cache-mb 1024 --continued-interval-tokens 8192 --checkpoint-tokens 8198 --checkpoint-bytes 136806400 --restart-check --expect-checkpoint-saved
  • make -B tests/responses_replay_bench -j2 && ./tests/responses_replay_bench --turns 171 --iterations 2 --disk-cache-mb 64 --continued-interval-tokens 8192 --checkpoint-tokens 8198 --checkpoint-bytes 136806400 --expect-checkpoint-skipped

The benchmark uses the token-only test fixture, so it covers host-side request handling and continuation state rather than model or GPU inference.

Workload: in-memory steady-state 8k-token Responses response-id host ingress

Metric Before After Change
host_ingress_ns/op 3164948 425542 86.6% lower
Checks: 5 passed.

Generated by Perfloop. Human sponsor: Tomas Senart. Measurements and checks.

@perfloop-agent
perfloop-agent force-pushed the perfloop-pr-open-f6q95834h9 branch from 6af2990 to 79a2cc3 Compare August 13, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant