Skip to content

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 6, 2026

Summary

  • Fix session rename API calls to include directory query parameter
  • Without it, the API only searches the global session store and returns NotFoundError for project-scoped sessions

Changes

  • Add directory parameter to renameSession() function signature
  • Pass directory from tool context to API calls via URLSearchParams
  • Applies to both session-rename and sync_branch tools

Testing

  • session-rename tool: confirmed working with title rename
  • sync_branch tool: confirmed working with branch sync

Summary by CodeRabbit

Release Notes

  • Improvements
    • Session renaming operations now support directory-scoped execution, ensuring operations are properly contextualized within the appropriate directory scope.

…sessions

The session rename API requires a directory query parameter to find
project-scoped sessions. Without it, only the global session store
is searched, causing NotFoundError for project sessions.
@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical bug preventing project-scoped sessions from being renamed correctly within the OpenCode environment. By introducing and properly utilizing a directory parameter in the session renaming API calls, the system can now accurately identify and update sessions tied to specific projects, enhancing the reliability of session management across various tools.

Highlights

  • API Fix for Session Renaming: The pull request addresses an issue where the OpenCode session rename API would fail for project-scoped sessions, returning a NotFoundError because it only searched the global session store.
  • Directory Parameter Introduction: A directory parameter has been added to the renameSession() function signature to correctly scope API requests to the relevant project.
  • URL Parameter Integration: The directory parameter is now passed from the tool context to the API calls using URLSearchParams, ensuring it's included in the request.
  • Tool Compatibility: This fix has been applied to both the session-rename and sync_branch tools, ensuring proper functionality for both.
Changelog
  • .opencode/tool/session-rename.ts
    • Modified the renameSession function to accept a new directory parameter, crucial for scoping API requests.
    • Implemented the use of URLSearchParams to include the directory as a query parameter in the fetch API call for session renaming.
    • Updated the execute methods for both the session-rename and sync_branch tools to extract the directory from the context and pass it to the renameSession function.
Activity
  • No human activity (comments, reviews, etc.) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

Walkthrough

The change adds a required directory parameter to the renameSession helper function. This parameter is propagated through API calls as a query parameter, and all call sites are updated to supply the directory value extracted from the execution context in both default and sync_branch tools.

Changes

Cohort / File(s) Summary
Session Rename Directory Scoping
.opencode/tool/session-rename.ts
Enhanced renameSession function signature to accept directory parameter; updated API call to include directory as query parameter; modified context destructuring to extract directory in default and sync_branch tool execution flows; propagated directory argument to all renameSession call sites.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

📂 A directory arrives to guide the way,
Sessions renamed with proper scope each day,
Parameters flow through tools with grace,
Each call now knows its rightful place,
Zero debt maintained, the DevOps way! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a directory parameter to the session rename API call, which directly addresses the bug fix presented in the PR objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/session-rename-directory-param

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 7 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Fri Feb 6 02:37:14 UTC 2026: Code review monitoring started
Fri Feb 6 02:37:15 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 7
Fri Feb 6 02:37:15 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Fri Feb 6 02:37:17 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 7
  • VULNERABILITIES: 0

Generated on: Fri Feb 6 02:37:20 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly addresses a bug where project-scoped sessions could not be renamed by adding the necessary directory query parameter to the API call. The changes are well-contained, updating the renameSession helper and its callers in session-rename and sync_branch tools. I have one suggestion to improve the robustness of URL construction, but overall the fix is solid.

Comment on lines +57 to +60
const params = new URLSearchParams({ directory })

try {
const response = await fetch(`${baseUrl}/session/${sessionID}`, {
const response = await fetch(`${baseUrl}/session/${sessionID}?${params}`, {

Choose a reason for hiding this comment

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

medium

For improved robustness and readability when constructing URLs, it's better to use the URL API. This avoids manual string concatenation with ? and provides a cleaner way to manage query parameters, especially if more are added in the future.

Suggested change
const params = new URLSearchParams({ directory })
try {
const response = await fetch(`${baseUrl}/session/${sessionID}`, {
const response = await fetch(`${baseUrl}/session/${sessionID}?${params}`, {
const url = new URL(`/session/${sessionID}`, baseUrl);
url.searchParams.set('directory', directory);
try {
const response = await fetch(url, {

@marcusquinn marcusquinn merged commit b676666 into main Feb 6, 2026
14 of 15 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.opencode/tool/session-rename.ts (1)

106-112: ⚠️ Potential issue | 🟠 Major

Bug: git branch --show-current ignores directory — runs in wrong working directory.

The sync_branch tool extracts directory from context (line 103) and passes it to renameSession (line 118), but the git command on line 108 doesn't scope to that directory. This causes the command to run in the process's current working directory instead of the project directory, returning incorrect branch information if they differ.

The correct pattern already exists in .agent/plugins/opencode-aidevops/index.mjs (line 129): git -C "${directory}" branch --show-current.

🐛 Proposed fix
     let branch: string
     try {
-      const branchResult = await Bun.$`git branch --show-current`.text()
+      const branchResult = await Bun.$`git -C ${directory} branch --show-current`.text()
       branch = branchResult.trim()
     } catch {
       return "Not in a git repository or git command failed"

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.

1 participant