Skip to content

Conversation

@baxen
Copy link
Collaborator

@baxen baxen commented Dec 23, 2025

add new API endpoints for session lifecycle management:

  • POST /sessions/create: Create and initialize a new session with provider, model, recipe, and extensions in a single call
  • POST /sessions/{id}/open: Open an existing session and setup agent
  • POST /sessions/{id}/extensions: Add extensions to an active session

Consolidates both new window and load from history to use the same extension management and show the toast in both cases

Part 1 of #6251

Screen.Recording.2025-12-23.at.10.26.29.AM.mov

Copilot AI review requested due to automatic review settings December 23, 2025 18:59
@baxen
Copy link
Collaborator Author

baxen commented Dec 23, 2025

to simplify the diff on this one only adds the new endpoints and uses them in a followup pr for #6251 will cleanup unused methods

@baxen baxen requested review from DOsinga, alexhancock and zanesq and removed request for Copilot and zanesq December 23, 2025 19:00
@baxen baxen force-pushed the baxen/daemon-session-init branch from 7fab58e to 6c5a99d Compare December 23, 2025 19:01
Copilot AI review requested due to automatic review settings December 23, 2025 19:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors session initialization endpoints to provide cleaner separation of concerns and consolidate extension loading. It introduces three new REST endpoints (POST /sessions, POST /sessions/{id}/open, POST /sessions/{id}/extensions) and replaces the old startAgent/resumeAgent paradigm with createSession/openSession. The refactor also extracts extension loading logic into a shared utility that handles progressive loading with toast notifications, ensuring consistent behavior whether creating a new session or switching to an existing one.

Key changes:

  • New session lifecycle endpoints with proper separation between creating and opening sessions
  • Consolidated extension loading logic now shared between new windows and session history switching
  • Backend setup_agent_for_session helper centralizes provider/model/recipe setup for both create and open flows

Reviewed changes

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

Show a summary per file
File Description
ui/desktop/src/utils/extensionUtils.ts New shared utility for progressive extension loading with toast notifications
ui/desktop/src/hooks/useChatStream.ts Updated to use openSession endpoint; removed legacy updateFromSession call
ui/desktop/src/hooks/useAgent.ts Refactored to use createSession/openSession APIs instead of startAgent/resumeAgent
ui/desktop/src/components/BaseChat.tsx Added onSessionLoaded callback to trigger extension loading when switching sessions
ui/desktop/src/api/types.gen.ts Generated TypeScript types for new API request/response schemas
ui/desktop/src/api/sdk.gen.ts Generated SDK client functions for new endpoints
ui/desktop/openapi.json OpenAPI schema definitions for new session management endpoints
crates/goose-server/src/routes/session.rs Implemented create_session, open_session, and add_session_extension endpoints with shared setup_agent_for_session helper
crates/goose-server/src/openapi.rs Registered new endpoint handlers and request/response types in OpenAPI schema

@baxen baxen mentioned this pull request Dec 23, 2025
4 tasks
@baxen baxen force-pushed the baxen/daemon-session-init branch from d1a07c3 to e6cee25 Compare December 23, 2025 19:29
Copilot AI review requested due to automatic review settings December 23, 2025 19:29
Copy link
Contributor

Copilot AI left a comment

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 11 out of 11 changed files in this pull request and generated 1 comment.

@block block deleted a comment from Copilot AI Dec 23, 2025
add new API endpoints for session lifecycle management:
- POST /sessions/create: Create and initialize a new session with provider,
  model, recipe, and extensions in a single call
- POST /sessions/{id}/open: Open an existing session and setup agent
- POST /sessions/{id}/extensions: Add extensions to an active session

Consolidates both new window and load from history to use the same extension
management and show the toast in both cases
@baxen baxen force-pushed the baxen/daemon-session-init branch from e6cee25 to 83e2db6 Compare December 23, 2025 20:47

const MAX_NAME_LENGTH: usize = 200;

async fn setup_agent_for_session(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think if we move this to routes/agents.rs and then hook it up to agent/start and agent/resume you get the same effect, but less duplication

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes agree! it's on the next pr #6260

@michaelneale
Copy link
Collaborator

yep this looks ok to me - I like it so far. Doesn't break anything yet! over to you @DOsinga

@alexhancock
Copy link
Collaborator

this and #6260 LGTM

@DOsinga what do you think?

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.

6 participants