Skip to content

fix(coding-agent): keep fork session id aligned#4799

Merged
badlogic merged 1 commit into
earendil-works:mainfrom
Perlence:fix/fork-session-id
May 20, 2026
Merged

fix(coding-agent): keep fork session id aligned#4799
badlogic merged 1 commit into
earendil-works:mainfrom
Perlence:fix/fork-session-id

Conversation

@Perlence

@Perlence Perlence commented May 20, 2026

Copy link
Copy Markdown
Contributor

Forking a session from the first message would generate two different session IDs: one is used in the file name and the other in the JSONL header.

How to reproduce:

  1. Resume a session
  2. Run /fork
  3. Select the first message
  4. Delete the prompt
  5. Run /session

Expected result: the file and the header IDs are the same.

Actual result: the IDs are different:

File: /Users/sviatoslav/.pi/agent/sessions/--Users-sviatoslav-Workspace-pi--/2026-05-20T11-55-16-126Z_019e453d-751e-7dbd-b023-2d1b72265502.jsonl
ID: 019e453d-751e-7dbd-b023-30c799c88944

Also, the forked session does not reference the original one as its parent. The two sessions are stand-alone.

This PR aligns the IDs and fixes the parent reference:

File: /Users/sviatoslav/.pi/agent/sessions/--Users-sviatoslav-Workspace-pi--/2026-05-20T11-56-12-049Z_019e453e-4f91-7545-8524-5555ce807ae2.jsonl
ID: 019e453e-4f91-7545-8524-5555ce807ae2

The ID mismatch was problematic for me, because my session search script would get the header session ID and try to find the session file by that ID – to no avail.

@badlogic badlogic merged commit 8011e20 into earendil-works:main May 20, 2026
3 checks passed
@badlogic

Copy link
Copy Markdown
Collaborator

cheers!

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