Skip to content

fix(ui): bind sessions to repo path - #83

Merged
delete-cloud merged 3 commits into
mainfrom
fix/bind-sessions-to-repo-path
Apr 27, 2026
Merged

delete-cloud merged 3 commits into
mainfrom
fix/bind-sessions-to-repo-path

Conversation

@delete-cloud

@delete-cloud delete-cloud commented Apr 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Bind default session execution to the session repo path instead of the server cwd.
  • Preserve explicit execution bindings and add regression coverage for both default and explicit cases.

Verification

  • uv run pytest tests/ui/test_session_manager_public_api.py -v
  • uv run pytest tests/ui/test_http_server.py -k "prompt" -v
  • uv run pytest tests/integration/test_wire_http_integration.py -v

Summary by CodeRabbit

  • Bug Fixes

    • Execution binding now initializes lazily at runtime to avoid eager instantiation and improve startup behavior.
    • Workspace root resolution now prefers a provided repository path (resolved to an absolute path) and falls back to the current working directory when needed.
    • Rehydration of stored session metadata correctly resolves relative repository paths into absolute workspace roots.
  • Tests

    • Added tests validating execution-binding initialization, precedence when an explicit binding is supplied, and correct rehydration from stored metadata.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Copilot AI review requested due to automatic review settings April 23, 2026 09:15
@coderabbitai

coderabbitai Bot commented Apr 23, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9bc770a1-1fd4-4101-8280-ff4f03967f1e

📥 Commits

Reviewing files that changed from the base of the PR and between 2c8fad5 and 1e8dcf2.

📒 Files selected for processing (2)
  • coding-agent/src/coding_agent/ui/session_manager.py
  • coding-agent/tests/ui/test_session_manager_public_api.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • coding-agent/tests/ui/test_session_manager_public_api.py

📝 Walkthrough

Walkthrough

Session.execution_binding is no longer eagerly default-instantiated; a sentinel is stored and Session.__post_init__ lazily constructs a LocalExecutionBinding using repo_path.resolve() when present, otherwise Path.cwd().resolve(). from_store_data now resolves repo/workdir before binding creation. Tests added for these behaviors.

Changes

Cohort / File(s) Summary
Session initialization
coding-agent/src/coding_agent/ui/session_manager.py
Replaced eager LocalExecutionBinding default with a sentinel and added lazy creation in Session.__post_init__. workspace_root is derived from repo_path.resolve() when available, else Path.cwd().resolve(). Updated from_store_data fallback resolution and inline docs in to_store_data.
Tests for execution binding behavior
coding-agent/tests/ui/test_session_manager_public_api.py
Added three tests validating: (1) defaulting to LocalExecutionBinding when only repo_path is provided (using resolved absolute path), (2) explicit execution_binding takes precedence over repo_path, and (3) rehydration from store data with a relative repo_path yields a LocalExecutionBinding with resolved workspace_root.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I waited patient, nose to the ground,
Repo paths call and I hop around.
If resolved I nest where your code likes to be,
Else I cozy up to the current CWD.
Little rabbit, lazy-bind, happy and free.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly reflects the main change: binding sessions to repository path instead of server cwd, which is the primary objective of this pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/bind-sessions-to-repo-path

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates session initialization so that a session’s default local execution workspace is derived from the session’s repo_path (instead of the server process CWD), while preserving any explicitly provided execution binding, and adds regression tests covering both behaviors.

Changes:

  • Default Session.execution_binding initialization now derives workspace_root from repo_path.resolve() when no binding is provided.
  • Session.execution_binding is now nullable in the dataclass and is initialized in __post_init__, with defensive runtime checks added before persistence/workspace resolution.
  • Added tests verifying default binding-from-repo behavior and explicit binding precedence.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
coding-agent/src/coding_agent/ui/session_manager.py Changes Session initialization to default execution_binding from repo_path and adds guards where binding is assumed initialized.
coding-agent/tests/ui/test_session_manager_public_api.py Adds regression tests for default binding from repo_path and for preserving explicitly provided bindings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

workspace_root=str(Path.cwd().resolve())
)
)
execution_binding: ExecutionBinding | None = None
Comment on lines +99 to +110
workspace_root=str(Path.cwd().resolve())
)
)
execution_binding: ExecutionBinding | None = None
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@coding-agent/src/coding_agent/ui/session_manager.py`:
- Around line 134-142: The legacy hydration branch in Session.from_store_data
leaves repo_path/workspace root un-normalized, causing non-canonical workspace
roots versus new construction; update the legacy branch that sets
self.execution_binding to LocalExecutionBinding to resolve repo_path with
Path.resolve() (use str(self.repo_path.resolve()) or str(Path.cwd().resolve())
when repo_path is None) and assign that resolved path to workspace_root before
constructing LocalExecutionBinding so the behavior matches the new default path
semantics in the execution_binding initialization.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d547a7c3-37b7-46d6-b67c-1e50df69a5d6

📥 Commits

Reviewing files that changed from the base of the PR and between bb1acec and 2c8fad5.

📒 Files selected for processing (1)
  • coding-agent/src/coding_agent/ui/session_manager.py

Comment thread coding-agent/src/coding_agent/ui/session_manager.py
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@delete-cloud
delete-cloud merged commit a1d5b99 into main Apr 27, 2026
1 check passed
@delete-cloud
delete-cloud deleted the fix/bind-sessions-to-repo-path branch April 27, 2026 01:50
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