Skip to content

fix(workspaces): honor intentional non-git project paths - #12205

Closed
raviy06 wants to merge 2 commits into
paperclipai:masterfrom
raviy06:fix/honor-non-git-project-workspaces
Closed

raviy06 wants to merge 2 commits into
paperclipai:masterfrom
raviy06:fix/honor-non-git-project-workspaces

Conversation

@raviy06

@raviy06 raviy06 commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Thinking Path

  • Paperclip is the open source control plane for AI-agent companies.
  • Local adapters run from project and execution workspaces selected by the control plane.
  • The heartbeat preflight protects adapters from incoherent Git workspace state.
  • A project workspace can also declare sourceType: non_git_path for intentional non-Git work.
  • The preflight treated every selected project workspace as Git-backed and rejected that declared mode.
  • This pull request carries the workspace source type into run resolution and narrows only the Git metadata check.
  • The benefit is that intentional non-Git projects run while Git-backed and git_worktree safeguards remain strict.

Linked Issues or Issue Description

What happened?

A Git-sensitive local adapter received a valid project workspace with sourceType: non_git_path. The heartbeat preflight stopped before adapter launch with workspace_validation_failed and missing_git_metadata because the directory had no .git metadata.

Expected behavior

Paperclip must accept a declared non_git_path project workspace when the execution and persisted workspace strategies are not git_worktree. Paperclip must keep all other project, workspace, cwd, fallback, provider-ref, and branch coherence checks.

Steps to reproduce

  1. Create a project workspace with sourceType: non_git_path and an existing non-Git directory as cwd.
  2. Link an issue to that workspace.
  3. Assign the issue to a local Git-sensitive adapter such as OpenCode or Cursor.
  4. Start a heartbeat.
  5. Observe workspace_validation_failed with reason missing_git_metadata before adapter launch.

Paperclip version or commit

The bug reproduces on v2026.824.0 and on the pre-fix master code path.

Deployment mode

Local trusted installation with a local adapter.

Duplicate search

I searched open Paperclip issues and pull requests for non_git_path, missing_git_metadata, and workspace-validation variants. I found no active duplicate.

What Changed

  • Carry the project workspace sourceType into resolved run workspace metadata.
  • Skip only the .git presence check for intentional non_git_path workspaces.
  • Keep .git required for local_path and every git_worktree execution.
  • Add positive and negative regression coverage.
  • Document the intentional non-Git workspace contract.

Verification

  • RED: pnpm exec vitest run server/src/__tests__/heartbeat-workspace-session.test.ts -t "allows a non_git_path project workspace without git metadata"
    • Failed with missing_git_metadata before the implementation.
  • mise x node@26.5.1 -- pnpm exec vitest run server/src/__tests__/heartbeat-workspace-session.test.ts
    • 146 tests passed.
  • mise x node@26.5.1 -- pnpm -r typecheck
    • Passed.
  • Independent spec and code-quality reviews
    • Passed with no high-confidence gaps or P1/P2 findings.
  • Local packaged-runtime self-test on a real non_git_path project workspace
    • Distribution Agent run succeeded and posted NON_GIT_WORKSPACE_OK.
  • mise x node@26.5.1 -- pnpm test:run
    • 473 test files and 4,395 tests passed.
    • One unrelated UI test failed: OnboardingWizard.test.tsx expected a denied-storage getItem call under Node 26.
    • The same focused UI test fails unchanged on clean origin/master at ca02d2463; this branch does not touch UI or storage code.
  • mise x node@26.5.1 -- pnpm build
    • Passed.

Risks

Low risk. The exception is explicit and data-backed. It applies only to sourceType: non_git_path when neither workspace strategy is git_worktree. All other workspace validation remains unchanged.

For core feature work, check ROADMAP.md first and discuss it in #dev before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See CONTRIBUTING.md.

Model Used

OpenAI Codex subscription with gpt-5.6-sol-900k. The model used a 900k context window, repository tools, terminal execution, and independent review agents.

Checklist

  • I have included a thinking path that traces from project context to this change
  • I have specified the model used (with version and capability details)
  • I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work
  • I have searched GitHub for duplicate or related PRs and linked them above
  • I have either (a) linked existing issues with Fixes: # / Closes # / Refs # OR (b) described the issue in-PR following the relevant issue template
  • I have not referenced internal/instance-local Paperclip issues or links (only public GitHub #NNN / github.com/paperclipai/paperclip URLs)
  • My branch name describes the change (e.g. docs/..., fix/...) and contains no internal Paperclip ticket id or instance-derived details
  • I have run tests locally and they pass
  • I have added or updated tests where applicable
  • I have updated relevant documentation to reflect my changes
  • I have considered and documented any risks above
  • All Paperclip CI gates are green
  • Greptile is 5/5 with no open P2s, recommendations, or follow-ups
  • I will address all Greptile and reviewer comments before requesting merge

@greptile-apps

greptile-apps Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR carries a project workspace’s source type into heartbeat run resolution and permits explicitly declared non_git_path workspaces to bypass only the Git-metadata check.

  • Preserves Git requirements for local_path and git_worktree execution.
  • Adds positive and negative regression coverage for non-Git workspace behavior.
  • Documents the intentional non-Git workspace contract.
  • Includes the required thinking path, implementation details, verification, benefits, and risks.

Confidence Score: 5/5

The PR appears safe to merge; the non-Git exception is explicit, narrowly scoped, and retains the surrounding workspace-coherence checks.

No actionable new defects or outstanding rule violations were identified in the PR changes.

Important Files Changed

Filename Overview
server/src/services/heartbeat.ts Propagates project workspace source type and narrowly exempts intentional non-Git paths from the .git metadata check while retaining other coherence guards.
server/src/tests/heartbeat-workspace-session.test.ts Covers acceptance of a plain non_git_path workspace and continued rejection when it is realized as a Git worktree.
doc/execution-semantics.md Documents that intentional non-Git project workspaces may run without Git metadata while other workspace checks remain applicable.

Reviews (2): Last reviewed commit: "Merge branch 'master' into fix/honor-non..." | Re-trigger Greptile

@oliver-mee

Copy link
Copy Markdown

This is the right shape of fix, and it is the one I would back of the three open approaches. Carrying the workspace's own sourceType into heartbeat resolution is exactly the missing link: today the gate welds "has a project workspace" to "must be a git checkout" and never consults what kind of workspace was actually declared, so the product will happily create a non_git_path workspace and then refuse to launch anything in it forever.

Some evidence from running into this on a larger instance, in case it helps justify picking one of these up.

It still reproduces on 2026.916.0. It is also latent in a way that makes it hard to attribute: attaching a folder sets the workspace expectation immediately, but nothing fails until that project's next run. After a batch of folder attachments, 24 of 48 projects were pre-broken and only 4 ever surfaced recovery cards, because only those 4 happened to be woken afterwards. The card that eventually appears says nothing about the attach that caused it, so the gap between cause and symptom can be days. Scoping the bypass to declared non_git_path workspaces, as this PR does, would have prevented all of it.

Worth noting for whoever triages these: #7957 covers a genuinely distinct case that this PR does not, folders nested inside an existing git checkout. hasGitMetadata lstats <cwd>/.git and does not walk up, so a working folder under a repo fails identically to a plain directory. #8778 is a third approach to the same gate and is currently conflicting. All three touch the same function and the same test file, so they will collide with each other; picking one and closing the others seems better than letting all three age.

Background on the underlying bug is in #9824.

@oliver-mee

Copy link
Copy Markdown

Thanks for this, @raviy06. I am running this fix on a live instance, and it does exactly what it says.

It had gone a month without a maintainer review, so I carried it forward in #13929 on current master, following the "help stalled PRs over the line" note in CONTRIBUTING. Your commit is in there unchanged and still has your name on it, and you are a co-author on the small follow-up commit. That one adds a hint to the missing_git_metadata error for local_path folders and two more tests.

If you would rather keep going here, say so and I will close mine. I only want one of these to land.

@raviy06

raviy06 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Carried forward PR is fine with me as well.

@commitperclip

commitperclip Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Thanks @raviy06: this was fixed upstream in #15749 (merged 2026-10-13).

Master skips the .git metadata check for a local-path or non_git_path project workspace that has no repository URL, so an intentional non-git folder no longer fails with missing_git_metadata.

If you're still seeing this problem on current master, please comment here with the details (or open an issue) and we'll gladly reopen it.

Thank you for the contribution, and sorry it took us a while to get back to you.


Generated by Claude Code

@commitperclip commitperclip Bot closed this Nov 24, 2026
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