Skip to content

fetchProgress: accept optional sessionId to scope history walk-back#12

Merged
ritchxu merged 1 commit into
mainfrom
ritchxu/resume-permission-gate
May 11, 2026
Merged

fetchProgress: accept optional sessionId to scope history walk-back#12
ritchxu merged 1 commit into
mainfrom
ritchxu/resume-permission-gate

Conversation

@ritchxu
Copy link
Copy Markdown
Contributor

@ritchxu ritchxu commented May 10, 2026

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.

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.

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>
@ritchxu ritchxu marked this pull request as ready for review May 11, 2026 15:38
Copilot AI review requested due to automatic review settings May 11, 2026 15:38
@ritchxu ritchxu requested a review from a team as a code owner May 11, 2026 15:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.fetchProgress options to accept optional sessionId.
  • Forward sessionId to the platform as ?session_id= when fetching progress.
  • Expand JSDoc for fetchProgress to document namespace, history, and sessionId behavior.
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

Comment thread src/client.ts
if (options?.history) {
url.searchParams.set("history", "true");
}
if (options?.sessionId) {
@ritchxu ritchxu merged commit 8f03acb into main May 11, 2026
10 checks passed
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.

3 participants