ChatGPT
Design a conversational AI product at the platform level: accepting turns, streaming generated output, managing conversation context, routing inference, and enforcing usage budgets.
Clarify this prompt before choosing components
Ask the highest-impact questions first, agree on priorities, and record the interviewer’s answers. If a detail is unspecified, state an assumption and explain which decision depends on it. The numbers in this worked lesson are exercise assumptions, not company facts.
| Ask the interviewer | Why the answer changes the design |
|---|---|
| Inference serving, chat history or model training first? | This exercise serves a model; training is a separate system. |
| Context limits, tokens/s and first-token/streaming targets? | Admission and KV-cache capacity follow token workload, not request count alone. |
| Cancellation, tool effects, privacy and billed retries? | Separate generated text from side-effecting tools and preserve usage identity. |
Use the Interview Playbook for the shared 45-minute sequence and fresher, intermediate, senior and staff evidence. Start with one complete operation. Extend the answer with the failure/recovery traces below, then defend a workload-specific alternative and a measurable rollout. Scope and evidence matter more than a large component list.
ChatGPT: Understand the building blocks
Choose a mechanism because it satisfies a requirement. These explanations describe the exercise design, not undisclosed implementation choices at the named company.
ChatGPT: Quick vocabulary
| Term | Meaning and role in this exercise |
|---|---|
| API: Application Programming Interface | The contract for requests, responses and errors between components. An API route does not itself enforce every business invariant. |
| GPU: Graphics Processing Unit | Parallel compute often used for inference/encoding. Its memory and scheduling limits are separate from ordinary request-server limits. |
| PK: Primary Key | The declared row identity in a database schema; it does not automatically enforce every cross-row business rule. |
ChatGPT: Large Language Model (LLM), tokens and inference
What it means: An LLM generates output from a tokenized context. Inference is the compute that produces that output; tokens are model input/output units rather than universally identical words.
Why this problem needs it: A conversation run has context and compute budgets.
How to use it: Pin a run’s accepted context/model policy, bound context/output and concurrency, and give streamed events a retention/resume contract.
Example in this design: Run r7 streams events 1–40, then reports interrupted if its worker dies.
When it fits: Useful when the product needs generated language rather than a deterministic lookup.
Alternative and limits: A deterministic template/search result is simpler when it satisfies the task. Reconnecting cannot reconstruct unstored inference state or guarantee the same new output.
ChatGPT: Server-Sent Events (SSE)
What it means: A server-to-client event stream over HTTP. Client commands still use a separate request path.
Why this problem needs it: The client primarily receives streaming output.
How to use it: Give events stable IDs and define retention/replay when reconnecting; bound slow-client buffering.
Example in this design: Reconnect at event 35 replays retained 36–40 without starting a new run.
When it fits: Useful for comments, progress or model output when the client primarily receives updates.
Alternative and limits: WebSocket provides bidirectional messaging. SSE event IDs are not a database transaction or a guarantee of unlimited replay.
ChatGPT: Key/value (KV) inference cache
What it means: An inference KV cache retains attention keys/values for previously processed tokens within the supported model/runtime policy. It is different from a cache of completed answers.
Why this problem needs it: Long active contexts create a separate inference-memory cost.
How to use it: Account for per-run context length and memory, use supported scheduling/eviction, and scope reuse to compatible permitted inputs.
Example in this design: A runtime may retain per-run token attention state, but that memory is not a durable event history.
When it fits: Useful to avoid recomputing a supported prefix while generating subsequent tokens.
Alternative and limits: Short contexts or smaller batch sizes reduce memory at other throughput costs. It does not make a lost worker’s run automatically durable or safely share private prompts.
ChatGPT: Retrieval-Augmented Generation (RAG)
What it means: RAG retrieves relevant permitted evidence and supplies it as context to a generative model. It is an optional retrieval stage, not training the model.
Why this problem needs it: Retrieval is optional when the answer requires permitted external evidence.
How to use it: Authorize candidate documents, retrieve/rerank within a budget, attach source identity, and evaluate whether the answer is grounded in the retrieved evidence.
Example in this design: Authorize a retrieved document before attaching its snippets to the run context; model output is still evaluated.
When it fits: Useful when answers require private, changing or attributable knowledge outside the accepted prompt.
Alternative and limits: A model-only answer or deterministic search may suffice. Retrieval can be wrong; adding a vector database does not guarantee correctness or prevent disclosure.
ChatGPT: Idempotency key and stored operation result
What it means: Idempotency means replaying the same logical operation produces no additional business effect. A key identifies that operation under a defined scope.
Why this problem needs it: Tool effects can outlive the stream.
How to use it: Atomically associate a request key and payload fingerprint with its effect and result. Return the stored result on replay; reject incompatible payload reuse.
Example in this design: A purchase-tool timeout retains its own action identity and uncertain outcome.
When it fits: Needed when a timeout can hide a successful commit or a queue can redeliver.
Alternative and limits: Unique business identities can enforce selected effects. A cache of recent requests alone may expire too early or race; local keys cannot control an uncooperative external provider.
Interview scope and guarantees
Accept a conversation turn, stream generated output, retain history and allow cancellation or retry. This is a generic conversational AI service design. Define model availability, context limits, first-token latency and privacy before adding tools or retrieval.
Capacity worksheet
Assume 1,000 requests/s with 10 seconds average generation time: about 10,000 concurrent generations. At 500 output tokens/request the service needs 500,000 output tokens/s. At 2,000 input tokens/request it must also process 2 million input tokens/s; requests/s alone is not an adequate capacity metric.
Concrete API contract
POST /conversations/{id}/turns {clientTurnId,text,model} -> {runId,eventStream}
GET /runs/{id}/events?after=...
POST /runs/{id}/cancel
GET /conversations/{id}Data model and access paths
conversations(id PK,owner_id,retention_policy)
turns(id PK,conversation_id,client_turn_id,request_hash,role,content,state); UNIQUE(conversation_id,client_turn_id)
runs(id PK,turn_id UNIQUE,model_version,context_version,status,current_generation,input_tokens,output_tokens)
run_attempts(run_id,generation,worker_id,lease_until,state); PK(run_id,generation)
stream_events(run_id,sequence,type,payload); PK(run_id,sequence)
tool_actions(run_id,action_id,request_hash,state,provider_ref); PK(run_id,action_id)Evolve a solution and explain each change
Read the diagram
Accept a conversation turn / Authenticate access, persist the user turn, and define a generation identity. / A retry can start duplicate expensive generations.; Stream bounded inference / Admit by token budget and model capacity; emit identified stream events. / Client disconnect does not automatically cancel computation.; Recover and control context / Store completion state, handle cancellation, and version model/context/tool execution. / Generated text and tool requests are not trusted authorization.
Step 1: Accept a conversation turn
Authenticate access, persist the user turn, and define a generation identity. A retry can start duplicate expensive generations.
Step 2: Stream bounded inference
Admit by token budget and model capacity; emit identified stream events. Client disconnect does not automatically cancel computation.
Step 3: Recover and control context
Store completion state, handle cancellation, and version model/context/tool execution. Generated text and tool requests are not trusted authorization.
Responsibility overview
Read the diagram
User to Conversation API: turn and retry identity; Conversation API to Turn store: commit generation state; Turn store to Admission queue: token-budgeted work; Admission queue to Inference worker: admit generation; Inference worker to Tool service: permissioned tool action; Inference worker to User: identified stream events
Worked end-to-end scenario
A user submits turn t8 and receives generation g8. The inference service emits numbered stream events; the client renders partial text but does not treat it as a completed assistant turn. The connection drops after event 40. Reconnect either resumes retained events for g8 or returns a clearly defined non-resumable status; it must not silently run another billed generation. Cancellation marks the generation and asks the worker to stop, while accounting records work actually consumed. If a tool is invoked, give the tool action its own idempotency and permission boundary. A model-generated instruction cannot grant access to another user’s conversation.
Why these access paths matter
Conversation and turn lookups are scoped to owner/membership. Generations carry turn, model version, context snapshot, status, and token usage; stream events carry sequence and bounded retention. Admission should budget tokens and duration, not merely request count. Context truncation or retrieval selection changes the answer, so record the chosen context boundary for debugging.
Build the baseline first
Read the diagram
Turn API → durable run → inference admission; Model worker → streamed token events → client; Final message → durable history → usage accounting
- Turn API → durable run → inference admission.
- Model worker → streamed token events → client.
- Final message → durable history → usage accounting.
Evolve the design under load
Read the diagram
Token-aware quotas → model-specific queues; Prefill/decode scheduling → bounded GPU batches; Optional retrieval → authorized evidence → prompt assembly
- Token-aware quotas → model-specific queues.
- Prefill/decode scheduling → bounded GPU batches.
- Optional retrieval → authorized evidence → prompt assembly.
Defend the hardest decision
Streaming reduces perceived latency but does not make inference cheap. Separate queue delay, time to first token and generation rate. Long prompts stress prefill; long answers occupy decode capacity and KV cache. Set input/output budgets before admission. Retrying a user turn should not silently create a second billable run; store a stable client-turn identity and define whether retry resumes or starts a new explicit attempt.
Failure and recovery analysis
A browser disconnects halfway through generation. Decide whether to cancel promptly or retain events for resumption; unbounded background runs waste scarce capacity. A tool call with side effects needs its own approval and idempotency boundary. Retrieved documents and model output are untrusted data and cannot grant permission to execute arbitrary actions.
Security and privacy boundary
Authorize conversations and retrieval sources, isolate tool credentials, redact sensitive logs and avoid using private context across users.
Interview follow-ups with reasoning
Question: How do you handle model overload?
Show answer and explanation
Answer: Queue within a deadline, offer an explicit fallback or reject with a retry hint.
Question: How do you evaluate quality?
Show answer and explanation
Answer: Use task-specific test sets, groundedness checks and human review, not latency alone.
Question: How do you enforce deletion?
Show answer and explanation
Answer: Track history, logs, retrieval indexes and backups under a stated retention policy.
Operate and verify the design
Queue delay, time to first token, tokens/s, cancellation waste and retrieval quality.
Disconnect mid-generation, resume or cancel according to policy, and verify no accidental second billable run.
A second scenario to test transfer
A user sends a turn and receives the first 200 tokens before the model worker disconnects. The client has a partial response cursor. The service can resume the same generation if supported, restart as a clearly marked new attempt, or return a recoverable interruption. It should not append an unlabelled second answer that looks like one continuous output.
A generation streams a partial answer, then a tool request times out after possibly succeeding. What should the user and system see?
Show answer and explanation
Answer: Show the generation as interrupted or awaiting tool reconciliation, with a stable turn and action identity. Query or retry the same idempotent tool action when its contract allows; otherwise surface uncertainty for confirmation. Do not present a second unlinked answer or repeat a purchase under a new identity.
Compare alternatives
| Boundary | Guarantee | Key risk |
|---|---|---|
| Turn acceptance | Stable persisted turn | Duplicate submit |
| Token stream | Ordered partial output | Disconnect/resume gap |
| Inference worker | Bounded attempt | Cost and queue overload |
| Tool execution | Authorized auditable action | Ambiguous external effect |
A design-changing exercise
The browser closes. Can the service immediately mark generation failed and retry later?
Show answer and explanation
Answer: Only under a stated lifecycle policy. The worker may still be generating; retain its identity, coordinate cancellation, and prevent an automatic duplicate generation.
Design workshop: one turn, bounded inference, typed stream
Requirements, API, and durable identities
This is a generic conversational AI service design; none of its choices claim to describe OpenAI internals. Core scope is conversation history, streamed responses, cancellation, reconnect, bounded GPU scheduling, and authorized tools. Model training is excluded; RAG is a separately scoped extension. Choose a two-second time-to-first-token target for admitted short prompts, an explicit context limit, and a resumable event horizon. A queued run must be shown as queued; it is not an already running stream.
POST /conversations creates a tenant-owned thread. POST /conversations/{id}/runs carries clientTurnId, user content, selected model version, and output budget; it atomically persists the user message and one logical run under a request fingerprint. GET /runs/{id}/events?after=N replays typed, sequenced events; an expired cursor returns reset status plus durable run state instead of starting another generation. POST /runs/{id}/cancel is idempotent. Tool calls use a separate permission/idempotency boundary and never inherit authority from model text.
Conversation(tenant_id, version), ordered Message(role, content, token_count), GenerationRun(state, model_version, attempt_generation, prompt_tokens, output_budget), StreamEvent(run_id, sequence, type), UsageRecord(run_id unique), and per-tenant AdmissionBudget(queue_tokens, active_work_tokens) separate conversation history, stream progress, billing, and scheduler capacity. Reuse of (conversation_id, clientTurnId) with the same request returns the same run; changed text or model terms conflict. A model version and context manifest are pinned for replay and audit.
For an illustrative serving calculation, assume 32 transformer layers, 8 KV heads, dimension 128, and 2-byte K/V values. One token occupies 2 × 32 × 8 × 128 × 2 = 131,072 bytes (128 KiB). One 8,192-token sequence reserves about 1 GiB before allocator/workspace overhead; 32 active sequences need about 32 GiB just for KV state. This makes maximum context, active sequence count, and per-tenant memory budget admission controls. The architecture-specific arithmetic is not a universal model size; measured model config and cache format must replace these assumptions.
Read the diagram
Create conversation or submit stable clientTurnId; Check tenant, fingerprint, and context budget; Commit user message and unique GenerationRun atomically; Enqueue accepted run with pinned model/context version; Return the same run ID for retries of the same turn
GPU backlog admission must be honest: a queued response is not an already running stream.
Unique(conversation,clientTurnId) maps to one logical run with request fingerprint. Persist model/context version, current attempt generation and typed stream_events(run,sequence,type,payload). Types include started, token_delta, tool_requested, tool_result, completed, interrupted and canceled. GET /runs/id/events?after=N replays retained events; expired history returns reset_required with durable current run status. A retry with changed text/model under the same turn identity returns 409.
Read the diagram
Submit client turn T8; get run R8; Admit attempt generation 3 with pinned context; Append numbered token deltas 1..40; Reconnect after 40, not submit a new billed turn; Tool action A under separate permission/idempotency check; Conditional completed event; reject revoked attempt generation
Cancellation and completion serialize on run state. The first valid terminal transition wins under a declared rule; a cancel request marks cancel_requested, revokes publication ownership if cancellation wins, signals the worker and records consumed usage. Already delivered tokens remain visible as partial output. A stale worker cannot append another completed answer after the run is canceled. Distinguish one logical run from potentially repeated costly inference attempts; charge once according to the selected billing policy and retain attempt evidence for reconciliation.
Context assembly applies access checks before retrieving conversation/documents, counts tokens using the selected model tokenizer and pins exact input evidence. For an 8,192-token context limit, reserve 1,024 output tokens and 512 system/tool tokens, leaving 6,656 for user/history/retrieval. Truncate or summarize old turns under a visible policy; do not silently cut critical tool state. A retained summary carries source/version so replay/debugging can reconstruct what was sent. Require source-message IDs, a content fingerprint, tokenizer version, summary version, and a measurable quality check against a versioned test set; reject a summary that fails the configured threshold or splits a user/assistant turn. Keep whole turns when truncating, and retain tool-call/result pairs as atomic context units. The input budget is prompt + system/tool context + reserved output; reject or explicitly summarize before enqueue rather than trimming silently.
Read the diagram
Load tenant-authorized history and pinned summary provenance; Reserve system, tool, history, and output tokens within model limit; Persist run and bounded queue deadline; Cancel queued work before dispatch or revoke a running generation; Terminal state and usage win once; stale worker output is fenced
Read the diagram
Assumption / Calculation / Memory; 32 layers, 8 KV heads, head dimension 128 / 2 for K/V × 32 × 8 × 128 × 2-byte values / 131,072 bytes/token; 8,192 tokens for one sequence / 128 KiB × 8,192 / 1 GiB KV before allocator overhead; 32 such sequences / 32 × 1 GiB / 32 GiB KV plus model weights/workspace; More heads/layers or longer contexts / Linear in those dimensions for this model / Request count alone is insufficient admission metric
The formula assumes the specified grouped-query attention architecture and uncompressed two-byte KV values; other models/attention schemes differ. Prefill processes prompt tokens and can block latency-sensitive decode if scheduled carelessly. Continuous batching admits/finishes sequences per decoding step while a token/KV-memory budget limits total active work. Chunked prefill and bounded prompt/output limits protect decode fairness. Routing assigns model/version-specific replicas; worker queues are isolated by token and GPU memory budget, not merely requests/s.
Read the diagram
Queue by tenant with a bounded wait deadline; Round-robin eligible tenant using reserved prompt plus decode tokens; Claim one attempt generation and pin model/context versions; Run prefill, then join continuous decode batches; Persist started state and release reservation at terminal transition
Measure prompt-token throughput, generated tokens/s, active KV bytes, queue wait, first-token and inter-token latency separately. Prefix reuse is allowed only with model/context/version-safe cache keys and tenant/privacy policy; a cache hit must not expose another user's content. A replica failure marks the attempt interrupted. Resume retained emitted events where possible, but do not pretend an arbitrary lost GPU execution state can resume generation from exactly the same internal state.
For a RAG extension: authorized documents→versioned chunking→retrieval candidates→reranking→bounded context with citations. Evaluate answer grounding and retrieval recall using versioned test sets; retrieval content is untrusted and cannot authorize tools. Tools enforce user/account scopes and operation identities outside model instructions. Ambiguous external effects query original action evidence rather than issue an unrelated purchase/send.
Read the diagram
Component / Authority or responsibility / Bound and replay contract; Conversation API and store / Tenant-owned turn and stable run identity / Changed-key conflicts; atomic user message plus run; Context assembler / Authorized history, summary provenance, token accounting / Model limit; whole-turn truncation; Fair scheduler and GPU pool / Prompt prefill and token-by-token decode / Per-tenant token budgets; queue deadline; KV cap; Run event store / Sequenced partial output and terminal state / Cursor replay; one usage record per run; Cancellation and usage ledger / Revoke attempt and finalize measured consumption / Terminal transition wins once; no charge for never-started queue work
Read the diagram
Start run R and receive event cursor 0; Persist token deltas 1 through 40; worker crashes before completion; Reconnect after 40 and replay retained events for R; Return interrupted status; never enqueue a second attempt implicitly; Cancel a queued or running run using the same terminal state guard; Finalize one usage record from prompt and emitted-token evidence
A cancellation/complete race serializes on the run row: whichever terminal compare-and-set commits first wins. Running cancellation fences the attempt generation and signals the worker; tokens arriving afterward are rejected. Queued cancellation consumes no inference budget in this example policy. A worker crash records an interrupted partial result and usage; a user must explicitly start a new, separately identified run to request another answer.
Operations and practice
SLIs: queue wait and deadline expirations by tenant/model; prompt prefill tokens/s; decode tokens/s and inter-token latency; time-to-first-token; active KV bytes and allocation failures; stream replay/reset rate; cancellation-to-worker-stop time; interrupted runs; and usage-finalization lag. Overload controls: enforce per-tenant queue depth and active-token limits, total KV budget, maximum prompt/output tokens, tool concurrency, and bounded stream retention. Expire work past its advertised queue deadline and return a clear status. Recovery: reload run state and latest event sequence; resume event replay from the durable suffix; treat an interrupted inference attempt as partial, not resumable GPU state; reconcile usage from durable prompt/output evidence. Access: tenant checks apply to conversation, run, stream, summary sources, and tools. Tool authorization is evaluated outside model instructions and rechecked at execution. Dominant cost: accelerator time and KV memory, driven by prompt length, generated token count, model version, and active sequence mix.
Practice prompt: Design a multi-tenant conversational generation service with streaming, a hard context limit, cancellation, and reconnect. Follow-up: the worker emits 40 tokens, crashes, and a reconnect races with a repeated run request and cancellation. Rubric: persist stable turn identity before inference; budget context plus output; fairly admit work by tenant token budget; distinguish prefill and decode; sequence durable stream events; return replay/reset rather than regenerating; fence workers on cancellation; finalize usage once from measured work; preserve summary provenance and quality checks. Invariant: one client turn maps to one logical run, and retries may replay its output but cannot create a second inference or usage record.
Exercise: Tool A may have succeeded before timeout and the inference worker crashes. May a restarted run simply invoke another tool action B?
Show answer and explanation
Answer: No. Reconcile A with its provider key/status under the original permission boundary. Surface uncertainty if it cannot be resolved. A new run/attempt does not grant a new side effect or justify duplicate billing.
vLLM PagedAttention and prefix caching design are primary implementation references for paged KV storage and block reuse; the numerical model and product state machine above are explicit teaching assumptions.
Requirement trace and verification
| Requirement | Implementing design block | Verification link |
|---|---|---|
| R1 — Complete the primary user journey within the stated scope. | P01–P04; P09–P10. | V1 — Exercise the successful journey and the excluded/boundary case stated in the scope. |
| R2 — Preserve the problem's authoritative data invariant under concurrency. | P05–P06; P11–P12; DD1. | V2 — Run the race/replay case below and assert the invariant at the durable authority. |
| R3 — Meet the declared scale and API behavior without unbounded work. | P05–P08; P13–P14; relevant overload deep dives. | V3 — Exercise the API errors/retry identity and recompute the workload assumption that drives partition or capacity. |
| R4 — Recover from the named failure without losing or duplicating the user-visible outcome. | P15–P16; deep dives; Operations contract. | V4 — Reconnect repeatedly, cancel queued and running jobs, and crash after partial output; avoid duplicate billing and leaked generation work. |
Operational contract
| Area | Decision and signals |
|---|---|
| SLIs | Queue wait by tenant; time-to-first-token; stream replay gap; cancellation lag; token/usage reconciliation error. |
| Overload limits | Cap queued tokens, active generations, context length, stream buffer, and per-tenant GPU budget. |
| Recovery | Fence worker generations; resume from persisted event sequence; reconcile usage once after cancellation/crash. |
| Access controls | Isolate tenant conversation data, enforce model/tool permissions, and redact secrets from prompts/traces. |
| Dominant cost | Accelerator time, KV-cache memory, and retained conversation/stream data. |
Senior-level interviewer follow-ups
Question: A tool call returns after the user cancels the generation. Can it still perform its side effect?
Show answer and explanation
Answer: Cancellation revokes the run generation, and the tool boundary must check current authorization before execution and before committing results. Side-effecting tools need their own idempotency key and explicit cancellation semantics.
Question: How would you reduce GPU cost without violating latency targets for short prompts?
Show answer and explanation
Answer: Batch compatible requests within a bounded wait window, schedule by service class and token budget, and separate prefill from decode constraints. Measure queue delay and tail latency, not only aggregate utilization.
A 60-second design answer
I would persist a logical turn and run ID, then stream numbered events from an inference worker. A scheduler budgets tokens and GPU memory across prefill and decode; cancellation fences later events and tools. Tool calls require a narrow permission boundary, and retrieval applies ACLs before context assembly. I would monitor queue time, token throughput, KV memory, cancellation, and tool failures.
Related concepts to revisit
Managing Long Running Tasks API Gateway
Technical references
Kafka processing and external-sink boundaries.
PostgreSQL transaction isolation and concurrent updates.
Recover a partial run without starting it again
Turn t7 creates run r7. Events 1..40 were durably published before the inference worker crashed. A client resumes after 35 and receives 36..40 plus the interrupted status. It does not automatically schedule another generation or pretend the partial answer completed. A user-requested retry creates a clearly identified new run under its accounting policy.
run r7: events 1..40; state interrupted
client cursor 35 -> replay 36..40 + terminal status
retry intent -> separately identified run, not silent continuationRead the diagram
run r7: events 1..40; state interrupted; client cursor 35 -> replay 36..40 + terminal status; retry intent -> separately identified run, not silent continuation
Token budgets include the system/context/tool/output allowance under the selected model's contract. Summaries retain provenance and do not silently override source facts. Admission distinguishes prefill/decode pressure, bounds waiting work and enforces tenant shares. Cancelling a run fences further accepted output and releases applicable compute, but cannot undo a completed external tool effect. A tool timeout may be an uncertain purchase, not permission for a new purchase key.
Show answer and explanation
Answer: Replay identity is (run,event sequence), not the text string. Duplicate text can be legitimate output; a duplicate event cannot be billed or applied as a new event under the stated policy.
Decision review: ChatGPT
ChatGPT: What it is
An AI conversation exercise accepts turns, runs bounded inference and streams identified output events with an honest completion state.
ChatGPT: Why it is needed
Reconnect, cancellation and tool uncertainty can repeat work or misrepresent a partial answer as completed.
ChatGPT: When to use it
Use durable turn/run identities when a caller may resume a stream or when tool effects survive a connection. State whether interrupted inference can resume or only replay stored output.
ChatGPT: How to use it
Pin the accepted turn, context/model policy and run attempt. Persist or retain output under a declared event horizon, resume by run/cursor and fence publication by the current attempt. Bound input, output and concurrent inference cost.
ChatGPT: Compare an alternative
Restarting inference can give a different answer and additional cost; do it as a declared new attempt rather than silently on reconnect. Tool actions need their own effect identity and external reconciliation.
ChatGPT: Worked decision exercise
The following inputs and policies are original exercise assumptions; they are not measurements or undisclosed company behavior.
Run r7 emits events 1–40 and its worker dies. A reconnect with cursor 35 replays 36–40 and reports interrupted. It does not start r8 merely because the browser connection changed, and it cannot promise to reconstruct unstored model state.
Read the diagram
Run r7 emitted events 1 through 40; Reconnect cursor 35 replays 36 through 40; Report interrupted; reconnect does not create r8; A tool timeout preserves its separate action identity
What happens when a purchase tool times out after the purchase may have committed?
Show answer and explanation
Answer: Keep the tool action identity and uncertain status, then reconcile through the supported interface or request a deliberate user decision. Do not blindly create another purchase. Cancellation can stop future work but cannot undo already completed external effects.
ChatGPT: Check the design
Monitor queue wait, token/context budgets, interrupted runs, replay retention and uncertain tool actions separately. Avoid including private conversation content in routine logs.