Skip to content

fix: workflow step losing its completion tool on automatic retry - #48

Open
pmateusz wants to merge 1 commit into
masterfrom
fix/step-tools-across-auto-retry
Open

fix: workflow step losing its completion tool on automatic retry#48
pmateusz wants to merge 1 commit into
masterfrom
fix/step-tools-across-auto-retry

Conversation

@pmateusz

@pmateusz pmateusz commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

The in-session bridge resolved a turn on agent_end, which PI also fires for a failed attempt that is about to be retried automatically. The engine then condemned the step and dispose() restored the baseline tools, stripping workflow_submit_result while the retried request was still streaming, so the model could no longer submit its result.

agent_end now only records the attempt's messages; the turn resolves on agent_settled, which PI fires only after no automatic retry, compaction, or queued continuation will run. A turn settling without its own agent_end gets empty messages rather than a previous turn's conversation, preserving the cross-talk guard.

@kimchi-review

kimchi-review Bot commented Sep 4, 2026

Copy link
Copy Markdown

Kimchi Code Review

A review is being prepared and will be posted shortly.

Property Value
Commit bdbad9d
Author @pmateusz
Files changed 5
Review status Pending
What to expect

Kimchi will analyze the changes in this pull request and post:

  • A summary of the overall changes
  • Inline comments on specific lines with findings categorized by issue type

The review typically completes within a few minutes. This comment will be updated once the review is ready.

Interact with Kimchi
  • @getkimchi review — re-trigger a full review on the latest commit
  • @getkimchi summary — regenerate the PR summary
  • @getkimchi ignore — skip this PR (no review will be posted)
  • Reply to any inline comment to ask follow-up questions or request clarification
Configuration

Reviews are configured by your organization admin.
Review instructions, excluded directories, and severity thresholds can be adjusted per repository in the Kimchi dashboard.


Powered by Kimchi — AI-powered code review by CAST AI

@pmateusz
pmateusz force-pushed the fix/step-tools-across-auto-retry branch 2 times, most recently from 8f3df9e to 2eb2d23 Compare September 4, 2026 15:48
PI fires agent_end when an agent loop ends, including a failed attempt
that an automatic retry is about to continue. The in-session bridge
resolved the turn there, so a retryable transport failure condemned the
step: the engine tore the session down and dispose() restored the
baseline tool set, stripping workflow_submit_result while the retried
request was still streaming and leaving the model no way to submit.

agent_end now only records the attempt's messages, stamped with the
in-flight turn's token; the turn resolves on agent_settled, which PI
fires only after no automatic retry, compaction, or queued continuation
will run. A turn whose run settles without its own agent_end resolves
with empty messages rather than a previous turn's conversation,
preserving the cross-talk guard. Add a regression test scripting the
failed attempt, the retry, and the settle, and extend the existing PI
fakes to emit agent_settled in the real lifecycle order.

Co-Authored-By: Kimchi <noreply@kimchi.dev>
@pmateusz
pmateusz force-pushed the fix/step-tools-across-auto-retry branch from 2eb2d23 to 4eed2a6 Compare September 4, 2026 15:52
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