Skip to content

fix(pi): flush session before reporting resumable path - #3

Closed
fwhskr wants to merge 1 commit into
cloudmanic:masterfrom
fwhskr:fix/pi-flush-session-before-report
Closed

fwhskr wants to merge 1 commit into
cloudmanic:masterfrom
fwhskr:fix/pi-flush-session-before-report

Conversation

@fwhskr

@fwhskr fwhskr commented Jul 29, 2026

Copy link
Copy Markdown

Why

Pi intentionally defers creating a new session JSONL until the first assistant response. The Herdr integration currently reports sessionManager.getSessionFile() during session_start, so an idle agent can advertise a path that does not exist yet. If Herdr restores before any response, pi --session <path> creates a fresh session and loses the initial/last-used model and thinking level.

What

  • Call optional sessionManager.flush() before capturing/reporting the session reference.
  • Keep backward compatibility with older Pi versions through optional chaining.
  • Treat persistence as best-effort so a failed/unsupported flush never breaks Pi startup or Herdr state reporting.
  • Bump the Pi integration version to 3 and assert the embedded asset contains the flush hook.

Dependency

Uses the opt-in API proposed in earendil-works/pi#7275. Until that lands, older Pi versions simply no-op.

Validation

  • cargo fmt --check
  • focused static assertions: integration version, optional flush call, flush-before-session-ref ordering
  • Rust test build was not run locally because Herdr's vendored Ghostty VT build requires Zig; upstream CI should exercise the integration test.

@fwhskr

fwhskr commented Jul 29, 2026

Copy link
Copy Markdown
Author

I missed the first-time contributor gate before opening this PR. I am closing it now and will follow the required bug-report template + /approve @fwhskr flow. The branch and focused fix remain available; this PR can be reopened unchanged after approval.

@fwhskr fwhskr closed this Jul 29, 2026
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.

1 participant