Skip to content

feat(relay): hand off new sessions across messengers - #84

Merged
zikolach merged 2 commits into
mainfrom
feature/remote-new-session-handoff
Jul 16, 2026
Merged

feat(relay): hand off new sessions across messengers#84
zikolach merged 2 commits into
mainfrom
feature/remote-new-session-handoff

Conversation

@zikolach

Copy link
Copy Markdown
Owner

Summary

  • add a typed, command-context-safe remote /new route action across Telegram, Discord, Slack, and broker routing
  • migrate eligible bindings and active selections to strict same-runtime, same-machine, same-workspace replacement sessions
  • delay offline lifecycle delivery during the bounded handoff window, then report moved or normal offline outcomes safely
  • mark old bindings moved/stale and preserve authorization and binding-authority checks
  • document /new behavior and complete the remote-new-session-handoff OpenSpec tasks

Validation

  • npm run typecheck
  • npm test (769 passed, 2 skipped)
  • openspec validate remote-new-session-handoff --strict
  • git diff --check

Copilot AI review requested due to automatic review settings July 14, 2026 17:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds a command-context-safe remote /new action to start replacement Pi sessions across Telegram, Discord, Slack, and the broker, and implements strict same-runtime/machine/workspace handoff with binding/selection migration and lifecycle notification handling.

Changes:

  • Introduces typed newSession route-action outcomes and wires /new through Telegram/Discord/Slack/broker request flows.
  • Implements pending session handoff state + binding/active-selection migration, including “moved” lifecycle notifications and stale old bindings.
  • Updates docs/OpenSpec tasks and adds extensive unit/integration coverage for /new and handoff scenarios.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/state-store.test.ts Adds state-store coverage for binding/selection migration and fail-closed cases.
tests/slack-runtime.test.ts Verifies Slack /new command handling and unsupported fallback.
tests/runtime.test.ts Adds Telegram in-process /new routing/outcome tests.
tests/relay/session-handoff.test.ts Adds unit tests for pending handoff matching + expiry behavior.
tests/relay/route-actions.test.ts Adds unit tests for typed newSessionRouteSafely outcomes.
tests/relay/binding-authority.test.ts Covers moved/stale classification via movedToSessionKey.
tests/integration.test.ts Adds integration coverage for command-context capture, handoff lifecycle suppression/expiry, ambiguity fail-closed, broker newSession request.
tests/discord-runtime.test.ts Adds Discord relay new parity tests and unsupported fallback.
skills/relay/SKILL.md Documents /new behavior and constraints.
openspec/changes/remote-new-session-handoff/tasks.md Marks OpenSpec tasks completed.
extensions/relay/state/tunnel-store.ts Implements migrateSessionBindings and treats “moved” lifecycle as online.
extensions/relay/runtime/extension-runtime.ts Captures command-capable context, registers pending handoffs, migrates bindings on replacement startup, delays offline notifications.
extensions/relay/notifications/lifecycle.ts Adds moved lifecycle kind, formatting, and notification decisioning.
extensions/relay/core/types.ts Adds moved-binding metadata + newSession action types.
extensions/relay/core/session-handoff.ts Adds in-memory pending handoff model, matching, registration, expiry pruning.
extensions/relay/core/route-actions.ts Adds typed newSessionRouteSafely + message helper.
extensions/relay/core/index.ts Re-exports session-handoff helpers.
extensions/relay/core/binding-authority.ts Treats movedToSessionKey as authoritative “moved” classification.
extensions/relay/commands/remote.ts Adds canonical /new to remote command list.
extensions/relay/broker/tunnel-runtime.ts Adds broker action handler for newSession returning typed outcomes.
extensions/relay/broker/process.js Adds Telegram broker-side /new command support.
extensions/relay/adapters/telegram/runtime.ts Adds Telegram in-process /new command support via typed outcomes.
extensions/relay/adapters/slack/runtime.ts Adds Slack new command support via typed outcomes.
extensions/relay/adapters/discord/runtime.ts Adds Discord new command support via typed outcomes + command list update.
docs/testing.md Adds smoke-test steps for local/remote /new and handoff behavior.
docs/adapters.md Documents remote /new parity/constraints.
README.md Documents remote /new and adds it to command parity table.

Comment thread extensions/relay/core/session-handoff.ts
Comment thread extensions/relay/core/session-handoff.ts
Comment thread extensions/relay/runtime/extension-runtime.ts
Comment thread extensions/relay/state/tunnel-store.ts
Comment thread extensions/relay/state/tunnel-store.ts
Comment thread extensions/relay/state/tunnel-store.ts
Comment thread tests/integration.test.ts Outdated
Comment thread extensions/relay/broker/process.js
Copilot AI review requested due to automatic review settings July 16, 2026 07:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated no new comments.

@zikolach
zikolach merged commit 53b4d21 into main Jul 16, 2026
3 checks passed
@zikolach
zikolach deleted the feature/remote-new-session-handoff branch July 16, 2026 15:42
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