fetchProgress: accept optional sessionId to scope history walk-back#12
Merged
Conversation
Adds an optional `sessionId` field to PlatformClient.fetchProgress's options. When set together with `history: true`, the field is forwarded to the platform as `?session_id=` and instructs the server to scope its previous-job walk-back to records matching that session id rather than returning the most-recent previous job only. Used by resume-after-permission-timeout flows where the resumed job's target session may not be the most recent in the assignment — an unrelated sibling job (e.g. an integrator follow-up that landed between the original session pausing and the user clicking 'Allow') would otherwise shadow the target session's progress snapshot, and the resumed runtime would silently degrade to a fresh session instead of restoring conversation state. The field is purely additive; existing callers that do not pass it get identical behavior to before. Server-side support already ships in sweagentd's `/jobs/:jobID/progress?session_id=` query parameter. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for scoping PlatformClient.fetchProgress history walk-back to a specific session, enabling resume flows to retrieve the correct prior progress snapshot when the target session is not from the most recent sibling job in the same assignment.
Changes:
- Extend
PlatformClient.fetchProgressoptions to accept optionalsessionId. - Forward
sessionIdto the platform as?session_id=when fetching progress. - Expand JSDoc for
fetchProgressto documentnamespace,history, andsessionIdbehavior.
Show a summary per file
| File | Description |
|---|---|
| src/client.ts | Adds sessionId option to fetchProgress, forwards it as session_id, and documents the new behavior. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
| if (options?.history) { | ||
| url.searchParams.set("history", "true"); | ||
| } | ||
| if (options?.sessionId) { |
josebalius
approved these changes
May 11, 2026
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.
Adds an optional
sessionIdfield toPlatformClient.fetchProgress's options. When set together withhistory: true, the field is forwarded to the platform as?session_id=and instructs the server to scope its previous-job walk-back to records matching that session id rather than returning the most-recent previous job only.Why
Used by the Copilot cloud agent in an upcoming feature, when a session pauses on a permission prompt and the eventually times out, the user can later come back to resume. The resumed job's target session may not be the most recent in its assignment — an unrelated sibling job would otherwise shadow the target session's snapshot. The default newest-job-only walk-back returns the wrong session, and the resumed run silently degrades to a fresh session instead of restoring correct state.