opencode-pilot 0.24.7 → 0.24.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
class OpencodePilot < Formula
|
|
2
2
|
desc "Automation daemon for OpenCode - polls GitHub/Linear issues and spawns sessions"
|
|
3
3
|
homepage "https://github.com/athal7/opencode-pilot"
|
|
4
|
-
url "https://github.com/athal7/opencode-pilot/archive/refs/tags/v0.24.
|
|
5
|
-
sha256 "
|
|
4
|
+
url "https://github.com/athal7/opencode-pilot/archive/refs/tags/v0.24.8.tar.gz"
|
|
5
|
+
sha256 "23b550fd74fee8f2fd8c60c8358f67065ee77af921fdc3bc2ff26a6cfef68ae6"
|
|
6
6
|
license "MIT"
|
|
7
7
|
|
|
8
8
|
depends_on "node"
|
package/package.json
CHANGED
package/service/actions.js
CHANGED
|
@@ -882,10 +882,15 @@ async function executeInDirectory(serverUrl, cwd, item, config, options = {}, pr
|
|
|
882
882
|
}
|
|
883
883
|
}
|
|
884
884
|
|
|
885
|
-
// Check if we should try to reuse an existing session
|
|
885
|
+
// Check if we should try to reuse an existing session.
|
|
886
|
+
// Skip reuse when working in a worktree (projectDirectory differs from cwd),
|
|
887
|
+
// because querying by worktree dir finds old sessions with projectID "global",
|
|
888
|
+
// and querying by project dir finds unrelated sessions for other PRs.
|
|
889
|
+
// Each worktree should get its own correctly-scoped session.
|
|
886
890
|
const reuseActiveSession = config.reuse_active_session !== false; // default true
|
|
891
|
+
const inWorktree = projectDirectory && projectDirectory !== cwd;
|
|
887
892
|
|
|
888
|
-
if (reuseActiveSession && !options.dryRun) {
|
|
893
|
+
if (reuseActiveSession && !inWorktree && !options.dryRun) {
|
|
889
894
|
const existingSession = await findReusableSession(serverUrl, cwd, { fetch: options.fetch });
|
|
890
895
|
|
|
891
896
|
if (existingSession) {
|
|
@@ -621,6 +621,64 @@ describe("integration: worktree creation with worktree_name", () => {
|
|
|
621
621
|
// Session creation uses the project directory (for correct projectID scoping)
|
|
622
622
|
assert.strictEqual(sessionDirectory, "/proj", "Session should be scoped to project directory");
|
|
623
623
|
});
|
|
624
|
+
|
|
625
|
+
it("skips session reuse when working in a worktree", async () => {
|
|
626
|
+
// When working in a worktree (projectDirectory differs from cwd), session
|
|
627
|
+
// reuse is skipped entirely. Querying by worktree dir finds old sessions
|
|
628
|
+
// with projectID "global", querying by project dir finds unrelated sessions
|
|
629
|
+
// for other PRs. Each worktree should get its own correctly-scoped session.
|
|
630
|
+
|
|
631
|
+
let sessionListQueried = false;
|
|
632
|
+
let sessionCreated = false;
|
|
633
|
+
let sessionCreateDirectory = null;
|
|
634
|
+
|
|
635
|
+
const existingWorktreeDir = "/worktree/calm-wizard";
|
|
636
|
+
|
|
637
|
+
mockServer = await createMockServer({
|
|
638
|
+
"GET /project": () => ({
|
|
639
|
+
body: [{ id: "proj_1", worktree: "/proj", sandboxes: [], time: { created: 1 } }],
|
|
640
|
+
}),
|
|
641
|
+
"GET /project/current": () => ({
|
|
642
|
+
body: { id: "proj_1", worktree: "/proj", sandboxes: [], time: { created: 1 } },
|
|
643
|
+
}),
|
|
644
|
+
"GET /experimental/worktree": () => ({
|
|
645
|
+
body: [existingWorktreeDir],
|
|
646
|
+
}),
|
|
647
|
+
"GET /session": () => {
|
|
648
|
+
sessionListQueried = true;
|
|
649
|
+
return { body: [] };
|
|
650
|
+
},
|
|
651
|
+
"GET /session/status": () => ({ body: {} }),
|
|
652
|
+
"POST /session": (req) => {
|
|
653
|
+
sessionCreated = true;
|
|
654
|
+
sessionCreateDirectory = req.query?.directory;
|
|
655
|
+
return { body: { id: "ses_new" } };
|
|
656
|
+
},
|
|
657
|
+
"PATCH /session/ses_new": () => ({ body: {} }),
|
|
658
|
+
"POST /session/ses_new/message": () => ({ body: { success: true } }),
|
|
659
|
+
"POST /session/ses_new/command": () => ({ body: { success: true } }),
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
const result = await executeAction(
|
|
663
|
+
{ number: 42, title: "Review PR" },
|
|
664
|
+
{
|
|
665
|
+
path: "/proj",
|
|
666
|
+
prompt: "review",
|
|
667
|
+
worktree_name: "pr-{number}",
|
|
668
|
+
existing_directory: existingWorktreeDir,
|
|
669
|
+
},
|
|
670
|
+
{ discoverServer: async () => mockServer.url }
|
|
671
|
+
);
|
|
672
|
+
|
|
673
|
+
assert.ok(result.success, "Action should succeed");
|
|
674
|
+
// Should NOT query for existing sessions when in a worktree
|
|
675
|
+
assert.strictEqual(sessionListQueried, false,
|
|
676
|
+
"Should skip session reuse entirely when in a worktree");
|
|
677
|
+
// Should create a new session scoped to the project directory
|
|
678
|
+
assert.ok(sessionCreated, "Should create a new session");
|
|
679
|
+
assert.strictEqual(sessionCreateDirectory, "/proj",
|
|
680
|
+
"New session should be scoped to project directory");
|
|
681
|
+
});
|
|
624
682
|
});
|
|
625
683
|
|
|
626
684
|
describe("integration: cross-source deduplication", () => {
|