Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: detach quality snapshot publisher worktrees

[._.]/ Adam Eivy0f71c1fa6ab7
diff --git a/server/services/appQualitySnapshotFile.js b/server/services/appQualitySnapshotFile.js
index eab58b1878..21629f43cf 100644
--- a/server/services/appQualitySnapshotFile.js
+++ b/server/services/appQualitySnapshotFile.js
@@ -186,7 +186,10 @@ async function landSnapshotPr(app, { body, count, defaultBranch, git, deps }) {
const run = async () => {
const baseRef = `origin/${defaultBranch}`;
await addWorktree(
- ['worktree', 'add', '--no-track', '-B', QUALITY_SNAPSHOT_BRANCH, worktreePath, baseRef],
+ // Keep the PR branch free for an in-flight merge/review follow-up. The
+ // publisher pushes detached HEAD to the stable remote branch below, so
+ // the temporary checkout must not claim that branch locally.
+ ['worktree', 'add', '--detach', worktreePath, baseRef],
app.repoPath,
);
await (deps.writeFile || atomicWrite)(join(worktreePath, APP_QUALITY_SNAPSHOT_FILENAME), body);
diff --git a/server/services/appQualitySnapshotFile.test.js b/server/services/appQualitySnapshotFile.test.js
index a23e3f78c6..5ca60daa09 100644
--- a/server/services/appQualitySnapshotFile.test.js
+++ b/server/services/appQualitySnapshotFile.test.js
@@ -72,7 +72,7 @@ it('reads a committed snapshot and answers null for every unusable file', async
expect(QUALITY_SNAPSHOT_BRANCH).toBe('portos/quality-snapshot');
});
-it('lands a changed snapshot on a dedicated branch PR and queues merge-on-green', async () => {
+it('lands a changed snapshot from a detached worktree so the PR branch stays attachable', async () => {
const deps = testDeps();
expect(await publishAppQualitySnapshot(app, deps)).toEqual({
published: true, hash: 'abc1234', path: '.quality.json',
@@ -84,7 +84,7 @@ it('lands a changed snapshot on a dedicated branch PR and queues merge-on-green'
expect(body.endsWith('\n')).toBe(true);
expect(body).not.toMatch(/Users|summary|app_id|agent-|github/);
expect(deps.addWorktree).toHaveBeenCalledWith(
- ['worktree', 'add', '--no-track', '-B', 'portos/quality-snapshot', worktreePath, 'origin/main'],
+ ['worktree', 'add', '--detach', worktreePath, 'origin/main'],
'/repo/example-app',
);
expect(deps.git.stageFiles).toHaveBeenCalledWith(worktreePath, ['.quality.json']);