@rallycry/conveyor-agent 5.1.2 → 5.2.0

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.
@@ -1502,10 +1502,12 @@ function buildFreshInstructions(isPm, isAutoMode, context, agentMode) {
1502
1502
  `Work on the git branch "${context.githubBranch}". Stay on this branch \u2014 do not checkout or create other branches.`,
1503
1503
  `Start by reading the relevant source files mentioned in the plan, then write code.`,
1504
1504
  `When finished, commit and push your changes, then use the create_pull_request tool to open a PR. Do NOT use gh CLI.`,
1505
- ...isAutoMode ? [
1506
- `
1507
- IMPORTANT: You are in Auto mode. You MUST create a pull request using create_pull_request before finishing. Do NOT declare the task complete or go idle without opening a PR. If you are blocked from creating a PR, explain what is blocking you.`
1508
- ] : []
1505
+ `
1506
+ CRITICAL: You are in Auto mode. Do NOT report status, ask for confirmation, or go idle without making code changes.`,
1507
+ `Your FIRST action must be reading source files from the plan, then immediately writing code.`,
1508
+ `Do NOT summarize the plan or say "ready to implement" \u2014 start implementing.`,
1509
+ `When all changes are committed and pushed, use create_pull_request to open a PR.`,
1510
+ `If you are genuinely blocked, explain the specific blocker \u2014 do not go idle silently.`
1509
1511
  ];
1510
1512
  }
1511
1513
  if (isAutoMode && isPm) {
@@ -1533,13 +1535,23 @@ IMPORTANT: You are in Auto mode. You MUST create a pull request using create_pul
1533
1535
  `When you finish planning, save the plan with update_task and end your turn. Your reply summarizing the plan will be visible in chat. A separate task agent will execute the plan after review.`
1534
1536
  ];
1535
1537
  }
1536
- return [
1538
+ const parts = [
1537
1539
  `Begin executing the task plan above immediately.`,
1538
1540
  `Your FIRST action should be reading the relevant source files mentioned in the plan, then writing code. Do NOT run install, build, lint, test, or dev server commands first \u2014 the environment is already set up.`,
1539
1541
  `Work on the git branch "${context.githubBranch}". Stay on this branch for the entire task. Do not checkout or create other branches.`,
1540
1542
  `Your replies are visible to the team in chat \u2014 briefly describe what you're doing when you begin meaningful implementation, and again when the PR is ready.`,
1541
1543
  `When finished, commit your changes, then run \`git fetch origin ${context.githubBranch}\` and \`git push origin ${context.githubBranch}\` (use --force-with-lease if push fails). Then use the create_pull_request tool to open a PR. Do NOT use gh CLI or any other method to create PRs.`
1542
1544
  ];
1545
+ if (isAutoMode) {
1546
+ parts.push(
1547
+ `
1548
+ CRITICAL: You are in Auto mode. Do NOT report status, ask for confirmation, or go idle without making code changes.`,
1549
+ `Do NOT summarize the plan or say "ready to implement" \u2014 start implementing immediately.`,
1550
+ `When all changes are committed and pushed, you MUST use create_pull_request to open a PR before finishing.`,
1551
+ `If you are genuinely blocked, explain the specific blocker \u2014 do not go idle silently.`
1552
+ );
1553
+ }
1554
+ return parts;
1543
1555
  }
