feat(relay): hand off new sessions across messengers - #84
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
newSessionroute-action outcomes and wires/newthrough 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
/newand 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/newroute action across Telegram, Discord, Slack, and broker routing/newbehavior and complete theremote-new-session-handoffOpenSpec tasksValidation
npm run typechecknpm test(769 passed, 2 skipped)openspec validate remote-new-session-handoff --strictgit diff --check