Skip to content

Sync externally created Agent sessions into Desktop - #478

Merged
tallcode merged 5 commits into
mainfrom
claude/session-created-event
Sep 3, 2026
Merged

tallcode merged 5 commits into
mainfrom
claude/session-created-event

Conversation

@tallcode

@tallcode tallcode commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • publish global session_created notifications after create/fork responses, carrying a stable creatorId without letting broadcast failures affect the lifecycle command
  • give Desktop a shared, persisted device identity and reconcile externally created Agent sessions immediately while avoiding re-import of sessions created by the same installation
  • enforce one-to-one agent_session_id bindings in SQLite, reuse one concurrency-safe get-or-create import path, and replace the 1-second streaming poll with event-driven reconciliation plus a 60-second recovery pass
  • keep the existing broadcaster and publisher entry points as deprecated compatibility aliases; TUI behavior is unchanged

Validation

  • make generate-proto
  • cargo fmt --all -- --check
  • cargo fmt --check --manifest-path desktop/src-tauri/Cargo.toml
  • cargo clippy -p future-agent --all-targets -- -D warnings
  • cargo clippy --all-targets --manifest-path desktop/src-tauri/Cargo.toml -- -D warnings
  • npm --prefix desktop run lint
  • git diff --check origin/main...HEAD

Full test suites were not rerun after merging the latest main; GitHub Actions owns final test execution.

tallcode and others added 4 commits September 3, 2026 11:12
…fresh

Sessions created by other clients (TUI/CLI/channels) reached the desktop
only via polling, and an imported thread stub never refreshed the sidebar
until a user action happened to call refreshStore.

Agent: publish a session_created control-plane event {sessionId,
createdBy, cwd} from AppState::create_session (new_session/fork/clone,
never disk hydration) on the renamed global events broadcaster; fork and
clone propagate the forking client's created_by so desktop-owned forks
announce themselves accurately.

Desktop: a session_events observer subscribes to the global stream and
imports announced external sessions within milliseconds (createdBy
desktop is skipped — the GUI manages its own thread rows); a new
threads-updated Tauri event makes AppShell refreshStore so the sidebar
shows imported threads immediately. import_missing_sessions emits the
same signal; the 1s/60s discovery polls remain as the backstop, and
import_discovered_session now honors deletion tombstones.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@tallcode
tallcode enabled auto-merge (squash) September 3, 2026 06:32
@tallcode
tallcode merged commit 3eb00dc into main Sep 3, 2026
12 checks passed
@tallcode
tallcode deleted the claude/session-created-event branch September 3, 2026 06:47
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