fix(runtime): advance run attempt before resumed tool calls#177
Merged
Conversation
There was a problem hiding this comment.
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
buildNextResumeRequestto advancebase.RunContext.Attemptonly after the resume request is validated and budget-checked, and then incrementnextAttempt. - 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause
buildNextResumeRequeststamped the next attempt only on thePlanActivityInputsent to the resume activity. The workflow loop kept executing the resumed planner result with the stalebase.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.Attemptin 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.