Repository navigation
fix: fence workspace export ownership - #118
Conversation
Keep workspace archive export behind the same owner and active-turn fences as other owner-sensitive session surfaces so callers cannot race a live turn or stale lease and get a stale snapshot. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Record the scoped ADR-19 workspace export fencing packet alongside the code change so the bounded engineer-reviewer-verifier loop stays reproducible from the branch itself. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR implements ownership fencing for workspace export by adding a SessionManager-level guard that serializes exports with the session turn lock, validates ownership before and after export, and rejects stale owners via fencing tokens. The HTTP endpoint is refactored to delegate to this new method with proper error mapping. ChangesWorkspace Export Ownership Fencing
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@coding-agent/src/coding_agent/ui/http_server.py`:
- Around line 1042-1043: The current except block mapping any RuntimeError to
HTTP 409 can mislabel export failures; in the except RuntimeError as exc handler
for export_workspace_archive_from_config, check if str(exc) == "turn already in
progress" and only then raise HTTPException(status_code=409, detail=...) from
exc; otherwise re-raise the original RuntimeError so it surfaces as a 500.
Mirror the exact guard logic used in send_prompt to locate and update the
handler for export_workspace_archive_from_config.
🪄 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: 35758090-90c8-4b1f-ba7f-79eafbfd0b4b
📒 Files selected for processing (5)
coding-agent/.opencode/prompts/tasks/adr-0019-pr5-workspace-export-fencing.mdcoding-agent/src/coding_agent/ui/http_server.pycoding-agent/src/coding_agent/ui/session_manager.pycoding-agent/tests/ui/test_http_server_workspace_transfer.pycoding-agent/tests/ui/test_session_manager_public_api.py
Only map the expected active-turn runtime conflict to HTTP 409 for workspace export so provider and backend failures continue surfacing as server errors instead of being mislabeled as conflicts. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Summary
GET /sessions/{session_id}/workspacebehindSessionManager.export_workspace_archiveso workspace export shares the same owner and active-turn gating as other owner-sensitive HTTP surfaces.opencode/prompts/tasks/adr-0019-pr5-workspace-export-fencing.mdVerification
uv run pytest tests/ui/test_http_server_workspace_transfer.py -vuv run pytest tests/ui/test_http_server_failover.py -k \"get_events\" -vuv run pytest tests/ui/test_session_manager_public_api.py -k \"export_workspace_archive or capture_checkpoint_rejects_active_turn or capture_checkpoint_rejects_when_turn_lock_is_held or restore_checkpoint_rejects_active_turn or restore_checkpoint_rejects_when_turn_lock_is_held\" -vservereturned200for provisioned workspace export withnested/data.jsonandresult.txt, and409 {\"detail\":\"turn already in progress\"}for export during an active/promptturnSummary by CodeRabbit
Bug Fixes
Documentation