[PR #3018] fix: add directory validation for session creation and retrieval #10510

Closed
opened 2026-02-16 18:15:11 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/3018

State: closed
Merged: No


Issues

Session creation allowed nonexistent directories or paths outside the project scope, causing invalid sessions. Retrieval failed when accessing sessions created in different project contexts.

Fixes

  • Added async directory existence and project boundary checks in Session.create using Bun's native APIs to prevent invalid session creation.
  • Improved Session.get with loop-based fallback to global project, enabling cross-project session access.

Question

Is allowing arbitrary directory specification (e.g., /root/ for a project in /user/foo) intentional? This enables cross-project work but may confuse users. Should we restrict to project-related directories?

Fixes API inconsistency reported in bug analysis.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/3018 **State:** closed **Merged:** No --- ### Issues Session creation allowed nonexistent directories or paths outside the project scope, causing invalid sessions. Retrieval failed when accessing sessions created in different project contexts. ### Fixes - Added async directory existence and project boundary checks in `Session.create` using Bun's native APIs to prevent invalid session creation. - Improved `Session.get` with loop-based fallback to global project, enabling cross-project session access. ### Question Is allowing arbitrary directory specification (e.g., /root/ for a project in /user/foo) intentional? This enables cross-project work but may confuse users. Should we restrict to project-related directories? Fixes API inconsistency reported in bug analysis.
yindo added the pull-request label 2026-02-16 18:15:11 -05:00
yindo closed this issue 2026-02-16 18:15:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10510