Skip to content

Conversation

Copy link

Copilot AI commented Dec 9, 2025

The sidebar's subagent navigation was broken due to checking non-existent metadata fields instead of using the guaranteed sessionID field from ToolPart.

Changes

  • Replace dual-check pattern part.metadata?.sessionId ?? stateMetadata?.sessionId with direct part.sessionID access
  • Remove incorrect string | undefined type cast (field is guaranteed by Zod schema)
  • Remove conditional navigation check since sessionID is always present
// Before: checking non-existent fields
const stateMetadata = (part.state as { metadata?: Record<string, unknown> }).metadata
const sessionId = (part.metadata?.sessionId ?? stateMetadata?.sessionId) as string | undefined
onMouseDown={() => {
  if (sessionId) route.navigate({ type: "session", sessionID: sessionId })
}}

// After: using guaranteed field
const sessionId = part.sessionID
onMouseDown={() => {
  route.navigate({ type: "session", sessionID: sessionId })
}}

The ToolPart type inherits sessionID: string from its base schema, making it always available.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI mentioned this pull request Dec 9, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 9, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: kcrommett <523952+kcrommett@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix sessionID usage in Sidebar based on feedback Fix sessionID navigation by using guaranteed ToolPart.sessionID field Dec 9, 2025
Copilot AI requested a review from shuv1337 December 9, 2025 11:00
@shuv1337 shuv1337 marked this pull request as ready for review December 9, 2025 12:08
@shuv1337 shuv1337 merged commit bf680fd into sidebar-fix Dec 9, 2025
1 check passed
Copy link

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

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.

ℹ️ 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 247 to +251
flexDirection="row"
gap={1}
paddingLeft={2}
onMouseDown={() => {
if (sessionId) route.navigate({ type: "session", sessionID: sessionId })
route.navigate({ type: "session", sessionID: sessionId })

Choose a reason for hiding this comment

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

P1 Badge Use subagent metadata sessionId for navigation

Clicking a subagent entry now calls route.navigate with sessionId sourced from part.sessionID, but every task tool part in this list belongs to the current session so that value just reloads the session you are already viewing. The Task tool writes the subagent’s target session into state.metadata.sessionId when it creates or updates the subagent task (packages/opencode/src/tool/task.ts lines 57-62, 79-84, 135-139), so this change makes subagent sessions unreachable from the sidebar.

Useful? React with 👍 / 👎.

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