Skip to content

Require explicit Pi workspace transfers#37

Merged
aniketmaurya merged 2 commits into
mainfrom
fix/pi-explicit-workspace-transfer
Jul 13, 2026
Merged

Require explicit Pi workspace transfers#37
aniketmaurya merged 2 commits into
mainfrom
fix/pi-explicit-workspace-transfer

Conversation

@aniketmaurya

@aniketmaurya aniketmaurya commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • stop uploading the local working directory when Pi connects to Celesto
  • add an explicit /celesto push command and refuse filesystem-root or home-directory pushes
  • require an established shared revision before /celesto sync
  • remove automatic shutdown sync and document the explicit transfer lifecycle

Testing

  • cd pi && npm run check

Summary by CodeRabbit

  • New Features

    • Added /celesto push to explicitly copy a local project to the remote workspace.
    • Added safety checks for local project locations.
    • Clarified excluded files and transfer behavior.
  • Updates

    • /celesto sync now transfers changes only after an explicit push.
    • Remote computers no longer automatically copy or sync local files.
    • Updated lifecycle guidance for retaining local copies when using keep.
  • Documentation

    • Revised setup instructions, transfer workflows, exclusions, and current feature scope.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@aniketmaurya, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 49 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6c77e377-1049-4309-8475-322c92650107

📥 Commits

Reviewing files that changed from the base of the PR and between 0a05ff9 and c6b01d9.

📒 Files selected for processing (2)
  • pi/src/index.ts
  • pi/tests/extension.test.ts
📝 Walkthrough

Walkthrough

Pi now starts with an empty remote workspace, adds /celesto push for guarded explicit transfers, requires a revision before sync, changes shutdown deletion behavior, and documents transfer exclusions and lifecycle rules.

Changes

Explicit workspace transfer workflow

Layer / File(s) Summary
Guarded workspace push
pi/src/index.ts, pi/tests/extension.test.ts
Adds local-root validation, implements /celesto push, persists the uploaded revision, and tests safe-root handling.
Session restore and transfer lifecycle
pi/src/index.ts
Restores or recreates terminal computers, removes automatic initial copying, requires /celesto push before sync, and deletes owned computers on exit unless retained.
Documented push, sync, and exclusions
README.md, pi/README.md
Documents explicit push and sync behavior, retention requirements, excluded files, and current transfer limitations.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Developer
  participant Pi
  participant CelestoComputer
  participant LocalWorkspace
  Developer->>Pi: run /celesto push
  Pi->>LocalWorkspace: validate project root
  Pi->>CelestoComputer: upload workspace
  CelestoComputer-->>Pi: return revision
  Pi-->>Developer: persist revision and report transfer
  Developer->>Pi: run /celesto sync
  Pi->>CelestoComputer: retrieve remote changes
  CelestoComputer-->>LocalWorkspace: copy changes and preserve conflicts
Loading

Possibly related PRs

  • CelestoAI/sdk#31: Updates the same Pi extension workflow with explicit push, session initialization, sync semantics, and shutdown handling.

Poem

Empty workspace, ready to roam,
Push the project, make it home.
Sync by hand when changes sing,
Keep your conflicts tucked within.
Computers fade when sessions cease—
A tidy transfer, sharp as steel.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: Pi now requires explicit workspace transfers instead of automatic copying.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pi-explicit-workspace-transfer

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.

❤️ Share

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

@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: 2

🧹 Nitpick comments (2)
pi/src/index.ts (1)

322-339: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Silent deletion, no last word to the user.

Shutdown drops the owned computer the moment !state.keep, no final sync, no word said about it — by design, understood. But if there's a revision on record (meaning the man's been doing real work on that remote box), deleting it without so much as a warning at exit time is asking for trouble down the line. /celesto status tells him the cleanup policy if he goes looking, but nobody goes looking on their way out the door.

A short notify before the delete — "unsynced changes will be lost" — costs nothing and saves someone's evening.

🤖 Prompt for 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.

In `@pi/src/index.ts` around lines 322 - 339, In the session_shutdown handler,
before deleting an owned computer when !state.keep, notify the user through
ctx.ui.notify that unsynced changes will be lost, then preserve the existing
updateStatus, delete, error handling, and runtime cleanup flow.
pi/tests/extension.test.ts (1)

16-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Guard's tested, the push handler itself isn't.

This covers assertSafeLocalRoot in isolation nicely. But the /celesto push command — the upload, the revision persisted, the skipped-file count in the notify — has no test riding on it yet. Given it's a new destructive action against the remote box, a test through celestoPiExtension exercising a fake computer would be worth the ink.

🤖 Prompt for 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.

In `@pi/tests/extension.test.ts` around lines 16 - 25, The existing test only
exercises assertSafeLocalRoot, so add an integration-style test through
celestoPiExtension for the /celesto push command using a fake computer. Verify
the handler performs the upload, persists the revision, and reports the
skipped-file count in its notification while preserving the existing unsafe-root
rejection behavior.
🤖 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 `@pi/src/index.ts`:
- Around line 384-388: Update the error notification in the catch handling
around assertSafeLocalRoot to remove the misleading “Run /celesto push to retry”
guidance. Preserve errorMessage(error) and clearly direct the user to exit Pi
and restart from a valid directory, consistent with the assertion’s existing
message.
- Around line 364-393: The push path in the action === "push" branch must
protect the remote workspace from overwrites and concurrent pushes. Before
calling uploadInitialWorkspace, reject pushes when the persisted state already
has a revision, and acquire/reuse the same synchronization guard used by
performSync so only one push or sync can run at a time. Ensure the guard is
released and status cleanup still occurs on every success or failure path.

---

Nitpick comments:
In `@pi/src/index.ts`:
- Around line 322-339: In the session_shutdown handler, before deleting an owned
computer when !state.keep, notify the user through ctx.ui.notify that unsynced
changes will be lost, then preserve the existing updateStatus, delete, error
handling, and runtime cleanup flow.

In `@pi/tests/extension.test.ts`:
- Around line 16-25: The existing test only exercises assertSafeLocalRoot, so
add an integration-style test through celestoPiExtension for the /celesto push
command using a fake computer. Verify the handler performs the upload, persists
the revision, and reports the skipped-file count in its notification while
preserving the existing unsafe-root rejection behavior.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 77437b25-d10f-4d88-be0f-801439777021

📥 Commits

Reviewing files that changed from the base of the PR and between bdeb00a and 0a05ff9.

📒 Files selected for processing (4)
  • README.md
  • pi/README.md
  • pi/src/index.ts
  • pi/tests/extension.test.ts

Comment thread pi/src/index.ts
Comment thread pi/src/index.ts Outdated
@aniketmaurya
aniketmaurya merged commit 998326d into main Jul 13, 2026
8 checks passed
@aniketmaurya
aniketmaurya deleted the fix/pi-explicit-workspace-transfer branch July 13, 2026 10:52
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.

1 participant