Repository navigation
Run the repo's Custom GitHub Issue Command when starting a workspace from an issue - #6827
Conversation
…from an issue The one-click "Start workspace from issue" button never ran a repo's Custom GitHub Issue Command, while the New Workspace composer does. Resolve the repo's issue command on the quick-create background path and run it as a trust-gated side-pane split, mirroring the composer. Only GitHub issues on git repos run it (PRs/Linear excluded). Trust gating mirrors the composer: a declined setup-trust skips it; shared orca.yaml commands prompt via the existing confirmation modal; local .orca/issue-command overrides auto-run. Reads fail closed so workspace creation still proceeds. The seeded agent prompt is unchanged (stays the bare issue link). Co-authored-by: Orca <[email protected]>
📝 WalkthroughWalkthroughAn optional 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 1d7ef9b9-ae63-4a48-b98e-a50217a04b90
📒 Files selected for processing (5)
src/renderer/src/lib/github-work-item-background-create.test.tssrc/renderer/src/lib/github-work-item-background-create.tssrc/renderer/src/lib/pending-worktree-creation.tssrc/renderer/src/lib/worktree-creation-flow.test.tssrc/renderer/src/lib/worktree-creation-flow.ts
A declined setup-trust decision also skips the issue command, so guard the whole branch on trustDecision !== 'skip' before the up-to-15s read instead of reading just to drop the result. Stops a declined trust from stalling workspace creation. (CodeRabbit) Co-authored-by: Orca <[email protected]>
Review fixes: - Runtime-owned worktrees mirror session tabs asynchronously, so the setup/issue-command delivery in ensureWorktreeHasInitialTerminal found no tab right after create and silently dropped the commands. Hold them in a delayed-delivery queue (mirroring agent-startup-delayed-delivery) until the first mirrored tab lands. - Both trust checks in the quick-create flow re-read the store at call time so an "Always trust" stamped by the setup prompt (or a concurrent create) short-circuits the issue-command prompt instead of re-prompting from the pre-prompt snapshot. Co-authored-by: Orca <[email protected]>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/lib/hook-command-delayed-delivery.ts (1)
32-39: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueConsider a selector-based subscription instead of subscribing to the whole store.
useAppStore.subscribe(() => flushPendingHookCommandDeliveries())fires on every store mutation, not justtabsByWorktreechanges. IfsubscribeWithSelectormiddleware is already applied to this store, selectingtabsByWorktreewould avoid scanning the pending map on unrelated updates. Low priority given the map is typically empty/small.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 64b3523c-2b23-4292-96a8-f2a60d29c6ad
📒 Files selected for processing (6)
src/renderer/src/lib/github-work-item-background-create.test.tssrc/renderer/src/lib/github-work-item-background-create.tssrc/renderer/src/lib/hook-command-delayed-delivery.test.tssrc/renderer/src/lib/hook-command-delayed-delivery.tssrc/renderer/src/lib/worktree-activation.test.tssrc/renderer/src/lib/worktree-activation.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/renderer/src/lib/github-work-item-background-create.ts
- src/renderer/src/lib/github-work-item-background-create.test.ts
…mmand-consistency
…very tests Post-merge adjustments: executeWorktreeCreation now flows through prepareRequestForCreate (#6320), so thread issueCommand from the prepared request, and assert delivery via vi.waitFor — the fixed two-tick flush starved once main added awaits ahead of the activation branches, which is exactly how the merge-build verify check failed. Co-authored-by: Orca <[email protected]>
…from an issue (stablyai#6827) Co-authored-by: Orca <[email protected]>
ELI5
Repos can configure a small shell script (the Custom GitHub Issue Command) that runs in a side pane whenever you start working from a GitHub issue. The New Workspace composer used to run it, but that path was switched off in May when the composer became quick-create-only (
#1985) — so lately nothing ran the script. This PR makes the one-click "start workspace from issue" button run it.The safety rules are the ones the composer's automation used: nothing runs if the repo hasn't configured a script, scripts from the repo's shared
orca.yamlask for your approval first, and if you already declined trust, it stays skipped. The instructions given to the AI agent don't change at all — it still just gets the issue link; the only new thing is that the repo's script now also runs.What changes
The one-click "Start workspace from issue" button now runs the repo's Custom GitHub Issue Command as a trust-gated side-pane split when you start a workspace from a GitHub issue, using the same trust gating and delivery seam the composer's issue automation used. Note (correcting an earlier version of this description): the composer's automation is currently disabled at its only mount (
enableIssueAutomation: falseinNewWorkspaceComposerModal, since#1985), so at HEAD no surface ran the script at all — this PR makes the quick button the first surface to run it again.What does NOT change
The seeded agent prompt for the quick button stays the bare issue link (it is not rewritten to
Complete <url>). This PR only adds running the configured issue-command shell script; it does not alter the agent's prompt text.Behavior details
.orca/issue-commandlocal override, or sharedorca.yaml). No config → nothing runs.orca.yamlcommands prompt via the existingconfirm-orca-yaml-hooksmodal (once per content version); local.orca/issue-commandoverrides auto-run (user-owned). Reads fail closed — a read error means no command runs and workspace creation still proceeds.queueTabIssueCommandSplitpath, threaded into both activation branches (activateAndRevealWorktreewhen the user is watching, andensureWorktreeHasInitialTerminalwhen they've moved on — the common one-click case).hook-command-delayed-deliverymodule (mirroringagent-startup-delayed-delivery's lazy-subscription shape) holds setup/issue commands until the first mirrored tab lands, and drops them if the worktree disappears first.Design approach
Resolve the issue command on the quick-create background path (
createGitHubWorkItemWorkspaceInBackground) right after the existing setup/PR/agent preflight, reusing the setup trust decision and the existingensureHooksConfirmed(..., 'issueCommand')trust check. Carry the rendered command onWorktreeCreationRequest.issueCommandand deliver it fromexecuteWorktreeCreationinto both activation branches. No new IPC or schema — reusesreadRuntimeIssueCommandand the existing split-pane delivery seam.Scope note (interpretation Brennan should see)
The original issue could be read two ways. Confirmed direction: keep the quick-start agent prompt as the bare link; the fix is that the Custom GitHub Issue Command script now runs when starting from an issue. The earlier "seed the prompt with
Complete <url>" interpretation was explicitly rejected and is not in this PR.Open question for Brennan: the composer modal — which is also this quick path's fallback when preflight can't background (repo missing, host unavailable, setup needs answers, agent startup failure) — still does not run issue commands: its automation flag is off and its live
submitQuickpath never resolves one. So after this PR, the same "start from this issue" intent runs the script from the quick button but not from the modal. The newWorktreeCreationRequest.issueCommandplumbing already supports the modal (it submits through the sameexecuteWorktreeCreation), so givingsubmitQuickthe same resolve+trust+attach block is a small follow-up if you want full parity — deliberately not smuggled into this PR.Validation
.orca/issue-commandspawned a side-pane split that ran the rendered command ({{issue}}/{{artifact_url}}substituted), while the primary agent pane's prompt stayed the bare issue URL.submitShouldRunIssueAutomation+issueCommanddelivery (that code path is currently disabled at its mount — see the open question above).ensureHooksConfirmedsignature to remove. Known TOCTOU footnote: iforca.yamlchanges between those two back-to-back reads, the trust dialog shows the newer content while the older read runs — same-shaped (and much narrower) window than the composer's read-at-open/trust-at-submit behavior.github-work-item-background-create.test.ts,worktree-creation-flow.test.ts,worktree-activation.test.ts, and the newhook-command-delayed-delivery.test.ts(delayed delivery: holds-then-delivers-once, immediate-delivery, drops-when-worktree-gone; plus trust-snapshot freshness). Typecheck and lint clean; full suite green locally on the merged tree apart from a WSL daemon test that is byte-identical to main and fails there too on macOS.verifyfailure came from testing the merge ref — main's#6320added awaits ahead of the activation branches inexecuteWorktreeCreation, starving this branch's fixed two-tick test flush. Merged main in, threadedissueCommandfrompreparedRequest, and switched the two delivery tests tovi.waitFor(the file's post-#6320convention) so await-count drift can't silently starve them again.SSH / cross-platform
readRuntimeIssueCommandand the trust check already route by repo-owner host (local IPC vs runtime RPC), so SSH/runtime repos resolve the command on the correct host. SSH repos deliver through the normal local tab-creation path. Runtime-owned repos deliver through the new delayed-delivery queue once their session tabs mirror in (this was the review-found drop, now fixed and unit-tested). No new platform-specific code; command rendering is string substitution and the shell launch reuses the same downstream path as the composer.Remaining gaps
Made with Orca 🐋