Skip to content

Fix session reconnect and Gemini startup regressions#93

Merged
frankekn merged 3 commits intomainfrom
task/session-runtime-client-fixes
Mar 10, 2026
Merged

Fix session reconnect and Gemini startup regressions#93
frankekn merged 3 commits intomainfrom
task/session-runtime-client-fixes

Conversation

@Takhoffman
Copy link
Copy Markdown
Contributor

@Takhoffman Takhoffman commented Mar 10, 2026

Summary

Fix three runtime correctness regressions in the acpx session/runtime path:

  • keep persistent sessions resumable after routine queue-owner shutdown
  • apply Gemini ACP startup timeout handling to Windows-style executables like gemini.cmd
  • fail loudly when desired mode replay cannot be restored on fresh-session fallback, without persisting the wrong fresh session id

Why the session auto-close block was removed

The removed block in runSessionQueueOwner() treated lastAgentExitAt as proof that the saved session should be permanently closed when the queue owner shut down.

That was too broad:

  • lastAgentExitAt is also set on normal successful prompt runs where the agent exits cleanly
  • the queue owner can then stop later for a routine reason such as idle TTL expiry
  • marking the record closed=true on that path makes the next directory-walk lookup skip the saved session entirely
  • the user then gets a fresh conversation instead of resuming the prior persistent session

In other words, the old logic conflated agent exited sometime earlier with this session is permanently closed.

Removing that block restores the intended behavior:

  • routine queue-owner shutdown does not close persistent sessions
  • explicit close paths still mark sessions closed
  • persistent sessions remain resumable after normal idle shutdown

Changes

  • remove queue-owner idle-shutdown auto-close for persistent sessions
  • normalize executable suffixes in Gemini command detection
  • defer committing fresh ACP session identity until desired-mode replay succeeds
  • surface SESSION_MODE_REPLAY_FAILED on replay failure
  • add helper, integration, and CLI persistence-path regression coverage

Verification

  • pnpm run build:test
  • pnpm run typecheck
  • node --test --test-name-pattern='set-mode load fallback failure does not persist|desired mode replay cannot be restored|gemini ACP startup timeout|session remains resumable|reuses an already loaded client session' dist-test/test/cli.test.js dist-test/test/connect-load.test.js dist-test/test/integration.test.js

@Takhoffman Takhoffman force-pushed the task/session-runtime-client-fixes branch from ab9f37d to 7ac8a95 Compare March 10, 2026 03:26
@Takhoffman Takhoffman force-pushed the task/session-runtime-client-fixes branch from 4638790 to 926d5e3 Compare March 10, 2026 03:34
@frankekn frankekn merged commit 69d518e into main Mar 10, 2026
7 checks passed
@frankekn frankekn deleted the task/session-runtime-client-fixes branch March 10, 2026 03:45
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