Skip to content

fix: preserve compacted history during OpenAI tool continuations - #160895

Merged
obviyus merged 2 commits into
openclaw:mainfrom
brandon-julio-t:fix/compaction-tool-replay
Sep 29, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
brandon-julio-t:fix/compaction-tool-replay

Conversation

@brandon-julio-t

@brandon-julio-t brandon-julio-t commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Closes #160889

What Problem This Solves

Fixes OpenAI tool continuations resending the full covered conversation when replay ID repair deletes an inline compaction checkpoint.

User Impact

OpenAI Responses sessions keep the compaction checkpoint on their next tool-loop request, avoiding unnecessary resubmission of covered history. Tool/result repair stays active. No configuration change or migration is required.

Why This Change Was Made

downgradeOpenAIFunctionCallReasoningPairs removes orphaned fc_* item IDs when no separate replayable reasoning block precedes a tool call. Its replacement block previously caused replaceCompactionReplayOwnerContent to invalidate the checkpoint, even when the edit was entirely after the checkpoint boundary. Responses ID normalization has the same interaction.

The shared checkpoint owner now preserves checkpoints for same-length replacements when every covered prefix block remains the same object in the same position. Prefix changes still invalidate them; existing removal reindexing and empty-owner handling remain intact. The Workshop budget proposal in #159687 addresses a separate problem.

Evidence

  • Fresh live OpenAI proof: on head e6091958b13de3aace448d25ebc7acdbfc21e344, two real requests to https://api.openai.com/v1/responses returned HTTP 200. The first streamed a real checkpoint followed by a tool call with no separate thinking block. After JSON transcript serialization/restoration, the production stream wrapper and sanitizer repaired its ID while retaining the byte-identical checkpoint. The next request contained only compaction -> function_call -> function_call_output, omitted covered source history and the orphaned function item ID, and received exactly ready. No injected checkpoint, local server, repair bypass, or fallback was used. Redacted request sequence, provider request IDs, assertions, and runnable one-off harness.
  • Before/after regression: four deterministic cases fail on unchanged upstream 80864601bf9e6fba4d1cf34a9f1bfabe3516b6ad because the embedded stream sanitizer removes providerReplay; 63/63 focused tests pass after the fix. The five new cases check serialized checkpoint/tool/result order, exclusion of covered history, matching repaired IDs, omitted orphan item IDs, and missing-result synthesis. Existing coverage retains prefix-edit invalidation, removal reindexing, compaction-only checkpoints, route/identity barriers, and retained-user handling.
  • Independent review: repository autoreview reviewed the runtime patch and corrected regression fixture through P2. Its staged-only fixture typing finding was resolved with the reviewed role-narrowing fix; no other actionable findings were reported. The reviewed runtime head is unchanged for the fresh proof.
  • Local checks: formatting, git diff --check, core production typechecking, both affected test typecheck graphs (agents-other, packages), type-aware lint on all three changed files, and the focused changed-test gate pass, including repository guards and graph boundaries.

Focused tests (8.59 s wall, one worker):

pnpm test src/agents/embedded-agent-runner/run/attempt-tool-call-replay-sanitization.compaction.test.ts packages/ai/src/transports/provider-compaction-replay.test.ts src/agents/embedded-agent-helpers/openai.test.ts src/agents/embedded-agent-runner/run/attempt-tool-call-replay-sanitization.test.ts --maxWorkers=1

Measured standalone cost: new regression 4.16 s wall / 1.32 s Vitest; checkpoint-owner suite 4.12 s wall / 2.15 s Vitest. The committed tests use no timers, network calls, or Gateway boots. Fresh one-off live proof: 6.565 s test / 7.54 s Vitest / 8.71 s runner; synthetic input, gpt-5.2, store:false, compaction threshold 2048, reasoning none. No production Gateway state or customer conversations were changed. Local environment: Amazon Linux 2023 ARM64, Node 26.10.0, pnpm 12.5.1, Vitest 5.0.1.

CI follow-up

The original cron shard failure exceeded the 10-second completion watchdog in src/cron/service.wake-now-real-heartbeat.test.ts, “drains coalesced cron and exec work without recurrence while retaining late arrivals” (10.221 s). The file is unchanged by this PR, injects synthetic replies, and does not execute the changed Responses/checkpoint path.

