feat: add optional run_id to get_workflow_history - #54
Merged
GethosTheWalrus merged 4 commits intoJul 29, 2026
Merged
Conversation
Mirrors the run_id pattern already established in get_workflow_event (GethosTheWalrus#39). Allows callers to target a specific run's history when a workflow has been retried; previously only the latest run was reachable. Additive — response now always includes a run_id key (matching get_workflow_event's shape). Closes GethosTheWalrus#50. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Friendly ping — happy to iterate if any changes are wanted here. |
Security Scan ResultsUpdated for commit
This comment is updated automatically as OSV, CodeQL, and Docker Scout finish for the PR. |
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Owner
There was a problem hiding this comment.
@zaman28 Looks good overall. Two suggestions:
- Consider making the new tests self-contained by also asserting
- Consider clarifying the tool schema description to say omitted uses the latest run.
Clarify tool schema that omitted run_id targets the latest run, and extend the new tests to assert the full response shape (workflow_id, events, count) alongside run_id. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
@GethosTheWalrus Done — pushed 62941d5:
Ready for another look. |
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
run_idtoget_workflow_history, mirroring the pattern already established inget_workflow_event(Add workflow event payload tool #39).run_idkey (matchingget_workflow_event's response shape).Closes #50.
Motivation
client.get_workflow_handle(workflow_id)returns a handle bound to the latest run whenrun_idis omitted, soget_workflow_historytoday can only walk the newest run's history. For workflows with multiple runs (workflow-level retries, continue-as-new chains, resets), older runs are unreachable — even though the siblingget_workflow_eventtool already acceptsrun_idand correctly scopes to a specific run.This closes that asymmetry: same field on the same handler, same SDK plumbing, same shape.
Test plan
pytest -q— 89 pass. Two new tests underTestGetWorkflowHistory:test_get_workflow_history_passes_run_id_when_providedtest_get_workflow_history_defaults_run_id_to_noneblack --check temporal_mcp/ tests/— clean.flake8 temporal_mcp/— clean.mypy temporal_mcp/— clean.Backward-compat
Additive. Callers that don't pass
run_id:run_id=Nonepassed toclient.get_workflow_handle(...)— identical server behavior to the previous positional-only call (latest run)."run_id": nullin the response dict — matches the shapeget_workflow_eventalready returns whenrun_idis omitted.