{"record":{"id":"54dda3dd1a260327","repo":"stablyai/orca","slug":"setup-decision-required-for-this-repository","errorCode":null,"errorMessage":"Setup decision required for this repository","messagePattern":"Setup decision required for this repository","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/hooks.ts","lineNumber":266,"sourceCode":"  const hooksRoot = worktreePath ?? repo.path\n  return getEffectiveHooksFromConfig(repo, loadHooks(hooksRoot))\n}\n\nexport function getEffectiveSetupRunPolicy(repo: Repo): SetupRunPolicy {\n  return repo.hookSettings?.setupRunPolicy ?? getDefaultRepoHookSettings().setupRunPolicy!\n}\n\nexport function shouldRunSetupForCreate(repo: Repo, decision: SetupDecision = 'inherit'): boolean {\n  if (decision === 'run') {\n    return true\n  }\n  if (decision === 'skip') {\n    return false\n  }\n\n  const policy = getEffectiveSetupRunPolicy(repo)\n  if (policy === 'ask') {\n    throw new Error('Setup decision required for this repository')\n  }\n\n  return policy === 'run-by-default'\n}\n\nexport function getDefaultTabCommandTrustContent(hooks: OrcaHooks | null): string {\n  const commands = (hooks?.defaultTabs ?? [])\n    .map((tab, index) => {\n      const command = tab.command?.trim()\n      if (!command) {\n        return null\n      }\n      const label = tab.title ? ` ${tab.title}` : ''\n      return `# defaultTabs[${index + 1}]${label}\\n${command}`\n    })\n    .filter((entry): entry is string => entry !== null)\n  return [hooks?.scripts.setup?.trim(), ...commands].filter(Boolean).join('\\n\\n')\n}","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/hooks.ts#L248-L284","documentation":"Thrown by shouldRunSetupForCreate when the caller passes decision 'inherit' (the default) but the repository's effective setupRunPolicy is 'ask' — meaning setup must not run or skip automatically. The function refuses to guess because running setup scripts (which can execute arbitrary commands) without explicit consent is a security/trust hazard. The caller must supply an explicit 'run' or 'skip' decision.","triggerScenarios":"Creating a workspace/repo with decision defaulted to 'inherit' while repo.hookSettings.setupRunPolicy (or the global default) resolves to 'ask'. Happens when an automated caller (e.g. an automation/loop driver) invokes shouldRunSetupForCreate without first prompting the user for a setup decision.","commonSituations":"User configured a repo to 'ask' before running setup; an automation flow calling repo-create without a UI prompt; fresh install where the global default policy is 'ask'; a script that批量 creates workspaces but doesn't thread a decision through.","solutions":["Pass an explicit decision: shouldRunSetupForCreate(repo, 'run') or shouldRunSetupForCreate(repo, 'skip').","If the caller has a UI, prompt the user for the setup decision whenever getEffectiveSetupRunPolicy(repo) === 'ask' before calling.","Change the repo's setupRunPolicy to 'run-by-default' or 'skip-by-default' if 'ask' is undesired."],"exampleFix":"// before\nconst runSetup = shouldRunSetupForCreate(repo) // decision defaults to 'inherit'\n// after\nconst policy = getEffectiveSetupRunPolicy(repo)\nconst decision: SetupDecision = policy === 'ask' ? await promptUserForSetupDecision(repo) : 'inherit'\nconst runSetup = shouldRunSetupForCreate(repo, decision)","handlingStrategy":"validation","validationCode":"function resolveSetupDecision(repo: Repo, uiDecision?: SetupDecision): SetupDecision {\n  if (uiDecision === 'run' || uiDecision === 'skip') return uiDecision\n  const policy = getEffectiveSetupRunPolicy(repo)\n  if (policy === 'ask' && !uiDecision) {\n    throw new Error('UI must collect a setup decision before create')\n  }\n  return 'inherit'\n}","typeGuard":"function isExplicitDecision(decision: unknown): decision is 'run' | 'skip' {\n  return decision === 'run' || decision === 'skip'\n}","tryCatchPattern":"let decision: SetupDecision = 'inherit'\nif (getEffectiveSetupRunPolicy(repo) === 'ask') {\n  decision = await ui.promptSetupDecision() // returns 'run' | 'skip'\n}\nconst runSetup = shouldRunSetupForCreate(repo, decision)","preventionTips":["Check getEffectiveSetupRunPolicy(repo) before create and prompt the user when it is 'ask'.","Never call shouldRunSetupForCreate with the default 'inherit' from automation without first resolving the policy.","Set setupRunPolicy to a non-'ask' default for repos driven by automation."],"tags":["hooks","setup","configuration","user-decision","security"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}