fix(storage): add cwd parameter to OpenCodeStorageProvider.list_session_ids() - #98
Closed
Million-mo wants to merge 2 commits into
Closed
fix(storage): add cwd parameter to OpenCodeStorageProvider.list_session_ids()#98Million-mo wants to merge 2 commits into
Million-mo wants to merge 2 commits into
Conversation
…on_ids() OpenCodeStorageProvider.list_session_ids() was missing the 'cwd' parameter that the base class and all other providers (SQLModelProvider, MemoryProvider) accept. When StorageManager.list_session_ids(cwd=cwd) forwarded the call, it raised TypeError which was silently caught by NativeAgent.list_sessions(), returning an empty list and hiding all historical sessions in the TUI. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
When read_session() returns None (corrupted JSON / I/O error), the cwd filter was bypassed and the session was incorrectly included. Changed the guard from 'if session is not None and session.directory != cwd' to 'if session is None or session.directory != cwd' so that unverifiable sessions are excluded when a cwd filter is active. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
3 tasks
Owner
Author
|
Owner
Author
|
This was referenced Aug 22, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cwd: str | None = Noneparameter toOpenCodeStorageProvider.list_session_ids(), matching the base classStorageProvidersignature that all other providers (SQLModelProvider, MemoryProvider) already implementcompute_project_id(cwd)for efficient project-directory narrowing, then verify session'sdirectoryfield matchesBug
When the OpenCode TUI calls
GET /session?directory=<dir>, the call chain passescwdthroughStorageManager→OpenCodeStorageProvider.list_session_ids(cwd=cwd), which raisedTypeError: unexpected keyword argument 'cwd'because the override omitted the parameter. The TypeError was silently caught byNativeAgent.list_sessions(), returning[]and hiding all historical sessions.Root cause: Commit
dacfb7146addedcwdparameter to base class, StorageManager, MemoryProvider, and SQLModelProvider — but missedOpenCodeStorageProvider.Production log evidence (
opencode.log.1:2565-2587):Test plan
test_list_session_ids_accepts_cwd_parameter— verifies no TypeError when passing cwdtest_list_session_ids_cwd_filters_by_directory— verifies only matching sessions returnedtest_list_session_ids_cwd_none_returns_all— verifies no filter when cwd=Nonetest_list_session_ids_signature_matches_base_class— static signature compatibility check