Skip to content

fix(runtime): advance run attempt before resumed tool calls#177

Merged
raphael merged 1 commit into
mainfrom
fix/resume-attempt-tool-call-ids
Jul 8, 2026
Merged

fix(runtime): advance run attempt before resumed tool calls#177
raphael merged 1 commit into
mainfrom
fix/resume-attempt-tool-call-ids

Conversation

@raphael

@raphael raphael commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Advance the workflow run context attempt when constructing a resume request so resumed tool execution uses the planner turn attempt that produced the calls.
  • Add workflow regression coverage for provider-empty runtime-generated tool-call IDs across resume attempts and within a single batch.

Root cause

buildNextResumeRequest stamped the next attempt only on the PlanActivityInput sent to the resume activity. The workflow loop kept executing the resumed planner result with the stale base.RunContext.Attempt, so runtime-generated tool-call IDs for provider-empty calls could repeat across resume iterations.

Fix

The resume request builder now updates base.RunContext.Attempt in lockstep with the resume activity input after the request is validated, leaving one workflow-owned source of truth for the current planner attempt. The duplicate tool-output ref invariant remains unchanged.

Test evidence

  • make lint -> 0 issues.
  • go test ./runtime/agent/runtime/... -> ok goa.design/goa-ai/runtime/agent/runtime, ok goa.design/goa-ai/runtime/agent/runtime/hints.

Copilot AI review requested due to automatic review settings July 8, 2026 01:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes workflow resume bookkeeping so the workflow-owned RunContext.Attempt advances in lockstep with the resume activity input, preventing collisions in runtime-generated tool-call IDs across resume iterations (especially for provider-empty tool-call IDs).

Changes:

  • Update buildNextResumeRequest to advance base.RunContext.Attempt only after the resume request is validated and budget-checked, and then increment nextAttempt.
  • Add regression tests covering provider-empty runtime-generated tool-call IDs across resume attempts and within a single tool-call batch.
  • Update documentation comment to reflect that the workflow stamps the attempt before executing tool calls for that planner attempt.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
runtime/agent/runtime/workflow_helpers.go Advances the workflow-owned attempt state alongside the resume request to keep tool-call ID generation unique across resumes.
runtime/agent/runtime/workflow_bookkeeping_contract_test.go Adds regression coverage for deterministic runtime tool-call IDs across resume attempts and within-batch indexing.
runtime/agent/runtime/helpers.go Updates the generateDeterministicToolCallID comment to match the new attempt-stamping behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@raphael raphael merged commit 26868d1 into main Jul 8, 2026
3 checks passed
@raphael raphael deleted the fix/resume-attempt-tool-call-ids branch July 8, 2026 02:07
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.

2 participants