-
Notifications
You must be signed in to change notification settings - Fork 9.1k
fix: filter CLI sessions by current directory for worktree support #12008
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: dev
Are you sure you want to change the base?
Conversation
- Add JWT expiration check utility - Implement dynamic base URL resolution based on token environment - Add missing x-api-key and Authorization: Bearer headers - Add organizationId to ApiAuth schema - Add proactive token expiration warnings in CLI and model discovery
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
…itely When network issues occur mid-stream (TCP half-open connections, stalled LLM providers, proxy timeouts), the streaming loop would hang forever waiting for the next chunk. This fix adds an idle timeout that detects when no data has been received for a configurable period (default 60 seconds) and triggers a retry with exponential backoff. Changes: - Add StreamIdleTimeoutError class to message-v2.ts - Add withIdleTimeout() async generator wrapper in processor.ts - Wrap stream.fullStream with idle timeout in the process loop - Mark StreamIdleTimeoutError as retryable so sessions recover automatically - Add stream_idle_timeout config option under experimental settings - Add additional network error types (ETIMEDOUT, ENOTFOUND, etc) as retryable Fixes issues where sessions get stuck for hours on LLM requests. Related: anomalyco#8383, anomalyco#2512, anomalyco#2819, anomalyco#4255
fix: add stream idle timeout to prevent sessions from hanging indefinitely
Integrate Kilo Code provider: - Add kilocode device authorization flow in auth.ts - Add kilocode provider loader in provider.ts - Add dynamic model discovery from Kilo Code API in models.ts - Add JWT expiry check for kilocode tokens in run.ts - Add install:local script for developer convenience - Add desktop infra import in sst.config.ts Preserves dev branch improvements: - Provider filtering (enabled/disabled providers) - Improved Data lazy loading with Flag support - Better message handling in run command - Plugin auth handling
When running 'opencode -c' (continue) or 'opencode session list' from a git worktree directory, the CLI was incorrectly showing sessions from all worktrees of the same repository. This happened because sessions are grouped by projectID (git root commit hash), which is the same for all worktrees. Changes: - run.ts: Pass current directory to sdk.session.list() when using -c flag - session.ts: Filter sessions to only show those matching Instance.directory This matches the existing TUI behavior which already filters by directory.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: I found a related PR that appears to be addressing a similar issue: Potential Related PR:
Also note:
These are not duplicates of PR #12008, but rather related efforts that address the same underlying issue in different parts of the codebase (TUI vs CLI). |
Summary
Fixes an issue where
opencode -c(continue) andopencode session listshowed sessions from all worktrees of the same repository instead of only sessions for the current directory.Problem
When running opencode from a git worktree directory (e.g.,
~/workspace/project.worktree1), the CLI commands would incorrectly show/continue sessions from the main repository or other worktrees. This happened because:directoryfield that correctly identifies which worktree they belong toprojectID(derived from git root commit hash) - this is the same for all worktreesChanges
run.ts: Passprocess.cwd()tosdk.session.list()when using the-c(continue) flagsession.ts: Filter session list to only show sessions wheresession.directory === Instance.directoryTesting
This change aligns CLI behavior with the TUI, which already filters sessions by directory in
packages/app/src/pages/layout.tsx.Before: Running
opencode session listfromproject.worktree1shows sessions fromproject,project.worktree1,project.worktree2, etc.After: Running
opencode session listfromproject.worktree1shows only sessions created inproject.worktree1.