The unchanged PR head passed the exact 50-file manifest with the same CI runner and three workers: 393/393 tests, 50/50 files, 206.94 s Vitest / 208.84 s runner. That case took 7.603 s. This passing reproduction does not prove a fix or establish the timeout's cause. Nearby PRs #160892, #160888, #160887, and #160878 had no matching red when inspected; the latest full main run had different plugin failures. We are not classifying this cron timeout as an inherited failure. No unrelated fix, timeout increase, workflow rerun, or extra push was made.

Limits: the fresh live test proves OpenAI accepts the retained-checkpoint tool continuation, not guaranteed cache hits or reduced billing: provider input usage was 8142 then 8272 tokens, with zero cached tokens in this small case. Historical raw provider bodies remain unavailable, so individual historical misses cannot be certified. This isolated proof does not boot the full Gateway/Workshop loop. Full local build and repository-wide tests were not run. Hosted CI and maintainer review remain authoritative for merge readiness; the original cron CI timeout remains unresolved.

Maintainer verification

Thanks @brandon-julio-t for the report and fix. Refreshed on current main (merge head 17b7322).

Owner check: the change only stops replaceCompactionReplayOwnerContent from dropping a checkpoint when a same-length rewrite leaves every covered prefix block untouched. Whether a stored checkpoint may be replayed is still decided at request time by resolveNewestOpenAIResponsesCompactionReplay against the model, base URL, session and auth profile it was captured for, so a stale checkpoint stays unreplayable.

Real CLI run: isolated pnpm openclaw --profile … agent --local sessions (own home, state dir and config) on an openai-responses provider pointed at a local mock Responses server that records request bodies. After two plain turns, the mock answers with an inline compaction item followed by a read call call_lookup / fc_lookup with no reasoning item, so the tool ID needs repair. The checkpoint is captured by the real stream path (the mock returns it inline because the client does not send context_management to a non-native URL).

Request main (fix reverted) this PR
Tool continuation after the checkpoint 9 items, 37,045 bytes: both covered history turns resent, no compaction item 5 items, 32,557 bytes: compaction -> function_call(call_lookup) -> function_call_output, covered turns omitted, fc_* ID still stripped
Next user turn, same route full history resent checkpoint replayed
Next turn after changing the provider base URL (127.0.0.1 to localhost) full history, no checkpoint same (identical body)
Next turn with a different model on the same provider full history, no checkpoint same (identical body)
Separate session: checkpoint + reasoning item + tool call (no ID repair) checkpoint replayed identical body

All five new sanitizer regression rows fail with the fix reverted and pass with it; the 63 focused tests pass on the merged head.

No overlap with Pash/Sarah changes (no commits by either on the changed files).

@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Sep 29, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 29, 2026
@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 29, 2026, 12:28 AM ET / 04:28 UTC (Revision 3).

ClawSweeper review

What this changes

The branch preserves an OpenAI Responses compaction checkpoint when tool-call repair changes only assistant content after the checkpoint, and adds replay regression tests.

Merge readiness

✅ Ready for maintainer review

Current main still drops the checkpoint in the reported tool continuation, and this PR addresses that behavior. The changed path has focused regression coverage, live OpenAI continuation evidence, and an isolated CLI comparison. No actionable patch defect was found.

Priority: P2
Reviewed head: 17b7322d551602679eb93f54d3417c45dd423bdf

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Direct provider evidence and a current-head CLI comparison support a small owner-level repair with meaningful regression coverage.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The changed checkpoint owner feeds the embedded stream sanitizer and Responses transport. The captured live OpenAI trace shows an accepted after-fix checkpoint/tool/result continuation without covered history, and the PR body reports a current-head CLI comparison through the production stream path; the reviewed production files match the live-proof head. No stored-data format changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed checkpoint owner feeds the embedded stream sanitizer and Responses transport. The captured live OpenAI trace shows an accepted after-fix checkpoint/tool/result continuation without covered history, and the PR body reports a current-head CLI comparison through the production stream path; the reviewed production files match the live-proof head. No stored-data format changes.
Evidence reviewed 8 items Introduced checkpoint rule: The PR preserves a checkpoint for a same-length content rewrite only when every covered prefix block remains at the same position.
Current main remains affected: At the fetched main revision, the replacement helper has no same-position suffix-rewrite rule; a newly allocated repaired tool-call block fails its identity-based retention check.
Production entry point: The embedded Responses stream installs the replay sanitizer, which repairs tool/result pairing and OpenAI tool-call IDs before transport conversion.
Findings None None.
Security None None.

