-
Notifications
You must be signed in to change notification settings - Fork 2.3k
chore: consolidate endpoints into sessions api #6260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: baxen/daemon-session-init
Are you sure you want to change the base?
Conversation
- 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}
There was a problem hiding this 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.rsandaction_required.rsroute modules entirely - Migrates all endpoints to session-scoped routes with consistent REST patterns
- Introduces idempotent recipe state reconciliation via
reset_recipe_stateandreconcile_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 callsbuild_recipe_with_parameter_valuesagain (line 508) with the same inputs. This is redundant and wastes computation. Additionally,reconcile_recipe_statealready handles the case where parameters are missing, so the error handling here is unnecessary.
NOTE: this PR is targeting the other branch with session state that we should merge to main first and retarget this
New session endpoints:
part 2 of #6251