Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(control): the --issue gate defers to the path for a source still loading

review17d718ea99d0
diff --git a/src/renderer/lib/issueFlag.test.ts b/src/renderer/lib/issueFlag.test.ts
index 4d09a05dc..801c7b508 100644
--- a/src/renderer/lib/issueFlag.test.ts
+++ b/src/renderer/lib/issueFlag.test.ts
@@ -150,6 +150,18 @@ describe('resolveIssueFlagForCall (the gates run before anybody is asked)', () =
expect(ask).not.toHaveBeenCalled()
})
+ it('never refuses a source on the ACTIVE project that is not on the live canvas yet', async () => {
+ // The boot load is still in flight: the path waits for the live node, whose agent id the load
+ // may still have to MIGRATE (a legacy `tags:['claude']` node has no stored agentId). The gate
+ // must not be stricter than that path, so it resolves against the active project and leaves
+ // the capability verdict to it.
+ const ask = vi.fn(async () => 'o/r')
+ const legacy = [{ id: 'mine', nodes: [{ id: 'booting' }], kanban: board }]
+ expect(await resolveIssueFlagForCall(call({ sourceNodeId: 'booting', liveNodes: [], projects: legacy }), ask))
+ .toMatchObject({ ok: true })
+ expect(ask).toHaveBeenCalledWith('mine')
+ })
+
it('leaves an open without --issue to the paths (no gate, nobody asked)', async () => {
const ask = vi.fn(async () => 'o/r')
expect(await resolveIssueFlagForCall(call({ raw: undefined, sourceNodeId: 'ghost' }), ask)).toEqual({ ok: true })
diff --git a/src/renderer/lib/issueFlag.ts b/src/renderer/lib/issueFlag.ts
index 6d3060b9e..86d1c6be8 100644
--- a/src/renderer/lib/issueFlag.ts
+++ b/src/renderer/lib/issueFlag.ts
@@ -47,10 +47,12 @@ export async function resolveIssueFlagFor(
/**
* `resolveIssueFlagFor`, behind the renderer's authorization belt. A `#N` lookup runs the GitHub
* host controller for a project (`git remote`, `gh auth`) and its answer tells the caller whether
- * that project has a board — so it runs only for a call the open paths would ACCEPT: a source that
+ * that project has a board — so it runs only for a caller the open paths AUTHORIZE: a source that
* is a known control-capable agent, and a `--project` target `resolveProjectTarget` allows (the very
- * call the `--project` path makes). A call the paths would refuse is refused HERE, with the path's
- * own sentence, before anybody is asked. Main's `gateProjectTarget` (identity + own-or-granted) has
+ * call the `--project` path makes). A caller they would refuse is refused HERE, with the path's own
+ * sentence, before anybody is asked. Argument-shape refusals (`--dry-run` with `--project`, a
+ * `--group`/`--after` into another project, `--run-now` with `--after`) still come from the paths,
+ * after this; they say nothing about who may look at which project. Main's `gateProjectTarget` (identity + own-or-granted) has
* already run on the desktop; this is the renderer not depending on it, the order the Server
* Edition keeps too. It stays ahead of the paths because each of them snapshots the projects store
* synchronously, and an await inside one lets a tab switch land in between (#443 class).
@@ -115,10 +117,15 @@ function issueFlagScope<P extends ProjectTargetProject & ControlProject>(input:
if (route.kind === 'unknown' || route.kind === 'blocked') {
return { ok: false, error: 'source node is not on an open canvas' }
}
- const ownerId = route.kind === 'active' ? input.activeProjectId : route.projectId
- const stored = input.projects.find((project) => project.id === ownerId)?.nodes
+ // On the active project but not on the live canvas yet (the boot load is in flight): the path
+ // waits for the live node and judges ITS agent id, which the load may still have to migrate (a
+ // legacy `tags:['claude']` node stores none). The source is the caller's own project either way,
+ // so this gate defers to that verdict rather than being stricter than it.
+ if (route.kind === 'active') return { ok: true, projectId: input.activeProjectId }
+ const stored = input.projects.find((project) => project.id === route.projectId)?.nodes
.find((node) => node.id === input.sourceNodeId)
+ // The cold-open path judges the SERIALIZED node, exactly as here.
return stored && sourceIsControlCapable(stored.agentId)
- ? { ok: true, projectId: ownerId }
+ ? { ok: true, projectId: route.projectId }
: { ok: false, error: 'source node is not a control-capable agent' }
}