Skip to content

Let the switch adopt a session that is already running - #32

Merged
JarenKempton merged 1 commit into
mainfrom
switch-adopts-running-session
Nov 8, 2026
Merged

JarenKempton merged 1 commit into
mainfrom
switch-adopts-running-session

Conversation

@JarenKempton

Copy link
Copy Markdown
Owner

Starting a session from the dashboard or the Omarchy bar, then flipping the switch to that same company, used to stop the running session and start a new one. Now nothing changes, and flipping the switch back to the middle stops the session.

  • startSession: when a device start names the company that is already running, the server records the switch's session ID on that session (device_session_id) and returns it with a 200, instead of closing it and inserting a new one. A replayed start for that ID is also a no-op.
  • stopSession: looks a session up by its own ID or by its device_session_id, so the switch's stop ends the adopted session.
  • Flipping to a different company behaves as before.
  • Migration 0006_device_session_alias: nullable column plus a unique index. Run wrangler d1 migrations apply time-switch --remote before deploying.
  • Firmware 0.2.5 doesn't need to change.

Tests: new case in time-clock.test.ts. 39 of 39 pass, and tsc is clean.

🤖 Generated with Claude Code

Flipping the switch to the company that was already started from the
dashboard or the bar used to stop that session and start a new one. Now
the server keeps the running session and records the switch's session ID
on it (new nullable sessions.device_session_id), so the switch's later
stop ends it. Flipping to a different company still stops the running
session and starts the new one. No firmware change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JarenKempton
JarenKempton merged commit c882aa1 into main Nov 8, 2026
2 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.

1 participant