Skip to content

[Bug]: Copilot replay repair leaves invalid reasoning item IDs #83220

Description

@galiniliev

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

GitHub Copilot native Responses replay still sends invalid overlong reasoning.id values after tool-call ID repair, causing Copilot to reject the request body before generation.

Steps to reproduce

  1. Resume an existing same-model github-copilot/gpt-5.5 agent session that contains persisted Responses reasoning items with provider-generated IDs longer than 64 characters and persisted tool calls whose IDs have already been repaired/normalized.
  2. Build the next native Responses request from that session history.
  3. Send the request through the GitHub Copilot native Responses route.

Expected behavior

The outbound Copilot Responses payload should contain only provider-valid replay-visible item IDs and call IDs, so the next request can reach model generation.

Actual behavior

Copilot rejects the request before generation with 400 {"message":"","code":"invalid_request_body"} and OpenClaw reports LLM request failed: provider rejected the request schema or tool payload.

OpenClaw version

Source checkout after 4537b89da6 (fix(agents): normalize Copilot replay tool IDs); packaged version NOT_ENOUGH_INFO

Operating system

NOT_ENOUGH_INFO

Install method

NOT_ENOUGH_INFO

Model

github-copilot/gpt-5.5

Provider / routing chain

OpenClaw agent runtime -> GitHub Copilot native Responses route

Additional provider/model setup details

The failing route was provider=github-copilot, api=openai-responses, endpoint=github-copilot-native, route=native, policy=none. Private agent/session identifiers and local paths are redacted.

Logs, screenshots, and evidence

Observed on 2026-05-17 after the tool-call ID repair landed:
- At least three failures on the same affected agent workflow: two web-chat attempts around 15:35-15:36 UTC and one scheduled-job attempt around 17:44 UTC.
- OpenClaw repaired one assistant message before each failing request.
- The request used provider=github-copilot, model=gpt-5.5, api=openai-responses, endpoint=github-copilot-native.
- Failure: LLM request failed: provider rejected the request schema or tool payload.
- Provider raw error preview: 400 {"message":"","code":"invalid_request_body"}
- Provider runtime failure kind: schema.
- The scheduled-job lane backed off after repeated consecutive failures.

Sanitized structural probe of the affected session, without prompt/chat content:
- Source session: assistantToolCalls=114, toolResults=114, over64ToolCallIds=114, over64ToolResultIds=114, duplicateToolCallIds=0, orphanToolResults=0.
- Outbound payload after current code: inputItems=317, functionCalls=114, functionOutputs=114, callIdsOver64=0, orphanOutputs=0, duplicateIds=0, idsOver64=53, maxIdLen=408.
- Offending outbound item type: reasoning. reasoning count=53, idsOver64=53, maxIdLen=408.
- Function-call replay IDs were already repaired: function_call idsOver64=0, function_call maxIdLen=19, maxCallIdLen=29, function_call_output maxCallIdLen=29.

Impact and severity

Affected: Copilot-backed agent sessions with persisted same-model Responses reasoning items whose IDs exceed Copilot's accepted request-body envelope.
Severity: High; the request is rejected before generation, web chat/memory flush can fail, and scheduled jobs can back off.
Frequency: At least three observed post-fix failures on 2026-05-17 in the affected workflow.
Consequence: The agent cannot continue from the affected replay history until invalid reasoning IDs are removed from outbound payloads.

Additional information

Recent fixes normalized function_call.id and function_call_output.call_id, but convertResponsesMessages() still JSON-parsed persisted reasoning signatures and replayed the reasoning item unchanged. The remaining invalid provider-visible IDs were all on reasoning input items, not tool calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.maintainerMaintainer-authored PR

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions