Skip to content

Prepare the server UI dist before staging a git payload - #17163

Open
jjude80 wants to merge 13 commits into
paperclipai:masterfrom
jjude80:fix/git-install-ui-dist
Open

jjude80 wants to merge 13 commits into
paperclipai:masterfrom
jjude80:fix/git-install-ui-dist

Conversation

@jjude80

@jjude80 jjude80 commented Oct 22, 2026 •

Copy link
Copy Markdown

Thinking Path

  • Paperclip is the open source app people use to manage AI agents for work
  • The CLI installs and updates the control plane on a host
  • The managed install store supports a git source, so a fork branch can be a version source
  • paperclipai install --repo <owner/name> --ref <branch> builds that branch from a clean checkout
  • The build worked, but the packaging step failed, so no git payload can be installed
  • This pull request builds the UI before the server package is staged
  • The benefit is that a fork build can be installed on an instance

Linked Issues or Issue Description

What happened?

paperclipai install --repo <owner/name> --ref <branch> failed at the packaging step. The server package ships the built UI inside it. scripts/prepare-bundled-package.mjs copies server/ui-dist into the staged package. A clean git checkout has no server/ui-dist. The file is produced by scripts/prepare-server-ui-dist.sh. The server package runs that script in its prepack hook, and prepack only runs on pnpm pack. The git install flow stages the server package directly with prepare-bundled-package.mjs, so the hook never runs and the file is missing.

Expected behavior

The command builds a payload and activates it.

Steps to reproduce

  1. Run paperclipai install --repo <owner/name> --ref <branch> -y on a host where no payload for that commit exists.
  2. Wait for the build to finish. The build takes about twenty minutes.
  3. The command fails with:
Command failed: /usr/bin/node .../source/scripts/prepare-bundled-package.mjs .../source/server .../workspace-package-16
node:internal/fs/cp/cp-sync:56
Error: ENOENT: no such file or directory, lstat '.../source/server/ui-dist'

Paperclip version or commit

master at 00818634.

Deployment mode

A running deployment of this server.

Installation method

Managed install store, git source.

Agent adapter(s) involved

Not adapter-specific (core bug).

Database mode

Not adapter-specific (core bug).

Access context

Operator, on the host that runs the instance.

Node.js version

Node.js 24.

What Changed

This branch carries two changes, and both are needed for a deployable payload: the pull request's own subject (the CLI must be able to build a git payload at all) and the workspace-isolation change proposed separately as #17156 (a payload has to contain the whole fix, not half of it). Each is listed separately below with its own callers.

1. Prepare the server UI dist before staging a git payload

  • cli/src/commands/install.ts: build the server UI dist after the server build and before the workspace packages are staged. The flow uses scripts/prepare-server-ui-dist.sh, which is the same script that scripts/release.sh uses before it packs.
  • The step only runs when the script exists in the checkout. A checkout without the script behaves as before.
  • cli/src/__tests__/install-command.test.ts: add a test. The test checks that the UI preparation runs, and that it runs before prepare-bundled-package.mjs stages the bundled package.
  • Affected callers: paperclipai install --repo <owner/name> --ref <branch> only. The npm install path, the update path and the rollback path are untouched.

2. Give each issue its own execution workspace (from #17156)

  • server/src/services/issues.ts: a child issue inherits its parent's workspace mode and settings, but not the parent's workspace row when that row is an isolated workspace. A shared workspace is still inherited, because sharing it is the point of it. A pinned existingBranch is stripped from inherited settings when the workspace is not bound.
  • server/src/services/heartbeat/workspaces.ts and server/src/services/execution-workspace-policy.ts: the reuse request carries the issue, the workspace mode and the workspace owner. Reusing an isolated workspace owned by another issue is refused, the refusal names the holder, and the pinned branch is dropped so a refused child derives its own branch and its own worktree.
  • server/src/services/heartbeat/workspace-preparation.ts: one decision now feeds both preparation paths. resolveExecutionWorkspaceReuseWorkspaceId returns the reusable workspace when the issue owns it, the requested workspace when nobody else owns it, and no workspace at all when the request was refused, so the plugin preparation cannot restore the holder's row either.
  • server/src/services/heartbeat/queue.ts: the admission notice is emitted only for a refused reuse request, it states the observed result instead of promising a replacement, and the duplicate check is a bounded query instead of a scan of every comment body.
  • Affected callers: issue creation (server/src/services/issues.ts), dispatch (server/src/services/heartbeat/queue.ts), workspace preparation (server/src/services/heartbeat/workspace-preparation.ts), plugin workspace preparation (server/src/services/plugin-workspaces.ts) and workspace realization (server/src/services/workspace-runtime.ts).
  • Behaviour that is disabled on purpose: reuse of another issue's isolated workspace, and the pinned branch that would have pointed at the holder's registered worktree. A shared workspace is still reused, and an issue's own isolated workspace is still reused.

Verification

For the CLI change:

  • Run pnpm --filter @paperclipai/cli test -- src/__tests__/install-command.test.ts. The new case fails without the change and passes with it.
  • Run pnpm --filter @paperclipai/cli typecheck.
  • Run the end-to-end check: paperclipai install --repo <owner/name> --ref <branch> -y. Before the change the command fails with ENOENT ... server/ui-dist. After the change it prints Activated cached or Installed.

For the workspace-isolation change:

  • server/src/__tests__/execution-workspace-policy.test.ts covers the inheritance decision, the strategy resolution for a refused child, the workspace id decision for both preparation paths and the admission-notice rule.
  • server/src/__tests__/issues-service.test.ts covers issue creation: a child of an isolated parent gets its own workspace row, a child of a shared parent still shares, and a pinned branch does not travel with an unbound workspace.
  • server/src/__tests__/heartbeat-workspace-session.test.ts covers the dispatch path, from the refusal through the effective strategy and the workspace id the preparation paths receive.
  • The full server suite, the serialized suites, the typecheck and the e2e lanes run on this pull request.

Risks

The CLI change is low risk on its own. It adds one build step to the git install flow. It does not change any runtime behaviour of the installed payload. The step is skipped when the checkout has no scripts/prepare-server-ui-dist.sh, so other repositories are not affected. The build takes a little longer because the UI is now built.

The workspace-isolation change moves a boundary, so it is worth being explicit about what it refuses and what it does not:

  • A child issue that would have shared its parent's isolated worktree now gets its own. Runs that relied on sharing a parent's tree stop sharing it, which is the intended effect: an isolated workspace is per issue.
  • An issue that owns its isolated workspace still reuses it, and a shared workspace is still shared. A recovery run keeps the workspace it was already dispatched into.
  • The refusal is loud: the queue posts one comment naming the holder issue, deduplicated by an HTML marker, and only for a reuse request that was actually refused.
  • The refusal carries into the plugin preparation path as well, so a refused child cannot be handed the holder's storage by the other door.
  • The tests are the acceptance basis: they fail against the previous behaviour and pass against this one.

Model Used

  • Provider: Minimax
  • Model: MiniMax M3.1 Flash (opencode provider, minimax-m3.1-flash-free)
  • Context window: 1M
  • Reasoning mode: none
  • Capabilities: tool use, code execution, shell

Related pull requests

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 (every review comment on this branch has been answered; the score is re-checked on the new head)
  • I will address all Greptile and reviewer comments before requesting merge

@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 2/5

[Medium impact] The PR reaches Git-based payload builds and several bounded issue and execution workflows.

Do not merge yet: managed GitHub commands can still bypass their launchers, valid paths can break shell startup, and an accepted review transition can leave the reviewer asleep.

Findings

  1. P1 GitHub commands skip managed credentials ▶
  2. P1 Valid paths break shell startup ▶
  3. P1 Reviewer never gets woken ▶
  4. P2 Tests cross the size limit ▶
  5. P2 Tests stop before workspace preparation ▶
Fix with agent prompt
### Issue 1
packages/adapter-utils/src/execution-target.ts:1776-1777
If a login shell puts `/usr/bin` ahead of the launcher directory, this `case` guard leaves that order unchanged because the directory still appears in `PATH`. Then `git` and `gh` run the ordinary binaries instead of Paperclip's launchers. They miss the managed credentials and can fail authentication despite a configured GitHub connection.

Keep caller-added tool directories without letting an earlier `git` or `gh` hide the managed launchers.

### Issue 2
packages/adapter-utils/src/execution-target.ts:1772-1777
`launcherDirPattern` is inserted directly into shell source, but its escaping leaves quotes, dollar signs, and backticks untouched. The directory includes `remoteCwd` or the local temporary directory. If that path contains an apostrophe, such as `/srv/alice's-project`, every generated profile gets an unmatched quote. Child shells then cannot read the profile correctly, breaking shell setup and managed GitHub commands.

Match against the quoted `_paperclip_launcher_dir` variable instead of inserting the path as shell source.

### Issue 3
server/src/routes/issues.ts:4626-4635
The new guard accepts an unchanged assignee as a review handoff. An agent can PATCH an idle issue assigned to another agent from `todo` to `in_review`, without changing `assigneeAgentId` or adding a comment. This passes the ownership check, but the assignment wake requires a changed assignee, and the status wake does not cover this transition. The reviewer receives no request to act, so the issue can sit in review.

Require an actual handoff here, or wake the existing reviewer when accepting this transition.

### Issue 4
server/src/__tests__/execution-workspace-policy.test.ts:881-885
`execution-workspace-policy.test.ts` grows from 775 to 1,081 lines. The repository requires a concrete reason before a code file crosses 1,000 lines, and none is given here. Move the workspace inheritance tests into a focused test file, or explain why they must stay together. This repository requirement must be satisfied before merging.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

### Issue 5
server/src/__tests__/heartbeat-workspace-session.test.ts:1945-1954
The added dispatch tests call decision helpers but never run workspace preparation. They cannot show that a refused child gets separate files or that plugin preparation receives the corrected settings.

The heartbeat rule requires exercising the public heartbeat path and checking execution and saved outcomes, not only helper results. Add an assembled test that prepares a refused child's workspace and checks its saved workspace and files. This repository requirement must be satisfied before merging.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR prepares UI files and skills before packing Git installs, skips lifecycle scripts for staged bundles, and separates child issues from another issue's isolated workspace.

  • Git-based payload builds prepare package contents before staging.
  • Child issues get separate isolated workspaces while shared workspaces stay shared.
  • An agent can hand an in-review issue to a different agent.
  • GitHub launcher shells keep caller-added PATH entries.
  • Copilot binary copying accepts verified sources with writable modes.

Reviews (10) · Last reviewed commit: "Merge pull request #5 from jjude80/nexa/..." · Reviewed by Greptile

Comment thread server/src/services/heartbeat/queue.ts Resolved
Comment thread server/src/services/heartbeat/queue.ts Resolved
Comment thread cli/src/commands/install.ts Resolved
Comment thread server/src/services/issues.ts Resolved
An isolated execution workspace is one issue's worktree: one directory, one
branch, one index. A child of a decomposed parent inherited the parent's
workspace row, so six children of one decomposed parent were dispatched into the parent's
worktree and four runs were live in it at once. The cost was measured: a
whole-file write deleted another run's edits, git commit published every
staged path in the tree including another issue's, and the tree did not
build for reasons that belonged to neither run.

Two layers, because a creation-time rule alone does not cover an issue that
already points at somebody else's workspace.

1. Creation time (issues.ts). A child inherits the parent's mode and
   settings, but not the parent's workspace row when that row is an isolated
   workspace. A shared workspace is still inherited: sharing it is the point
   of it. A pinned existingBranch is stripped from inherited settings when
   the workspace is not bound, because a branch is the thing two issues
   must not share.

2. Dispatch time (heartbeat/workspaces.ts). The reuse request now carries
   the issue, the workspace mode and the workspace owner. Reusing an
   isolated workspace owned by a different issue is refused, and the refusal
   names the holder through conflictingWorkspaceOwnerIssueId. Recovery keeps
   its own workspace: a run that continues work already done in a tree is
   not a second issue joining it.

The refusal is loud. The queue preflight posts an issue comment naming the
holder issue, deduplicated by an HTML marker, so the run learns whose tree
it was about to write into instead of discovering it in a merge conflict.

Tests: execution-workspace-policy (50 cases), issues-service (32 workspace
cases), heartbeat-workspace-session (182 cases, including the new
conflict cases). Typecheck clean.
`paperclipai install --repo <owner/name> --ref <branch>` could not build a
payload at all: the server package ships the built UI inside it, and
prepare-bundled-package.mjs copies server/ui-dist into the staged package.
A fresh git checkout has no server/ui-dist -- it is produced by
scripts/prepare-server-ui-dist.sh, which the server package's own prepack
hook runs, and prepack only runs on `pnpm pack`. This flow stages the server
package directly, so the hook never fires and the packaging step died with

    Error: ENOENT: no such file or directory, lstat '.../source/server/ui-dist'

after the whole build had already run (~20 minutes).

Build the UI before the workspace packages are staged, the same way
scripts/release.sh does it before it packs. Without this, a fork branch
cannot be installed on an instance at all, which is the only supported way
to ship a fork build, and the managed install store's git source cannot be
used.

Test: cli/src/__tests__/install-command.test.ts now asserts the UI
preparation runs, and that it runs before prepare-bundled-package.mjs
stages the bundled package.
A review found a hole in the refusal: refusing the reuse of another issue's
isolated workspace is not enough on its own. A child that carries a pinned
workspaceStrategy.existingBranch still realizes into the holder's checkout,
because realization finds the worktree registered for that branch and reuses
it. The run was refused a workspace and then given the same tree by another
door.

The dispatch path now drops the pinned branch when the reuse was refused
because the workspace belongs to another issue, so the child derives its own
branch and its own worktree. The strategy config is resolved through
resolveExecutionWorkspaceStrategyConfig, which the workspace preparation uses
for the effective run config, the plugin preparation and the realization.

Tests: execution-workspace-policy covers the strategy resolution (a pinned
branch is dropped for a foreign owner, kept for the issue's own workspace, and
the whole strategy is dropped when the branch was all it held);
heartbeat-workspace-session covers the dispatch path, from the refusal through
the effective strategy the run realizes with.
…pace

The dispatch-time refusal stopped the local realization path from restoring
another issue's isolated workspace, and the pinned branch is dropped so the
child cannot find the holder's registered worktree by name.

The plugin preparation path still adopted the holder's workspace row.
prepareHeartbeatWorkspace passed issueRef.executionWorkspaceId to
preparePluginWorkspace, which restores that row and its saved provider
binding, so a refused child was handed the holder's storage through the
other door. The refusal now decides the workspace id that both preparation
paths use: a refused child gets no existing workspace id, and an issue that
owns its workspace keeps it.

The admission notice is emitted only for a refused reuse request, and it
states what was observed instead of promising a replacement. The duplicate
check asks the database for a bounded match instead of loading every
comment body of the issue into the process.

Tests: the policy suite covers the workspace id decision and the notice
rule, and the workspace session suite covers the id the plugin preparation
receives for a refused child and for an issue that owns its workspace.
@jjude80
jjude80 force-pushed the fix/git-install-ui-dist branch from 56e170f to 774f7ae Compare October 22, 2026 22:35
@jjude80

jjude80 commented Oct 22, 2026

Copy link
Copy Markdown
Author

Correction to the reply above about code comments: that claim was checked against an unpushed working tree, not the branch, and it was wrong. The branch history is rewritten and the head is now 774f7aed.

git show 774f7aed:cli/src/commands/install.ts and the install-command test add no code comments; the reasoning is in the pull request description. The previous head 56e170fa did still carry seven added comment lines in install.ts and three in the test, so the reviewer's finding was correct for that head.

Comment thread cli/src/commands/install.ts Resolved
@jjude80

jjude80 commented Oct 22, 2026

Copy link
Copy Markdown
Author

CI status on 774f7aed: 97 checks pass. One fails — ci / e2e shard (5/8) — on tests/e2e/cases-read-only.spec.ts, at the assertion that the case-list filter button shows the selected option:

Error: expect(locator).toHaveText(expected) failed
Timeout: 5000ms
> 92 | await expect(page.getByRole("button", { name: `Filter by ${filter}`, exact: true })).toHaveText(option);

The tree is identical to 56e170fa apart from removed code comments, so there is no logic difference between the head that passed this shard and the head that failed it. The e2e config sets retries: 0, so one timing failure reds the shard. The job cannot be re-run from a fork, so this needs a maintainer re-run rather than a code change here.

jjude80 and others added 4 commits October 23, 2026 02:10
A child task inherits its parent's workspace settings but gets its own
worktree. The inherited strategy had no base ref, so the new worktree was
cut from the project default (origin/main). When the parent's work lives on
an integration branch, the child's tree cannot contain the files the task
is about, and the child waits on a baseline that can never go red.

Carry the parent workspace's branch to the child as workspaceStrategy.baseRef,
and keep a pinned existingBranch as the base ref when the pin has to be
dropped because the workspace belongs to another issue.
A git install stages the server package and packs it directly, which skips
three steps scripts/release.sh performs before packing:

- stage the repository-level skills tree into the packages that publish it,
  so prepare-bundled-package.mjs does not fail on a missing server/skills;
- normalize workspace package versions, so a workspace dependency does not
  materialize to the depending package's version and fail npm install with
  ETARGET;
- pass --ignore-scripts to npm pack on the staged bundled package, because
  the staged manifest keeps the server prepack and its script path does not
  exist beside the staged package.

Tests assert each step and that both staging steps run before the first pack.
NEXA-482: base a child task on its parent integration branch
…isolation

fix(workspace): base a child task on its parent's integration branch (NEXA-482)
Comment on lines +1945 to +1954
expect(reuseRequest.requestedShouldReuseExisting).toBe(false);
expect(resolveExecutionWorkspaceStrategyConfig({
config: {
mode: "isolated_workspace",
workspaceStrategy: { type: "git_worktree", existingBranch: "holder-branch" },
},
conflictingWorkspaceOwnerIssueId: reuseRequest.conflictingWorkspaceOwnerIssueId,
})).toEqual({
mode: "isolated_workspace",
workspaceStrategy: { type: "git_worktree", baseRef: "holder-branch" },

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.

P2 Tests stop before workspace preparation

The added dispatch tests call decision helpers but never run workspace preparation. They cannot show that a refused child gets separate files or that plugin preparation receives the corrected settings.

The heartbeat rule requires exercising the public heartbeat path and checking execution and saved outcomes, not only helper results. Add an assembled test that prepares a refused child's workspace and checks its saved workspace and files. This repository requirement must be satisfied before merging.

File Used: rules/heartbeat-execution-boundaries.mdc (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: server/src/__tests__/heartbeat-workspace-session.test.ts
Line: 1945-1954

Comment:
**Tests stop before workspace preparation**

The added dispatch tests call decision helpers but never run workspace preparation. They cannot show that a refused child gets separate files or that plugin preparation receives the corrected settings.

The heartbeat rule requires exercising the public heartbeat path and checking execution and saved outcomes, not only helper results. Add an assembled test that prepares a refused child's workspace and checks its saved workspace and files. This repository requirement must be satisfied before merging.

**File Used:** `rules/heartbeat-execution-boundaries.mdc` ([source](https://github.com/paperclipai/paperclip/blob/7d4d66769006966ed37f7f9e812e7f84f368382e/rules/heartbeat-execution-boundaries.mdc))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

… owned target

npm extracts the vendored @github/copilot-linux-x64 package using the ambient
umask. Agent shells and paperclipai.service run with umask 0002, so the
pinned executable lands 0775 and the payload postinstall rejected it before
copying it anywhere:

  Error: Copilot executable has unsafe permissions

The materializer verifies the source bytes against a SHA-256 pin and writes
them to an output directory it exclusively creates, then fchmods 0755. In
that path the source mode is not something the output inherits, so a
group/world writable source is safe. The check still rejects a writable
source for in-place materialization (the bytes are then launched from where
they were found) and still rejects any source without an execute bit.
The managed GitHub launcher profile exported PATH as a fixed value, so
every non-interactive bash that sourced it lost any directory the caller
had prepended. Build steps that provision a tool by prepending a shim
directory then failed with 'command not found' for an installed tool.

Keep the inherited PATH and only move the launcher directory to the
front, deduplicated so nested shells do not grow PATH. Fall back to the
launch PATH only when the shell has no PATH at all.

Regression test runs a real child bash and asserts a caller-prepended
directory survives and the launcher directory appears once.
Comment on lines +1776 to +1777
`case ":\${PATH-}:" in`,
` *:${launcherDirPattern}:*) ;;`,

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.

P1 GitHub commands skip managed credentials

If a login shell puts /usr/bin ahead of the launcher directory, this case guard leaves that order unchanged because the directory still appears in PATH. Then git and gh run the ordinary binaries instead of Paperclip's launchers. They miss the managed credentials and can fail authentication despite a configured GitHub connection.

Keep caller-added tool directories without letting an earlier git or gh hide the managed launchers.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/adapter-utils/src/execution-target.ts
Line: 1776-1777

Comment:
**GitHub commands skip managed credentials**

If a login shell puts `/usr/bin` ahead of the launcher directory, this `case` guard leaves that order unchanged because the directory still appears in `PATH`. Then `git` and `gh` run the ordinary binaries instead of Paperclip's launchers. They miss the managed credentials and can fail authentication despite a configured GitHub connection.

Keep caller-added tool directories without letting an earlier `git` or `gh` hide the managed launchers.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +1772 to +1777
const launcherDirPattern = directory.replace(/[\\*?[\]]/g, "\\$&");
const fallbackPath = basePath || "/usr/bin:/bin";
const restoreLauncherPath = [
`_paperclip_launcher_dir=${shellQuote(directory)}`,
`case ":\${PATH-}:" in`,
` *:${launcherDirPattern}:*) ;;`,

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.

P1 Valid paths break shell startup

launcherDirPattern is inserted directly into shell source, but its escaping leaves quotes, dollar signs, and backticks untouched. The directory includes remoteCwd or the local temporary directory. If that path contains an apostrophe, such as /srv/alice's-project, every generated profile gets an unmatched quote. Child shells then cannot read the profile correctly, breaking shell setup and managed GitHub commands.

Match against the quoted _paperclip_launcher_dir variable instead of inserting the path as shell source.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/adapter-utils/src/execution-target.ts
Line: 1772-1777

Comment:
**Valid paths break shell startup**

`launcherDirPattern` is inserted directly into shell source, but its escaping leaves quotes, dollar signs, and backticks untouched. The directory includes `remoteCwd` or the local temporary directory. If that path contains an apostrophe, such as `/srv/alice's-project`, every generated profile gets an unmatched quote. Child shells then cannot read the profile correctly, breaking shell setup and managed GitHub commands.

Match against the quoted `_paperclip_launcher_dir` variable instead of inserting the path as shell source.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

jjude80 and others added 2 commits October 25, 2026 23:32
buildInheritedExecutionWorkspaceSettings copied the parent workspace's
current branch into a child issue's baseRef for every git_worktree
parent. A runtime-created branch is deleted when the parent workspace is
reclaimed, so a child dispatched after the parent lands fails pre-adapter
with workspace_base_ref_unresolved and strands itself at blocked with no
cause on the thread (NEXA-569/573/574).

Only inherit the branch when it outlives the parent: an operator-owned
branch (or a legacy unmarked row, whose branch cleanup deliberately
skips). A runtime-owned branch now falls back to the source workspace's
own durable baseRef, which is the same retarget a human performs by hand
on a stranded child. Integration-branch inheritance is unchanged.

Regression tests cover the transient-branch fallback at the policy level
and through issueService.create.
An agent-authored update that moved an issue to in_review was refused unless
one of five review paths was present, and none of them could name another
agent. The NEXA-415 contract ends in a review by an agent (Part E), so the
implementer either left the card in_progress or manufactured an unaddressed
interaction to satisfy the validator.

Accept an assignee agent other than the acting agent as a review path. That
assignee is the owner shown on the card, and the existing assignee-change
wake routes the hand-off to them, so the reviewer really is the next actor.
A self-assignment is not a hand-off and still fails the check.

The 422 now lists agent_assignee_agent_id among validReviewPaths and the
message explains the assigneeAgentId hand-off.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Comment on lines +4626 to +4635
const nextAssigneeAgentId =
input.updateFields.assigneeAgentId === undefined
? input.existing.assigneeAgentId
: input.updateFields.assigneeAgentId;
if (
typeof nextAssigneeAgentId === "string" &&
nextAssigneeAgentId.trim().length > 0 &&
nextAssigneeAgentId !== input.actorAgentId
)
return null;

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.

P1 Reviewer never gets woken

The new guard accepts an unchanged assignee as a review handoff. An agent can PATCH an idle issue assigned to another agent from todo to in_review, without changing assigneeAgentId or adding a comment. This passes the ownership check, but the assignment wake requires a changed assignee, and the status wake does not cover this transition. The reviewer receives no request to act, so the issue can sit in review.

Require an actual handoff here, or wake the existing reviewer when accepting this transition.

Knowledge Base Used: Issue execution and collaboration

Prompt To Fix With AI
This is a comment left during a code review.
Path: server/src/routes/issues.ts
Line: 4626-4635

Comment:
**Reviewer never gets woken**

The new guard accepts an unchanged assignee as a review handoff. An agent can PATCH an idle issue assigned to another agent from `todo` to `in_review`, without changing `assigneeAgentId` or adding a comment. This passes the ownership check, but the assignment wake requires a changed assignee, and the status wake does not cover this transition. The reviewer receives no request to act, so the issue can sit in review.

Require an actual handoff here, or wake the existing reviewer when accepting this transition.

**Knowledge Base Used:** [Issue execution and collaboration](https://app.greptile.com/paperclip-org-3/-/custom-context/knowledge-base/paperclipai/paperclip/-/docs/issue-execution.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

fix(workspace): stop basing a child on a branch the parent deletes
Comment on lines +881 to +885
it("bases a child on the parent's durable base, not a transient runtime branch", () => {
// The parent workspace created its own task branch. That branch is deleted
// when the parent is reclaimed, so a child that has not started yet would
// otherwise fail with workspace_base_ref_unresolved. Base it on the ref the
// parent itself started from instead.

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.

P2 Tests cross the size limit

execution-workspace-policy.test.ts grows from 775 to 1,081 lines. The repository requires a concrete reason before a code file crosses 1,000 lines, and none is given here. Move the workspace inheritance tests into a focused test file, or explain why they must stay together. This repository requirement must be satisfied before merging.

Context Used: CONTRIBUTING.md has a guide for a good PR message including a "thinking path". If the PR doesn't include a "thinking path" and "details about what you did, why you did it, why it matters & the benefits, how we can verify it works, and any risks", the... (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: server/src/__tests__/execution-workspace-policy.test.ts
Line: 881-885

Comment:
**Tests cross the size limit**

`execution-workspace-policy.test.ts` grows from 775 to 1,081 lines. The repository requires a concrete reason before a code file crosses 1,000 lines, and none is given here. Move the workspace inheritance tests into a focused test file, or explain why they must stay together. This repository requirement must be satisfied before merging.

**Context Used:** CONTRIBUTING.md has a guide for a good PR message including a "thinking path". If the PR doesn't include a "thinking path" and "details about what you did, why you did it, why it matters &amp; the benefits, how we can verify it works, and any risks", the... ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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