Skip to content

Conversation

@baxen
Copy link
Collaborator

@baxen baxen commented Dec 23, 2025

NOTE: this PR is targeting the other branch with session state that we should merge to main first and retarget this

  • Remove /agent/* endpoints (agent.rs deleted)
  • Remove /action-required/* endpoints (action_required.rs deleted)
  • Move all functionality to /sessions/{id}/* namespace
  • Rename session.rs to sessions.rs for consistency with route prefix

New session endpoints:

  • POST /sessions/{id}/messages/{timestamp}/fork
  • POST /sessions/{id}/messages/{timestamp}/edit
  • PUT /sessions/{id}/recipe (renamed from user_recipe_values)
  • GET /sessions/{id}/tools
  • POST /sessions/{id}/tools/{name}/call
  • POST /sessions/{id}/resources/read
  • POST /sessions/{id}/confirmations
  • DELETE /sessions/{id}/extensions/{name}

part 2 of #6251

- Remove /agent/* endpoints (agent.rs deleted)
- Remove /action-required/* endpoints (action_required.rs deleted)
- Move all functionality to /sessions/{id}/* namespace
- Rename session.rs to sessions.rs for consistency with route prefix

New session endpoints:
- POST /sessions/{id}/messages/{timestamp}/fork
- POST /sessions/{id}/messages/{timestamp}/edit
- PUT /sessions/{id}/recipe (renamed from user_recipe_values)
- GET /sessions/{id}/tools
- POST /sessions/{id}/tools/{name}/call
- POST /sessions/{id}/resources/read
- POST /sessions/{id}/confirmations
- DELETE /sessions/{id}/extensions/{name}
Copilot AI review requested due to automatic review settings December 23, 2025 23:36
@baxen baxen mentioned this pull request Dec 23, 2025
4 tasks
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 consolidates the API endpoints from the legacy /agent/* and /action-required/* namespaces into a unified /sessions/{id}/* namespace, making sessions the primary client-facing concept while treating agent state as an implementation detail. The change also renames session.rs to sessions.rs and introduces a new reconcile_recipe_state function for idempotent recipe management.

Key changes:

  • Removes agent.rs and action_required.rs route modules entirely
  • Migrates all endpoints to session-scoped routes with consistent REST patterns
  • Introduces idempotent recipe state reconciliation via reset_recipe_state and reconcile_recipe_state

Reviewed changes

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

Show a summary per file
File Description
ui/desktop/src/utils/providerUtils.ts Removes unused initializeSystem function and related imports, keeping only substituteParameters
ui/desktop/src/hooks/useRecipeManager.ts Updates to use updateSessionRecipe API with renamed values field
ui/desktop/src/hooks/useChatStream.ts Splits editMessage into forkMessage and editMessageInPlace with proper path parameters
ui/desktop/src/components/settings/permission/PermissionModal.tsx Updates to use getSessionTools with session_id in path instead of query
ui/desktop/src/components/settings/extensions/agent-api.ts Updates to use session-scoped extension endpoints (addSessionExtension, removeSessionExtension)
ui/desktop/src/components/recipes/RecipesView.tsx Renames startAgent to createSession for clarity
ui/desktop/src/components/alerts/useToolCount.ts Updates to use getSessionTools with session_id in path
ui/desktop/src/components/ToolCallConfirmation.tsx Updates confirmToolAction to use session_id in path parameter
ui/desktop/src/components/OllamaSetup.test.tsx Adds explanatory comment for skipped tests due to removed initializeSystem
ui/desktop/src/components/ModelAndProviderContext.tsx Changes to use openSession instead of updateAgentProvider
ui/desktop/src/api/types.gen.ts Removes old agent/action-required types, adds new session-scoped types with proper path parameters
ui/desktop/src/api/sdk.gen.ts Removes old agent/action-required functions, adds new session-scoped client functions
ui/desktop/src/App.test.tsx Updates mock to only include substituteParameters
ui/desktop/openapi.json Consolidates API spec from /agent/* and /action-required/* to /sessions/{session_id}/*
crates/goose/src/agents/prompt_manager.rs Adds clear_system_prompt_extras method for recipe state cleanup
crates/goose/src/agents/agent.rs Adds reset_recipe_state for clearing sub_recipes, final_output_tool, and system_prompt_extras
crates/goose-server/src/routes/sessions.rs Consolidates all endpoints into sessions namespace with new recipe reconciliation logic
crates/goose-server/src/routes/recipe_utils.rs Adds reconcile_recipe_state for idempotent recipe application
crates/goose-server/src/routes/mod.rs Removes agent and action_required modules, renames session to sessions
crates/goose-server/src/routes/agent.rs Deleted file - functionality moved to sessions.rs
crates/goose-server/src/routes/action_required.rs Deleted file - functionality moved to sessions.rs
crates/goose-server/src/openapi.rs Updates OpenAPI documentation to reference session routes instead of agent routes
Comments suppressed due to low confidence (1)

crates/goose-server/src/routes/sessions.rs:520

  • The recipe update logic appears duplicated and potentially incorrect. After calling reconcile_recipe_state (line 505), which already builds and applies the recipe with parameter values, the code then calls build_recipe_with_parameter_values again (line 508) with the same inputs. This is redundant and wastes computation. Additionally, reconcile_recipe_state already handles the case where parameters are missing, so the error handling here is unnecessary.

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.

3 participants