How this fits together

The embedded agent runner repairs transcript tool calls before the OpenAI Responses transport builds its next request. The transport uses a valid compaction checkpoint to replace covered conversation history while retaining subsequent tool calls and results.

flowchart LR
  A[Saved conversation] --> B[Tool-call repair]
  B --> C[Checkpoint prefix check]
  C --> D[Replay eligibility check]
  D --> E[Responses request]
  E --> F[OpenAI response]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +8, Tests +128. Total +136 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 9 1 +8
Tests 2 128 0 +128
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 137 1 +136

Review metrics

Metric Value Why it matters
Production and test LOC production +9/-1; tests +128/-0 The production growth is confined to the checkpoint invariant; the tests cover the transport behavior and a prefix-edit control.
New regression cost 4.16 s wall; 1.32 s Vitest The PR body measures the standalone added suite against the repository's per-PR test budget.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #160889
Summary: The linked open issue describes the same checkpoint loss after OpenAI tool-call ID repair, and this PR is its candidate fix.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Land the narrow checkpoint-owner repair with its replay regression coverage, preserving request-time route and identity validation.

Do we have a high-confidence way to reproduce the issue?

Yes. The captured before-fix sanitizer cases lose providerReplay, and the reported isolated CLI comparison shows covered history returning on the affected current-main path.

Is this the best way to solve the issue?

Yes. The change repairs the shared checkpoint owner's covered-prefix invariant while leaving replay identity selection and tool/result repair with their existing owners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 743c2ceb72e7.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded OpenAI Responses replay bug that can resend covered history without blocking the core runtime.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The changed checkpoint owner feeds the embedded stream sanitizer and Responses transport. The captured live OpenAI trace shows an accepted after-fix checkpoint/tool/result continuation without covered history, and the PR body reports a current-head CLI comparison through the production stream path; the reviewed production files match the live-proof head. No stored-data format changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed checkpoint owner feeds the embedded stream sanitizer and Responses transport. The captured live OpenAI trace shows an accepted after-fix checkpoint/tool/result continuation without covered history, and the PR body reports a current-head CLI comparison through the production stream path; the reviewed production files match the live-proof head. No stored-data format changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-29T02:21:54.289Z sha e609195 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-29T02:41:43.829Z sha e609195 :: needs maintainer review before merge. :: none

@brandon-julio-t

Copy link
Copy Markdown
Contributor Author

Addressed the requested after-fix behavior proof on head e6091958b13de3aace448d25ebc7acdbfc21e344 with two fresh requests to https://api.openai.com/v1/responses on September 29, 2026 (02:31 UTC). No local server, injected checkpoint, or modified production helper was used for this run.

  1. The first streamed response contained a real compaction checkpoint followed by lookup, with no separate thinking block. The production parser stored the checkpoint and call_id|fc_item_id tool-call ID.
  2. The assistant message was JSON-serialized and restored to simulate transcript persistence. A synthetic ready tool result was appended.
  3. The same wrapStreamFnWithMessageTransform(..., sanitizeOpenAIResponsesReplayForStream) composition registered in attempt-stream.ts ran before the real Responses transport. It removed the unpaired fc_* item ID while retaining the byte-identical provider checkpoint.
  4. OpenAI accepted the next request (HTTP 200) and returned exactly ready; there were two requests total, with no fallback.

Redacted request sequence (generated IDs omitted; opaque checkpoint content redacted):

POST /v1/responses
  model: gpt-5.2
  input: [message(synthetic padding + request to call lookup)]
  context_management: [{type: compaction, compact_threshold: 2048}]
  reasoning: {effort: none}
  store: false
  -> HTTP 200; compaction + function_call(lookup), no separate reasoning
  -> request ID req_8f4c8997407f48818392b520e7c3e36b

