Pre-submit Checks
Describe the bug
In BYOP Agent Mode, approving a pending asynchronous terminal tool action can immediately make the conversation unusable.
The tool call is received and queued normally. After the user approves it, Zap logs ExecutedAsync. Within the same second, the matching tool result is observed, but the controller cannot find the corresponding tool call in the current task context and classifies it as OrphanToolResult.
The UI then shows the generic corrupted-history error and blocks all further requests in that conversation:
Can't continue this conversation: an earlier tool result is missing or corrupted in this conversation's history, so Zap can't safely send the request to your provider.
This reproduced multiple times, including in a newly created conversation. Starting another conversation only works until another affected async action completes.
The observed direction is different from #147 and #222: those involve a tool call whose result is missing after interruption. Here, a real tool result arrives, but its matching tool call is not visible in the request/task snapshot at controller preflight time.
To reproduce
- Configure a BYOP OpenAI-compatible provider.
- Open Agent Mode in a terminal with an active long-running/SSH shell command.
- Ask the agent to perform a terminal operation that uses
write_to_long_running_shell_command and requires confirmation.
- Approve the pending action.
- The action is dispatched as
Async.
- Observe that Zap immediately reports corrupted conversation history.
- Retry, resume the conversation, or send another message. The controller continues blocking requests with
category=OrphanToolResult.
This was reproduced repeatedly on July 28, 2026. A new conversation reproduced the same failure.
Expected behavior
The assistant ToolCall must be committed to the task/conversation snapshot before an asynchronously completed ToolCallResult can trigger an automatic continuation or controller preflight.
After approval, Zap should execute the action, append the result to the matching call, and continue the agent loop. A valid fast tool result must not be treated as corrupted history.
Screenshots, videos, and logs
Sanitized log sequence from a single action:
2026-07-28T02:50:16Z [INFO] [byop] tool_call_in: name=write_to_long_running_shell_command call_id=call_<redacted>
2026-07-28T02:50:16Z [INFO] [byop-diag] queue_actions: count=1 ids=[call_<redacted>]
2026-07-28T02:50:16Z [INFO] [byop-diag] try_to_execute_action: NotExecuted ... reason=NeedsConfirmation
2026-07-28T02:50:21Z [INFO] [byop-diag] executor: dispatched ... execution variant: Async
2026-07-28T02:50:21Z [INFO] [byop-diag] try_to_execute_action: ExecutedAsync ...
2026-07-28T02:50:21Z [WARN] Found tool call result with ID 'call_<redacted>' but no corresponding tool call in task context. Server conversation ID: ''
2026-07-28T02:50:21Z [ERROR] [byop-readiness] diagnostic category=OrphanToolResult assistant_tool_call_message_id=unknown tool_call_id=call_<redacted> trigger_layer=controller_preflight iteration=0
2026-07-28T02:50:21Z [ERROR] [byop-readiness] controller blocked request category=OrphanToolResult trigger_layer=controller_preflight iteration=0
The same sequence occurred again about one minute later with another call ID. The full local log contains private terminal commands and host details, so only the relevant sanitized sequence is included here.
Provider request log:
[byop] build_client: api_type=OpenAi endpoint_url=http://127.0.0.1:<port>/v1/
[byop-diag] request summary: adapter=OpenAI model=gpt-5.5 ... tools=17
Operating system (OS)
macOS
Operating system and version
macOS 26.5.2 (Build 25F84)
Shell version
zsh 5.9 (arm64-apple-darwin25.0)
Zap version / commit
v2026.07.09.1 (build 20260709.034931; source tag commit 5d874456a51cb7c412cfac7c21250f08ba5017f9)
AI / BYOP path involved?
Yes — BYOP / model / prompt template / agent path
BYOP provider (if applicable)
OpenAI-compatible local proxy (http://127.0.0.1:<port>/v1/), model gpt-5.5
Regression
Unknown.
Last known good build / date (if regression)
Unknown.
Additional context
Possibly related, but not duplicate:
The timing above suggests a separate ordering race: after an approved action returns quickly, its ToolCallResult can participate in automatic continuation before the assistant ToolCall has become visible in the task snapshot used by controller preflight.
The generic UI message is also misleading for this category: the history may not be persistently corrupted; the controller may be observing an incomplete in-memory snapshot during the async continuation.
Does this block your daily use of Zap?
Yes — this prevents me from using Zap daily.
Reproducible only in Zap?
Only in Zap.
Pre-submit Checks
RUST_LOG=infooutput, panic traces, etc.). Optional, but greatly speeds up triage.Describe the bug
In BYOP Agent Mode, approving a pending asynchronous terminal tool action can immediately make the conversation unusable.
The tool call is received and queued normally. After the user approves it, Zap logs
ExecutedAsync. Within the same second, the matching tool result is observed, but the controller cannot find the corresponding tool call in the current task context and classifies it asOrphanToolResult.The UI then shows the generic corrupted-history error and blocks all further requests in that conversation:
This reproduced multiple times, including in a newly created conversation. Starting another conversation only works until another affected async action completes.
The observed direction is different from #147 and #222: those involve a tool call whose result is missing after interruption. Here, a real tool result arrives, but its matching tool call is not visible in the request/task snapshot at controller preflight time.
To reproduce
write_to_long_running_shell_commandand requires confirmation.Async.category=OrphanToolResult.This was reproduced repeatedly on July 28, 2026. A new conversation reproduced the same failure.
Expected behavior
The assistant
ToolCallmust be committed to the task/conversation snapshot before an asynchronously completedToolCallResultcan trigger an automatic continuation or controller preflight.After approval, Zap should execute the action, append the result to the matching call, and continue the agent loop. A valid fast tool result must not be treated as corrupted history.
Screenshots, videos, and logs
Sanitized log sequence from a single action:
The same sequence occurred again about one minute later with another call ID. The full local log contains private terminal commands and host details, so only the relevant sanitized sequence is included here.
Provider request log:
Operating system (OS)
macOS
Operating system and version
macOS 26.5.2 (Build 25F84)
Shell version
zsh 5.9 (arm64-apple-darwin25.0)
Zap version / commit
v2026.07.09.1 (build 20260709.034931; source tag commit
5d874456a51cb7c412cfac7c21250f08ba5017f9)AI / BYOP path involved?
Yes — BYOP / model / prompt template / agent path
BYOP provider (if applicable)
OpenAI-compatible local proxy (
http://127.0.0.1:<port>/v1/), modelgpt-5.5Regression
Unknown.
Last known good build / date (if regression)
Unknown.
Additional context
Possibly related, but not duplicate:
The timing above suggests a separate ordering race: after an approved action returns quickly, its
ToolCallResultcan participate in automatic continuation before the assistantToolCallhas become visible in the task snapshot used by controller preflight.The generic UI message is also misleading for this category: the history may not be persistently corrupted; the controller may be observing an incomplete in-memory snapshot during the async continuation.
Does this block your daily use of Zap?
Yes — this prevents me from using Zap daily.
Reproducible only in Zap?
Only in Zap.