Skip to content

fix: send the system prompt when resuming a session - #5

Merged
Balanov merged 1 commit into
Balanov:mainfrom
tridev-tej:fix-issue-4
Nov 15, 2026
Merged

Balanov merged 1 commit into
Balanov:mainfrom
tridev-tej:fix-issue-4

Conversation

@tridev-tej

Copy link
Copy Markdown
Contributor

runPrompt replaced the fresh system message with the stored transcript on --resume, but the jsonl never holds a system message, so a resumed run sent none. now the system prompt is always built fresh and placed before the stored messages. a stored leading system message is replaced, not duplicated. the session file is not rewritten. added a cli test that resumes a session and checks what the provider receives.

Fixes #4

the stored transcript never holds a system message, so a resumed run sent none. build it fresh and put it in front of the stored messages; the session file is untouched.

@Balanov Balanov left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you for this, and for testing against what the provider actually receives rather than against the transcript on disk. That is the only way to catch this bug: the stored session never had a system message in the first place, so the file looks fine.

Your fix is the minimal one. The system prompt is built fresh on every run and the stored messages are appended after it, and a stored leading system message is dropped rather than duplicated. The session file is not rewritten, which matters here: the transcript stays an append-only record, and your test asserts the file is not rewritten rather than only checking the message list.

Merging this. It ships in the next release.

@Balanov
Balanov merged commit 9870928 into Balanov:main Nov 15, 2026
3 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.

Restore the system prompt when a session is resumed

2 participants