POST /v1/responses
  input: [
    {type: compaction, encrypted_content: <unchanged provider checkpoint>},
    {type: function_call, call_id: <paired ID>, name: lookup, arguments: "{}"},
    {type: function_call_output, call_id: <same ID>, output: "ready"}
  ]
  covered source history absent; function_call.id absent
  previous_response_id absent; request body 3522 bytes
  -> HTTP 200; assistant text "ready"
  -> request ID req_f2470376e30b479bb04616a8ea7ebe04

The isolated live test passed in 6.565 s (7.54 s Vitest / 8.71 s runner). This proves the requested accepted continuation, not a guaranteed cache hit or billing reduction: provider input usage was 8142 then 8272 tokens, and cached tokens were zero in this deliberately small test. The earlier deterministic regression remains the before-fix proof. Production Gateway configuration and saved conversations were not changed.

Reproduce the live proof on this PR head

Configure OPENAI_API_KEY securely for the child process. Save the following temporary harness at src/agents/embedded-agent-runner/run/compaction-live-proof.test.ts and run:

pnpm test src/agents/embedded-agent-runner/run/compaction-live-proof.test.ts --maxWorkers=1 --testNamePattern 'real api.openai.com'

The harness uses synthetic text and a synthetic tool result, executes no tool action, and prints only statuses, request IDs, usage counters, and request-shape assertions. It does not print or persist credentials or opaque checkpoint bytes. It is one-off proof, not a new per-PR CI test.

import type { Context, Model } from "@openclaw/llm-core";
import { expect, it } from "vitest";
import { createOpenAIResponsesTransportStreamFn } from "../../../../packages/ai/src/transports/openai-responses-client.js";
import { sanitizeOpenAIResponsesReplayForStream } from "./attempt-tool-call-replay-sanitization.js";
import { wrapStreamFnWithMessageTransform } from "./message-transform-stream-wrapper.js";

it.skipIf(!process.env.OPENAI_API_KEY)("real api.openai.com continuation keeps a streamed checkpoint after tool ID repair", async () => {
  const requests: Array<Record<string, unknown>> = [];
  const responses: Array<{ status: number; requestId: string | undefined }> = [];
  const model = {
    id: "gpt-5.2", name: "GPT-5.2", api: "openai-responses", provider: "openai",
    baseUrl: "https://api.openai.com/v1", reasoning: true, input: ["text"],
    cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
    contextWindow: 400_000, maxTokens: 256,
  } satisfies Model<"openai-responses">;
  const streamFn = wrapStreamFnWithMessageTransform(createOpenAIResponsesTransportStreamFn(), sanitizeOpenAIResponsesReplayForStream);
  const run = async (messages: Context["messages"], first: boolean) => {
    const stream = await streamFn(model, {
      systemPrompt: "This is an isolated regression test. Call lookup once when requested. Once the result is ready, reply exactly ready.",
      messages, tools: [{ name: "lookup", description: "Return a synthetic test value", parameters: { type: "object", properties: {}, additionalProperties: false } }],
    }, {
      apiKey: process.env.OPENAI_API_KEY, sessionId: "public-compaction-proof", authProfileId: "proof-profile", transport: "sse",
      signal: AbortSignal.timeout(90_000),
      onResponse: (response) => { responses.push({ status: response.status, requestId: response.headers["x-request-id"] }); },
      onPayload: (payload) => {
        const next = { ...(payload as Record<string, unknown>), store: false, max_output_tokens: 512, reasoning: { effort: "none" },
          context_management: [{ type: "compaction", compact_threshold: 2048 }],
          tool_choice: first ? { type: "function", name: "lookup" } : "none" };
        requests.push(next);
        return next;
      },
    });
    return stream.result();
  };
  const user = { role: "user" as const, content: "Synthetic padding for a compaction regression. No customer information. The lookup tool returns ready. ".repeat(450) + "Call lookup now.", timestamp: 1 };
  const first = await run([user], true);
  expect(first.stopReason, first.errorMessage).toBe("toolUse");
  expect(first.providerReplay).toBeDefined();
  const toolCall = first.content.find((block) => block.type === "toolCall");
  if (!toolCall) throw new Error("Live response did not contain the expected tool call");
  expect(toolCall.id).toContain("|fc_");
  expect(first.content.some((block) => block.type === "thinking")).toBe(false);
  const persisted = JSON.parse(JSON.stringify(first)) as typeof first;
  const second = await run([user, persisted, { role: "toolResult", toolCallId: toolCall.id, toolName: toolCall.name, content: [{ type: "text", text: "ready" }], isError: false, timestamp: 2 }], false);
  expect(second.stopReason, second.errorMessage).toBe("stop");
  const input = requests[1].input as Array<Record<string, unknown>>;
  expect(input.map((item) => item.type)).toEqual(["compaction", "function_call", "function_call_output"]);
  expect(input[0].encrypted_content).toBe((first.providerReplay as { data: string }).data);
  expect(input[1].call_id).toBe(input[2].call_id);
  expect(input[1]).not.toHaveProperty("id");
  expect(JSON.stringify(requests[1])).not.toContain(user.content);
  expect(second.content.filter((block) => block.type === "text").map((block) => block.text).join("")).toBe("ready");
  console.log(JSON.stringify({ proof: "real api.openai.com -> production parser -> persisted transcript -> production stream wrapper -> real api.openai.com", head: "e6091958b13de3aace448d25ebc7acdbfc21e344", model: model.id, responses,
    firstResponse: { savedCheckpoint: true, toolIdRepairTriggered: true, separateReasoning: false, usage: first.usage },
    secondRequest: { inputTypes: input.map((item) => item.type), retainedCheckpointBytesIdentical: true, pairedToolResult: true, orphanItemIdIncluded: false, coveredHistoryIncluded: false, bytes: Buffer.byteLength(JSON.stringify(requests[1])) },
    nextResponse: { stopReason: second.stopReason, text: "ready", usage: second.usage }, requests: requests.length }));
}, 200_000);

