Skip to content

refactor: goose 2 ui used acp session id - #8985

Merged
lifeizhou-ap merged 18 commits into
mainfrom
lifei/ui-acp-same-session
May 5, 2026
Merged

lifeizhou-ap merged 18 commits into
mainfrom
lifei/ui-acp-same-session

Conversation

@lifeizhou-ap

@lifeizhou-ap lifeizhou-ap commented May 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Simplify goose2 ACP session handling so the UI uses the ACP session id as the single canonical session id.

Previously the UI carried its own session id and relied on a tracker to map that id to the real ACP session id, including persona-specific lookup keys. That made session creation, replay, notification routing, cancellation, and tests harder to reason about.
This change removes that indirection. New sessions now use the sessionId returned by ACP directly, and existing sessions are prepared/loaded by that same id.

Behavior Change

The only intended behavior change is that prepareSession() no longer silently creates a replacement ACP session when the provided session id cannot be loaded.

Existing flows should create sessions through acpCreateSession() first, then prepare/load that ACP session id. If the UI has a stale or corrupt session id, it will now fail instead of being replaced behind the UI’s back.

Other session behaviors are intended to stay the same; this refactor only removes the extra UI-to-ACP id indirection.

Testing

Unit tests and manual testing

@lifeizhou-ap
lifeizhou-ap enabled auto-merge May 4, 2026 14:07
@lifeizhou-ap
lifeizhou-ap added this pull request to the merge queue May 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks May 4, 2026
* main:
  align extensions page styling (#9003)
  fix: SACP notifies clients of generated session names (#8983)
  replace artifact heuristics/regexes with protocol messages (#8996)
  fold UI refactor review into code review skill (#8982)
  Improvements to LM Studio declarative provider (#8973)
  chore(deps): bump dawidd6/action-download-artifact from 12 to 21 (#8959)
  chore(deps): bump azure/login from 2.3.0 to 3.0.0 (#8957)
  chore(deps): bump actions/github-script from 8.0.0 to 9.0.0 (#8956)
  chore(deps): bump dependabot/fetch-metadata from 2.3.0 to 3.1.0 (#8955)
  Fix CRT linkage in Windows CUDA build (#8987)

# Conflicts:
#	ui/goose2/src/features/chat/stores/chatSessionStore.ts
#	ui/goose2/src/shared/api/acpNotificationHandler.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7be66f746b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 333 to 335
const response = (await client.extMethod("_goose/tool/call", {
sessionId: acpSessionId,
sessionId: payload.sessionId,
name: `${payload.tool.extensionName}__${name}`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve legacy MCP payload session fallback

McpAppView now always sends payload.sessionId to _goose/tool/call and GooseResourceRead, but older stored MCP-app message payloads can carry a UI/local session id in sessionId and the ACP id in gooseSessionId (the fallback that was just removed). In that upgrade scenario, MCP app actions from historical conversations will call the backend with a non-existent session id and fail at runtime. Keep a backward-compatible fallback (payload.gooseSessionId ?? payload.sessionId) or add a migration when hydrating old message payloads.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don’t think we should keep the fallback here because after this refactor payload.sessionId is the ACP session id, and replayed MCP app payloads are rebuilt from ACP notifications with that id.

@lifeizhou-ap
lifeizhou-ap added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit de471bc May 5, 2026
27 checks passed
@lifeizhou-ap
lifeizhou-ap deleted the lifei/ui-acp-same-session branch May 5, 2026 02:54
tellaho added a commit that referenced this pull request May 5, 2026
Resolves conflicts from PR #8985 (refactor: goose 2 ui used acp session
id, de471bc), which collapses the local/goose dual-session-id model
into a single canonical ACP sessionId.

- ui/goose2/src/shared/api/acpNotificationHandler.ts: drop
  acpSessionTracker imports in favor of handleSessionInfoUpdate from
  acpSessionInfoUpdate; keep our getToolChainSummary import; preserve
  our findLiveMessageIdWithToolCall(...) ?? ensureLiveAssistantMessage
  fallback in tool_call_update while dropping the now-removed
  gooseSessionId arg.
- ui/goose2/src/shared/api/acpNotificationHandler.test.ts: take main's
  reduced content (just the renamed "applies usage updates to the ACP
  session id" test). Our chain-summary tests moved to the consolidated
  __tests__/ file.
- ui/goose2/src/shared/api/__tests__/acpNotificationHandler.test.ts:
  migrate the auto-merged P1 regression test from registerSession(...)
  to registerPreparedSession("acp-session", ...) and unify session ids;
  move the three chain-summary tests (live x2, replay x1) from the
  legacy file with the same migration; switch the replay assertion to
  getReplayBuffer(...) since replay messages live in the replay buffer
  rather than messagesBySession.

Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
DOsinga pushed a commit that referenced this pull request May 6, 2026
Pulls 40 new commits from main, including:
- #8945 remove artifacts dir handling (lines up with our /artifacts cwd fix)
- #9000 replace raw config and secret methods
- #9008 remove skill categories
- #9019 fix small-window chat & settings layouts
- #9023 ACP child reap fix
- #8911 goose2 distribution bundling
- #8983 SACP session-name notifications
- #8985 use ACP session id in goose2 UI
- #8995 group consecutive tool calls into chain card
- #8996 protocol artifact messages (replace heuristics/regexes)
- #8999 elicitation fixes
- #9000 plus follow-ups for config/secret ACP methods
- many smaller changes across CI workflows, AGENTS docs, deps

Conflicts resolved:
- src-tauri/src/commands/projects.rs: kept our delete (we moved
  projects to ACP); main had unrelated edits.
- src-tauri/src/lib.rs: dropped projects::* command registrations,
  kept main's get_goose_serve_host_info addition.
- check-file-sizes.mjs: accepted main's deletion (#8996 removed it).
- features/projects/api/projects.ts: kept our ACP-based rewrite
  (ProjectInfo without createdAt/updatedAt; uniqueProjectSlug for
  collision avoidance).
- features/projects/lib/chatProjectContext.ts: took main's rename
  resolveProjectArtifactRoots → resolveProjectRoots and dropped
  /artifacts segment append (we already had this fix); dropped
  buildProjectSystemPrompt (backend's load_project_instructions
  handles project system prompt injection now).
- features/projects/lib/sessionCwdSelection.ts: took main's no-project
  fallback ['~'] (matches our /artifacts removal in the project
  branch).
- features/chat/hooks/useChatSessionController.ts: took main's
  3-arg acpPrepareSession (the personaId/projectId we'd been
  passing were never read on that call path; newSession sends them
  via _meta).
- ProjectInfo test fixtures: dropped createdAt/updatedAt across
  CreateProjectDialog.test.tsx and sessionCwdSelection.test.ts.
- chatProjectContext.test.ts: dropped buildProjectSystemPrompt test.
shafqatevo pushed a commit to shafqatevo/goose that referenced this pull request Aug 7, 2026
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.

2 participants