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

Copy link
Copy Markdown

Summary

  • Generate one resp_ id before response serialization and retain a bounded record for its exact model frontier, prompt configuration, and generated tool-call bindings.
  • Resolve valid append-only previous_response_id requests from that record, render and tokenize only the supplied continuation tail, and synchronize it onto the saved prefix.
  • Preserve the existing full-replay path for complete histories, edits, configuration mismatches, expired state, and unavailable checkpoints.

Persistence and limits

Disk-backed response state now follows the normal continued-cache boundary instead of copying a checkpoint after every completed turn. A failed or over-budget write still advances the recorded boundary, preventing short tails from repeatedly staging the same payload. Durable records restore their response metadata and tool-call bindings after restart; ids between durable boundaries remain live-process continuations and require replay after restart or slot displacement.

The response-state index is FIFO-bounded. The endpoint benchmark covers HTTP dispatch through prefix synchronization with a byte-tokenizer/checkpoint fixture; it does not measure model or GPU inference throughput.

Testing

  • make -B cpu -j2
  • make -B ds4_test -j2 && ./ds4_test --server
  • make -B tests/responses_replay_bench -j2 && ./tests/responses_replay_bench --turns 172 --iterations 20
  • Disk-cache fixture runs covering a shaped retained checkpoint, short steady-state tails, restart restoration, and an over-budget checkpoint rejection.

No model-backed Metal, SSD-streaming, CUDA, or distributed run was performed.

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

Metric Before After Change
host_ingress_ns/op 3181149 483897 84.8% lower
All 5 declared correctness checks passed.

Authored and verified by Perfloop: every claim above was co-measured on both trees and independently re-verified before submission — the full record is public: case_avefhzk2jy. Replies from this account are human-approved, and a human operator is accountable for this contribution.

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