Skip to content

fix(workspaces): folders without Git no longer get a copy of the whole project (backport #288) - #145

Open
HaukeSchnau wants to merge 1 commit into
mainfrom
gitea-pr/290
Open

HaukeSchnau wants to merge 1 commit into
mainfrom
gitea-pr/290

Conversation

@HaukeSchnau

Copy link
Copy Markdown
Owner

Mirror of schnau/t3code#290 for CodeRabbit. Discuss and merge it on Gitea; this pull request closes when that one does.

Backport of #288 to `main`. A new workspace for a plain folder copied the whole folder. Big folders broke it: a one-off scheduled task retried a 174 GiB copy of `~/Buildlinx` every day from Nov 4 to 9, and dev-hauke launches failed when `du` hit its 30 s timeout. No copy workspace exists on srv-1, srv-2, dev-hauke or tower.

## What changed

The guarded directory copy is gone: `DirectoryCopyWorkspaces.ts`, `T3CODE_DIRECTORY_COPY_MAX_BYTES`, and the copy check a scheduled task ran on save. Plain folders (no `.git` or `.jj` above them) now take upstream's path:

- A folder that tracks Git folders, or has a `worktreeLayout`, still gets upstream's task folder.
- Any other plain folder gets upstream's answer for a folder with nothing to check out.

jj projects keep their jj workspaces. Isolated workspaces are untouched here; the stacked follow-up PR removes them.

## What a user sees now

- **Composer, plain folder that tracks Git folders:** upstream's workspace menu with its repository choice. A new worktree becomes a task folder, as before.
- **Composer, plain folder with nothing to check out:** no workspace choice; threads work in the folder (upstream). Before, the fork's selector offered **New workspace**, which made a copy.
- **jj project:** unchanged, still the fork's selector with **New workspace**. Its **New isolated workspace** item now shows only in jj projects until the follow-up removes it.
- **Agents:** a `worktree` launch in such a folder is refused with upstream's "Project … is not a Git repository." A fork `workspace` launch from an older client fails in preparation with "This folder is not a Git repository and tracks no Git folders, so a thread can only work in the folder itself." `t3_worktree_handoff` gives upstream's not-a-repository error. The tool descriptions no longer mention copies.
- **Scheduled tasks:** a new-worktree task in such a folder is saved as a project-folder task, as upstream does. A task that selects tracked repositories keeps its selection.
- Upstream's newer pingdotgg/t3code#44799 (not synced yet) makes a person's worktree request in such a folder run in the folder instead of failing; it arrives with the next upstream sync.

`isNonGitProject` keeps upstream's name but is now false for projects that get a jj workspace, thread world or task folder, so upstream's scheduled-task code leaves those strategies alone (documented in `patches/workspaces.md`). A `workspace` launch with an explicit base no longer reads Git status.

## Evidence

- On this backport: `vp run check:changed origin/main` passes (format, lint, knip, typecheck of 43 packages, 16 test files, React Compiler). Conflicts were the measured `agentContextBudget.json` (main's tool list is 167 bytes smaller) and the selector wording in `patches/workspaces.md`.
- On #288: `vp run check:changed origin/redesign` passes (format, lint, knip, typecheck of 43 packages, tests beside the changed files, React Compiler). Focused suites: `ManagedWorkspaces.test.ts`, `ScheduledTaskService.*.test.ts`, the scheduled-task and plain-folder cases of `ThreadLaunchService.test.ts`, client-runtime `workspaces.test.ts`.
- mcp-tool-use evals, 10 cases that launch threads, hand off or set workspace strategies, 2 samples each: identical pass rates to the redesign text on Sonnet 5.5 and Opus 5.5. `tt-another-thread-worktree` fails 0/2 on both texts.
- Real web client against a dev server: a plain folder shows no workspace control and upstream's "Initialize Git"; a jj project keeps the selector with **New workspace**. Screenshots are on #288.
- Read-only checks on all four hosts: no plain-folder project has a `worktreeLayout`, and no saved scheduled task asks for a worktree in a plain folder.

## Review

Sol's open item: S6 says this head alone hides **New isolated workspace** for plain folders while the server still supports it. I kept the jj-only gate because the stacked follow-up removes every isolated option; restoring it here would add client code that PR deletes. It only matters if this PR lands without the follow-up. Declined with evidence: S1 (`worktreeLayout`-only folders lose the composer offer; upstream's composer behaves the same and no such project exists), S3, S4. Fixed: S2, S5.

Reviewed with sol-loop: 3 rounds with GPT 6.2 Sol. Sol verdict: changes requested on S6 only (disputed, see above)

Implemented by Claude Opus 5.5 in Claude Code, run from T3 Code.

…e project

A new workspace for a plain folder copied the folder. Copies of large
folders failed or ran into the size limit (a scheduled task retried a
174 GiB copy every day, and launches failed when du timed out), and no
copy workspace exists on any host.

Plain folders now take upstream's path: a folder that tracks Git folders
or has a worktreeLayout gets upstream's task folder as before, and any
other plain folder gets upstream's answer for a folder with nothing to
check out. The composer offers managed workspaces only in jj checkouts,
and a scheduled worktree task in such a folder saves as a root task, as
upstream does.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-01T19:22:21.331986Z e391ef7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 58 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4498f6f and e391ef7.

Files selected for processing: 28

  • apps/mobile/src/features/threads/new-task-flow-provider.tsx
  • apps/server/src/mcp/ManagedWorkspaceHandoff.ts
  • apps/server/src/mcp/toolkits/project/tools.ts
  • apps/server/src/mcp/toolkits/worktree/tools.ts
  • apps/server/src/orchestration-v2/ThreadLaunchService.test.ts
  • apps/server/src/orchestration-v2/ThreadLaunchService.ts
  • apps/server/src/provider/agentContextBudget.json
  • apps/server/src/scheduledTasks/ScheduledTaskService.interval.test.ts
  • apps/server/src/scheduledTasks/ScheduledTaskService.schedule.test.ts
  • apps/server/src/scheduledTasks/ScheduledTaskService.ts
  • apps/server/src/storageCleanup.ts
  • apps/server/src/workspace/DirectoryCopyWorkspaces.ts
  • apps/server/src/workspace/ManagedWorkspaces.test.ts
  • apps/server/src/workspace/ManagedWorkspaces.ts
  • apps/web/src/components/ChatView.tsx
  • apps/web/src/lib/managedWorkspaces.ts
  • docs/user/project-settings.md
  • docs/user/separate-projects.md
  • docs/user/thread-sidebar.md
  • packages/client-runtime/src/state/workspaces.test.ts
  • packages/client-runtime/src/state/workspaces.ts
  • packages/contracts/src/workspace.ts
  • packages/provider-core/src/server/orchestrationInstructions.ts
  • patches/one-time-scheduled-tasks.md
  • patches/storage-cleanup.md
  • patches/workspaces.md
  • patches/worldfs.md
  • patches/worlds.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e391ef73a0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// A folder that is not a Git repository, Scratch included, cannot hold a worktree.
// Selected tracked repositories get worktrees whether or not the folder is a repository.
const workspaceStrategy: ScheduledTask["workspaceStrategy"] =
input.workspaceStrategy.type === "worktree" &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Handle saved workspace tasks for plain folders

For a non-isolated { type: "workspace" } task saved for a plain folder with no task-folder plan, this conversion only handles worktree. The scheduled-task editor preserves unchanged saved strategies, so the task continues to dispatch as workspace, which ThreadLaunchService.resolveLaunchStrategy now rejects for that folder. These tasks will keep failing on scheduled runs after upgrade; handle or clearly reject the saved strategy rather than leaving it enabled to fail repeatedly.

Useful? React with 👍 / 👎.

@HaukeSchnau

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@HaukeSchnau

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@HaukeSchnau

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

This branch has not been deployed

No deployments
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