@brandon-julio-t

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 29, 2026
@obviyus

obviyus commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Landing with pre-existing CI reds on exact head 17b7322d551602679eb93f54d3417c45dd423bdf (AGENTS.md: pre-existing reds do not block landing).

Review. The ClawSweeper review is ready on this SHA, with no findings and no security issues.

Inherited failures. Fresh run 36521172103 finished with no cancelled jobs. All three failing jobs are subagent tests, outside this Responses/compaction diff:

  1. subagent-registry.test.ts, "settles a collector yield seen through agent.wait without canceling it". The same case fails on unrelated PRs feat(audit): record observed runtime skill usage #141004 (job 109244563011) and fix(cron): remove memory-core dreaming jobs left behind by its unloaded sidecar #156667 (job 109230325532).
  2. subagent-spawn.production-boundary.test.ts, "admits a descendant using the configured child model" and "…parent session model", fail with "residual registry roots". The same cases fail on feat(audit): record observed runtime skill usage #141004 (job 109244562964) and fix(cron): remove memory-core dreaming jobs left behind by its unloaded sidecar #156667 (job 109230325466).
  3. server-methods/agent.test.ts, "handles subagent_settle followups… to a yielded orchestrator". The same case fails on main's full-release CI at the merged main SHA 842697352d2: job 109248952348.

Proof. A real isolated agent --local session against a recording Responses mock. With the fix reverted, the tool continuation after compaction resent the covered history: 9 items, 37,045 bytes. With the fix, it sent the compaction item instead: 5 items, 32,557 bytes. Controls on both builds: a different base URL or a different model still sends full history, and turns that need no ID repair are unchanged. 63 focused tests pass.

@obviyus
obviyus merged commit 7d8fe30 into openclaw:main Sep 29, 2026
230 of 239 checks passed
@obviyus

obviyus commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Landed in 7d8fe30. Thanks @brandon-julio-t for the report and the fix!

OpenAI Responses tool continuations now keep the compaction checkpoint after tool-call ID repair instead of resending the covered history. A checkpoint is still only replayed for the model, base URL, session and auth profile it was captured for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OpenAI tool continuations resend compacted history after ID repair

2 participants