agent: @U0AJM7X8FBR Tasks - we want to switch the coding agent being used in t#80
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a new runClaudeCodeAgent utility that runs the Changes
Sequence Diagram(s)sequenceDiagram
participant Task as Task/Caller
participant Sandbox as Sandbox
participant Runner as CLI Runner
participant Logger as logStep
Task->>Sandbox: runClaudeCodeAgent(sandbox, {label, message, env?, cwd?})
Sandbox->>Runner: spawn "claude" args ["-p","--dangerously-skip-permissions", message] (detached, env, cwd)
Runner-->>Sandbox: process handle
Sandbox->>Runner: await process.wait()
Runner-->>Sandbox: { exitCode, stdout, stderr }
Sandbox->>Logger: logStep(label + " completed", false, { exitCode, stdout, stderr })
alt exitCode != 0
Sandbox->>Logger: logStep(label + " failed", false, { stderr })
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan for PR comments
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.
🧹 Nitpick comments (1)
src/tasks/__tests__/updatePRTask.test.ts (1)
93-93: Test description is stale after the agent migration.The test description still references "OpenClaw agent" but now tests
runClaudeCodeAgent.📝 Suggested fix
- it("runs OpenClaw agent with feedback prompt", async () => { + it("runs Claude Code agent with feedback prompt", async () => {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/tasks/__tests__/updatePRTask.test.ts` at line 93, The test title is stale: change the "it" description that currently says "runs OpenClaw agent with feedback prompt" to reflect the actual function under test (runClaudeCodeAgent); update the string to something like "runs runClaudeCodeAgent with feedback prompt" or "runs Claude Code agent with feedback prompt" in the test containing runClaudeCodeAgent so the description matches the tested function.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/tasks/__tests__/updatePRTask.test.ts`:
- Line 93: The test title is stale: change the "it" description that currently
says "runs OpenClaw agent with feedback prompt" to reflect the actual function
under test (runClaudeCodeAgent); update the string to something like "runs
runClaudeCodeAgent with feedback prompt" or "runs Claude Code agent with
feedback prompt" in the test containing runClaudeCodeAgent so the description
matches the tested function.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 012ccbb8-ff00-4911-8d01-91d36fc21ae8
📒 Files selected for processing (6)
src/sandboxes/__tests__/runClaudeCodeAgent.test.tssrc/sandboxes/runClaudeCodeAgent.tssrc/tasks/__tests__/codingAgentTask.test.tssrc/tasks/__tests__/updatePRTask.test.tssrc/tasks/codingAgentTask.tssrc/tasks/updatePRTask.ts
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/sandboxes/__tests__/pushAndCreatePRsViaAgent.test.ts (1)
55-70: Consider adding a test for non-zero exit codes.If error handling is added to
pushAndCreatePRsViaAgent(as suggested), a corresponding test should verify the error behavior.🧪 Example test for failure scenario
it("throws when agent exits with non-zero code", async () => { const { runClaudeCodeAgent } = await import("../runClaudeCodeAgent"); vi.mocked(runClaudeCodeAgent).mockResolvedValueOnce({ exitCode: 1, stdout: "", stderr: "Permission denied", }); const sandbox = {} as any; await expect( pushAndCreatePRsViaAgent(sandbox, { prompt: "Fix bug", branch: "agent/fix-123", }) ).rejects.toThrow("Agent failed"); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/sandboxes/__tests__/pushAndCreatePRsViaAgent.test.ts` around lines 55 - 70, The test suite lacks coverage for handling non-zero exit codes from runClaudeCodeAgent used by pushAndCreatePRsViaAgent; add a test in src/sandboxes/__tests__/pushAndCreatePRsViaAgent.test.ts that mocks runClaudeCodeAgent to return an exitCode !== 0 (e.g., 1) and stderr, then assert pushAndCreatePRsViaAgent rejects/throws with an appropriate error message (e.g., "Agent failed" or includes stderr) to verify error propagation from pushAndCreatePRsViaAgent.src/sandboxes/pushAndCreatePRsViaAgent.ts (1)
55-57: Consider checkingexitCodebefore parsing stdout.If the agent fails (non-zero exit code),
result.stdoutmay contain incomplete or error output, andparsePRUrlswould return an empty array silently. This could mask failures.♻️ Proposed handling for non-zero exit codes
}); + if (result.exitCode !== 0) { + throw new Error( + `Agent failed with exit code ${result.exitCode}: ${result.stderr || result.stdout}` + ); + } + return parsePRUrls(result.stdout); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/sandboxes/pushAndCreatePRsViaAgent.ts` around lines 55 - 57, Before calling parsePRUrls on result.stdout inside pushAndCreatePRsViaAgent, check result.exitCode for a non-zero value and handle it (e.g., throw an error or log and return) so failures aren't masked by parsing incomplete stdout; reference the result object returned from the agent invocation and the parsePRUrls call, and ensure pushAndCreatePRsViaAgent returns or surfaces errors when result.exitCode !== 0 instead of silently returning parsePRUrls(result.stdout).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/sandboxes/__tests__/pushAndCreatePRsViaAgent.test.ts`:
- Around line 55-70: The test suite lacks coverage for handling non-zero exit
codes from runClaudeCodeAgent used by pushAndCreatePRsViaAgent; add a test in
src/sandboxes/__tests__/pushAndCreatePRsViaAgent.test.ts that mocks
runClaudeCodeAgent to return an exitCode !== 0 (e.g., 1) and stderr, then assert
pushAndCreatePRsViaAgent rejects/throws with an appropriate error message (e.g.,
"Agent failed" or includes stderr) to verify error propagation from
pushAndCreatePRsViaAgent.
In `@src/sandboxes/pushAndCreatePRsViaAgent.ts`:
- Around line 55-57: Before calling parsePRUrls on result.stdout inside
pushAndCreatePRsViaAgent, check result.exitCode for a non-zero value and handle
it (e.g., throw an error or log and return) so failures aren't masked by parsing
incomplete stdout; reference the result object returned from the agent
invocation and the parsePRUrls call, and ensure pushAndCreatePRsViaAgent returns
or surfaces errors when result.exitCode !== 0 instead of silently returning
parsePRUrls(result.stdout).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2f1c0885-3fc7-4761-a66c-27757d39cb84
📒 Files selected for processing (2)
src/sandboxes/__tests__/pushAndCreatePRsViaAgent.test.tssrc/sandboxes/pushAndCreatePRsViaAgent.ts
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/sandboxes/__tests__/cloneMonorepoViaAgent.test.ts (1)
26-31:⚠️ Potential issue | 🟠 MajorUpdate the assertion to match the new clone prompt.
This expectation still anchors on
"Recoup-Monorepo", but the implementation now emitshttps://github.com/recoupable/mono.git, so the test is the source of the current CI failure.Suggested fix
expect(runClaudeCodeAgent).toHaveBeenCalledWith( sandbox, expect.objectContaining({ label: "Clone monorepo via agent", - message: expect.stringContaining("Recoup-Monorepo"), + message: expect.stringContaining("recoupable/mono.git"), }), );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/sandboxes/__tests__/cloneMonorepoViaAgent.test.ts` around lines 26 - 31, Update the test assertion for runClaudeCodeAgent in cloneMonorepoViaAgent.test.ts to match the new clone prompt: change the expect.stringContaining("Recoup-Monorepo") to expect.stringContaining("https://github.com/recoupable/mono.git") (keeping the same expect.objectContaining wrapper and label "Clone monorepo via agent") so the test validates the updated message emitted by the implementation.
🧹 Nitpick comments (1)
src/tasks/__tests__/codingAgentTask.test.ts (1)
34-35: Add one regression test for a non-zero ClaudeexitCode.These updates only exercise the success path (
exitCode: 0), so the suite still won't catch accidental PR creation or success-style callback reporting after a failed Claude run.Example test to add
+ it("fails before creating PRs when Claude exits non-zero", async () => { + const { runClaudeCodeAgent } = await import("../../sandboxes/runClaudeCodeAgent"); + const { pushAndCreatePRsViaAgent } = await import("../../sandboxes/pushAndCreatePRsViaAgent"); + + vi.mocked(runClaudeCodeAgent).mockResolvedValueOnce({ + exitCode: 1, + stdout: "", + stderr: "agent failed", + }); + + await expect(mockRun(basePayload)).rejects.toThrow(/exit code 1/i); + expect(pushAndCreatePRsViaAgent).not.toHaveBeenCalled(); + });Also applies to: 79-86, 138-149
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/tasks/__tests__/codingAgentTask.test.ts` around lines 34 - 35, Add a regression test that mocks runClaudeCodeAgent to return a non-zero exitCode (e.g., { exitCode: 1, stdout: "", stderr: "error" }) and asserts the failure path: the task under test (the coding agent runner used in these tests) should not invoke success-style callbacks or create a PR/report success, and should instead surface failure (e.g., call the error/failure callback or return a failing result). Update the existing test stubs that currently mock runClaudeCodeAgent with exitCode: 0 to include one case that returns a non-zero exitCode and add assertions that confirm no success actions were taken (no PR creation, no success-report calls) and that failure reporting was invoked.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/sandboxes/cloneMonorepoViaAgent.ts`:
- Around line 17-20: The clone step leaves an unstable checkout directory name
causing syncMonorepoSubmodules() to run in
~/.openclaw/workspace/Recoup-Monorepo/ while git created mono/, so update the
clone step in cloneMonorepoViaAgent.ts to clone into the stable destination
(e.g., git clone https://github.com/recoupable/mono.git Recoup-Monorepo or to
~/.openclaw/workspace/Recoup-Monorepo) and ensure subsequent commands (cd and
git submodule update --init) operate in that same directory; adjust any
hardcoded path strings or messages so the working directory used by
syncMonorepoSubmodules() and the clone command match.
In `@src/tasks/codingAgentTask.ts`:
- Line 3: runClaudeCodeAgent now returns an exitCode that can be non-zero;
update the flow in codingAgentTask (after calling runClaudeCodeAgent) to check
the returned exitCode and fail fast (throw or return an error) when exitCode !==
0 so you do not proceed to PR creation or callback reporting; specifically,
after the runClaudeCodeAgent call inspect the returned object’s exitCode and
short-circuit (avoid calling the PR creation and any callback/reporting logic
that would emit "pr_created" or "no_changes") when the process failed.
---
Outside diff comments:
In `@src/sandboxes/__tests__/cloneMonorepoViaAgent.test.ts`:
- Around line 26-31: Update the test assertion for runClaudeCodeAgent in
cloneMonorepoViaAgent.test.ts to match the new clone prompt: change the
expect.stringContaining("Recoup-Monorepo") to
expect.stringContaining("https://github.com/recoupable/mono.git") (keeping the
same expect.objectContaining wrapper and label "Clone monorepo via agent") so
the test validates the updated message emitted by the implementation.
---
Nitpick comments:
In `@src/tasks/__tests__/codingAgentTask.test.ts`:
- Around line 34-35: Add a regression test that mocks runClaudeCodeAgent to
return a non-zero exitCode (e.g., { exitCode: 1, stdout: "", stderr: "error" })
and asserts the failure path: the task under test (the coding agent runner used
in these tests) should not invoke success-style callbacks or create a PR/report
success, and should instead surface failure (e.g., call the error/failure
callback or return a failing result). Update the existing test stubs that
currently mock runClaudeCodeAgent with exitCode: 0 to include one case that
returns a non-zero exitCode and add assertions that confirm no success actions
were taken (no PR creation, no success-report calls) and that failure reporting
was invoked.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: df6accc0-1982-4d93-8e9e-2a16ab52be3a
📒 Files selected for processing (5)
src/sandboxes/__tests__/cloneMonorepoViaAgent.test.tssrc/sandboxes/cloneMonorepoViaAgent.tssrc/sandboxes/git/syncMonorepoSubmodules.tssrc/tasks/__tests__/codingAgentTask.test.tssrc/tasks/codingAgentTask.ts
| import { setupOpenClaw } from "../sandboxes/setupOpenClaw"; | ||
| import { cloneMonorepoViaAgent } from "../sandboxes/cloneMonorepoViaAgent"; | ||
| import { runOpenClawAgent } from "../sandboxes/runOpenClawAgent"; | ||
| import { runClaudeCodeAgent } from "../sandboxes/runClaudeCodeAgent"; |
There was a problem hiding this comment.
Fail fast when the Claude process exits non-zero.
After switching this task to runClaudeCodeAgent(), the flow now gets an explicit exitCode back but still continues into PR creation and callback reporting even if the CLI failed. That can turn a broken agent run into a misleading pr_created or no_changes outcome.
Proposed guard
const agentResult = await runClaudeCodeAgent(sandbox, {
label: "Coding agent",
message: prompt,
});
+ if (agentResult.exitCode !== 0) {
+ logStep("Agent failed", false, {
+ exitCode: agentResult.exitCode,
+ stdout: agentResult.stdout.slice(-2000),
+ stderr: agentResult.stderr.slice(-2000),
+ });
+ throw new Error(`Coding agent failed with exit code ${agentResult.exitCode}`);
+ }
+
logStep("Agent completed", true, {
exitCode: agentResult.exitCode,
stdout: agentResult.stdout.slice(-2000),
stderr: agentResult.stderr.slice(-2000),
});Also applies to: 42-51
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/tasks/codingAgentTask.ts` at line 3, runClaudeCodeAgent now returns an
exitCode that can be non-zero; update the flow in codingAgentTask (after calling
runClaudeCodeAgent) to check the returned exitCode and fail fast (throw or
return an error) when exitCode !== 0 so you do not proceed to PR creation or
callback reporting; specifically, after the runClaudeCodeAgent call inspect the
returned object’s exitCode and short-circuit (avoid calling the PR creation and
any callback/reporting logic that would emit "pr_created" or "no_changes") when
the process failed.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/tasks/updatePRTask.ts (1)
73-84: Redundant instruction: message tells agent tocdbutcwdalready sets the working directory.Line 79 instructs the agent to "cd into the submodule directory" but the
cwdoption (line 72) already sets the working directory for the command. This is harmless but could confuse the agent or lead to unexpected behavior if paths differ.Consider removing the redundant step or adjusting the message to reflect that the agent is already in the correct directory.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/tasks/updatePRTask.ts` around lines 73 - 84, The message in updatePRTask.ts redundantly instructs the agent to "cd into the submodule directory" even though the command is executed with the cwd option; update the user-facing message (the message array assigned where you build the PR update task) to remove or reword that step so it doesn't tell the agent to cd (e.g., remove the line `1. cd into the submodule directory for ${repo}` or replace it with a note that cwd is already set), keeping the rest of the steps and leaving the existing cwd usage unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/tasks/updatePRTask.ts`:
- Around line 21-24: getSubmoduleCwd currently assumes repo contains a slash and
uses repo.split("/")[1], which yields undefined for malformed input; update
getSubmoduleCwd to validate the repo format (e.g., split into parts and ensure
parts.length >= 2 and parts[1] is non-empty) and handle invalid values by either
throwing a clear Error or returning a safe fallback instead of producing
MONOREPO_DIR/undefined; reference the getSubmoduleCwd function and MONOREPO_DIR
when making the check and error/fallback handling.
- Line 12: The MONOREPO_DIR constant is defined at module scope using
process.env.HOME which breaks in the Vercel Sandbox; move its definition into
the task's run() function after the sandbox is created and derive it via
getSandboxHomeDir(sandbox) (same pattern used in pushOrgRepos.ts and
addOrgSubmodules.ts). Remove the module-level MONOREPO_DIR, import or reference
getSandboxHomeDir from the sandbox module, then inside run() compute
MONOREPO_DIR = `${getSandboxHomeDir(sandbox)}/.openclaw/workspace/mono` and use
that local variable for subsequent operations.
---
Nitpick comments:
In `@src/tasks/updatePRTask.ts`:
- Around line 73-84: The message in updatePRTask.ts redundantly instructs the
agent to "cd into the submodule directory" even though the command is executed
with the cwd option; update the user-facing message (the message array assigned
where you build the PR update task) to remove or reword that step so it doesn't
tell the agent to cd (e.g., remove the line `1. cd into the submodule directory
for ${repo}` or replace it with a note that cwd is already set), keeping the
rest of the steps and leaving the existing cwd usage unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9828b2f6-a389-4350-80b2-b873d9b6278f
📒 Files selected for processing (4)
src/sandboxes/__tests__/runClaudeCodeAgent.test.tssrc/sandboxes/runClaudeCodeAgent.tssrc/tasks/__tests__/updatePRTask.test.tssrc/tasks/updatePRTask.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/sandboxes/tests/runClaudeCodeAgent.test.ts
- src/sandboxes/runClaudeCodeAgent.ts
src/tasks/updatePRTask.ts
Outdated
| import { updatePRPayloadSchema } from "../schemas/updatePRSchema"; | ||
| import { CODING_AGENT_ACCOUNT_ID } from "../consts"; | ||
|
|
||
| const MONOREPO_DIR = `${process.env.HOME ?? "/root"}/.openclaw/workspace/mono`; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if there's any documentation or configuration specifying the sandbox home directory
rg -n "HOME|/root" --type ts -C2Repository: recoupable/tasks
Length of output: 3898
🏁 Script executed:
#!/bin/bash
# Check how MONOREPO_DIR is used in updatePRTask.ts
cat -n src/tasks/updatePRTask.ts | head -100
# Check if Sandbox instance is available in the task context
rg -n "Sandbox" src/tasks/updatePRTask.ts -C3
# Check how other tasks handle sandbox home directory
rg -n "getSandboxHomeDir" -A5 --type tsRepository: recoupable/tasks
Length of output: 12225
Move MONOREPO_DIR into the task run function and use getSandboxHomeDir() for proper sandbox home detection.
The module-level constant at line 12 evaluates process.env.HOME in the Trigger.dev task runner environment, but it's used inside the Vercel Sandbox—a separate environment with its own filesystem. This creates an environment mismatch.
The codebase already has infrastructure for this: getSandboxHomeDir() (available in the same sandbox module) is used in pushOrgRepos.ts and addOrgSubmodules.ts to dynamically detect the sandbox home directory. Use the same pattern here.
Move the MONOREPO_DIR definition into the run() function after the sandbox is created, and derive it from getSandboxHomeDir(sandbox):
🔧 Proposed fix
-const MONOREPO_DIR = `${process.env.HOME ?? "/root"}/.openclaw/workspace/mono`;
/**
* Derives the absolute path to a submodule inside the monorepo from a
* repo identifier like "recoupable/tasks".
*
* `@param` repo - Full repo identifier, e.g. "recoupable/tasks"
* `@returns` Absolute path to the submodule directory in the sandbox
*/
-function getSubmoduleCwd(repo: string): string {
+async function getSubmoduleCwd(homeDir: string, repo: string): string {
- const repoName = repo.split("/")[1];
+ const repoName = repo.split("/")[1];
return `${homeDir}/.openclaw/workspace/mono/${repoName}`;
}
export const updatePRTask = schemaTask({
id: "update-pr",
schema: updatePRPayloadSchema,
maxDuration: 60 * 15,
retry: {
maxAttempts: 0,
},
run: async (payload) => {
const { feedback, snapshotId, branch, repo, callbackThreadId } = payload;
const { token, teamId, projectId } = getVercelSandboxCredentials();
logStep("Resuming sandbox from snapshot");
const sandbox = await Sandbox.create({
token,
teamId,
projectId,
source: { type: "snapshot", snapshotId },
timeout: 30 * 60 * 1000,
});
logStep("Sandbox resumed", false, { sandboxId: sandbox.sandboxId, snapshotId });
try {
await configureGitAuth(sandbox);
+ const homeDir = await getSandboxHomeDir(sandbox);
const env = getSandboxEnv(CODING_AGENT_ACCOUNT_ID);
- const cwd = getSubmoduleCwd(repo);
+ const cwd = getSubmoduleCwd(homeDir, repo);Add import:
+import { getSandboxHomeDir } from "../sandboxes/getSandboxHomeDir";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/tasks/updatePRTask.ts` at line 12, The MONOREPO_DIR constant is defined
at module scope using process.env.HOME which breaks in the Vercel Sandbox; move
its definition into the task's run() function after the sandbox is created and
derive it via getSandboxHomeDir(sandbox) (same pattern used in pushOrgRepos.ts
and addOrgSubmodules.ts). Remove the module-level MONOREPO_DIR, import or
reference getSandboxHomeDir from the sandbox module, then inside run() compute
MONOREPO_DIR = `${getSandboxHomeDir(sandbox)}/.openclaw/workspace/mono` and use
that local variable for subsequent operations.
src/tasks/updatePRTask.ts
Outdated
| function getSubmoduleCwd(repo: string): string { | ||
| const repoName = repo.split("/")[1]; | ||
| return `${MONOREPO_DIR}/${repoName}`; | ||
| } |
There was a problem hiding this comment.
Missing validation for repo format could produce invalid path.
If repo doesn't contain a / (e.g., malformed input), repo.split("/")[1] returns undefined, producing a path like .../mono/undefined. Consider adding a guard.
🛡️ Proposed fix
function getSubmoduleCwd(repo: string): string {
const repoName = repo.split("/")[1];
+ if (!repoName) {
+ throw new Error(`Invalid repo format: expected "owner/name", got "${repo}"`);
+ }
return `${MONOREPO_DIR}/${repoName}`;
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| function getSubmoduleCwd(repo: string): string { | |
| const repoName = repo.split("/")[1]; | |
| return `${MONOREPO_DIR}/${repoName}`; | |
| } | |
| function getSubmoduleCwd(repo: string): string { | |
| const repoName = repo.split("/")[1]; | |
| if (!repoName) { | |
| throw new Error(`Invalid repo format: expected "owner/name", got "${repo}"`); | |
| } | |
| return `${MONOREPO_DIR}/${repoName}`; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/tasks/updatePRTask.ts` around lines 21 - 24, getSubmoduleCwd currently
assumes repo contains a slash and uses repo.split("/")[1], which yields
undefined for malformed input; update getSubmoduleCwd to validate the repo
format (e.g., split into parts and ensure parts.length >= 2 and parts[1] is
non-empty) and handle invalid values by either throwing a clear Error or
returning a safe fallback instead of producing MONOREPO_DIR/undefined; reference
the getSubmoduleCwd function and MONOREPO_DIR when making the check and
error/fallback handling.
Automated PR from coding agent.
Summary by CodeRabbit
New Features
Tests