1544
1556
  function buildFeedbackInstructions(context, isPm) {
1545
1557
  const lastAgentIdx = findLastAgentMessageIndex2(context.chatHistory);
@@ -3138,7 +3150,7 @@ var AgentRunner = class {
3138
3150
  sessionIds = /* @__PURE__ */ new Map();
3139
3151
  lastQueryModeRestart = false;
3140
3152
  startCommandStarted = false;
3141
- nudgedForPR = false;
3153
+ prNudgeCount = 0;
3142
3154
  idleTimer = null;
3143
3155
  idleCheckInterval = null;
3144
3156
  deferredStartConfig = null;
@@ -3284,23 +3296,43 @@ var AgentRunner = class {
3284
3296
  }
3285
3297
  }
3286
3298
  async maybeSendPRNudge() {
3287
- if (!this.config.isAuto || this.nudgedForPR || this.stopped) return false;
3299
+ if (!this.config.isAuto || this.stopped) return false;
3300
+ const maxNudges = this.taskContext?.agentSettings?.maxPrNudges ?? this.config.agentSettings?.maxPrNudges ?? 3;
3301
+ if (this.prNudgeCount >= maxNudges) return false;
3288
3302
  const fresh = await this.connection.fetchTaskContext().catch(() => null);
3289
3303
  if (fresh) this.taskContext = fresh;
3290
3304
  const status = this.taskContext?.status;
3291
3305
  const hasPR = !!this.taskContext?.githubPRUrl;
3292
3306
  if (status === "InProgress" && !hasPR) {
3293
- this.nudgedForPR = true;
3294
- this.connection.postChatMessage(
3295
- "Auto-nudge: Task is still In Progress with no PR. Prompting agent to continue..."
3296
- );
3297
- await this.setState("running");
3307
+ this.prNudgeCount++;
3298
3308
  const ctx = this.taskContext ?? fresh;
3299
3309
  if (!ctx) return false;
3300
- await this.runQuerySafe(
3301
- ctx,
3302
- "You are in Auto mode and your task is still In Progress with no pull request. You MUST create a pull request before finishing. Use the create_pull_request tool now to open a PR for your changes. If you are blocked, explain what is preventing you from creating a PR."
3303
- );
3310
+ if (this.prNudgeCount >= maxNudges) {
3311
+ this.connection.postChatMessage(
3312
+ `Auto-mode agent failed to open a PR after ${maxNudges} nudges. Shutting down.`
3313
+ );
3314
+ this.stop();
3315
+ return true;
3316
+ }
3317
+ if (this.prNudgeCount === 1) {
3318
+ this.connection.postChatMessage(
3319
+ "Auto-nudge: Task is still In Progress with no PR. Prompting agent to continue..."
3320
+ );
3321
+ await this.setState("running");
3322
+ await this.runQuerySafe(
3323
+ ctx,
3324
+ "You are in Auto mode and your task is still In Progress with no pull request. You MUST create a pull request before finishing. Use the create_pull_request tool now to open a PR for your changes. If you are blocked, explain what is preventing you from creating a PR."
3325
+ );
3326
+ } else {
3327
+ this.connection.postChatMessage(
3328
+ `Auto-nudge (attempt ${this.prNudgeCount}/${maxNudges}): Task still has no PR. Prompting agent again...`
3329
+ );
3330
+ await this.setState("running");
3331
+ await this.runQuerySafe(
3332
+ ctx,
3333
+ `This is reminder ${this.prNudgeCount} of ${maxNudges}. You MUST open a pull request using create_pull_request NOW or explain what is blocking you. Do NOT go idle \u2014 either create the PR or describe the specific blocker.`
3334
+ );
3335
+ }
3304
3336
  return true;
3305
3337
  }
3306
3338
  return false;
@@ -3723,7 +3755,7 @@ var logger4 = createServiceLogger("ProjectRunner");
3723
3755
  var __filename = fileURLToPath(import.meta.url);
3724
3756
  var __dirname = path.dirname(__filename);
3725
3757
  var HEARTBEAT_INTERVAL_MS2 = 3e4;
3726
- var MAX_CONCURRENT = 5;
3758
+ var MAX_CONCURRENT = Math.max(1, parseInt(process.env.CONVEYOR_MAX_CONCURRENT ?? "10", 10) || 10);
3727
3759
  var STOP_TIMEOUT_MS = 3e4;
3728
3760
  function setupWorkDir(projectDir, assignment) {
3729
3761
  const { taskId, branch, devBranch, useWorktree } = assignment;
@@ -4036,4 +4068,4 @@ export {
4036
4068
  ProjectRunner,
4037
4069
  FileCache
4038
4070
  };
4039
- //# sourceMappingURL=chunk-4SXL45ZH.js.map
4071
+ //# sourceMappingURL=chunk-R37YJZWE.js.map