patchrelay 0.36.4 → 0.36.6
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.
- package/dist/build-info.json +3 -3
- package/dist/run-orchestrator.js +37 -1
- package/package.json +1 -1
package/dist/build-info.json
CHANGED
package/dist/run-orchestrator.js
CHANGED
|
@@ -12,7 +12,12 @@ import { getThreadTurns } from "./codex-thread-utils.js";
|
|
|
12
12
|
import { deriveIssueSessionReactiveIntent } from "./issue-session.js";
|
|
13
13
|
const DEFAULT_CI_REPAIR_BUDGET = 3;
|
|
14
14
|
const DEFAULT_QUEUE_REPAIR_BUDGET = 3;
|
|
15
|
-
|
|
15
|
+
// Requested-changes loops can legitimately take more iterations than CI/queue
|
|
16
|
+
// repair when the reviewer is catching nuanced product or timing bugs across
|
|
17
|
+
// successive heads. Keep a hard ceiling to prevent infinite ping-pong, but make
|
|
18
|
+
// it wide enough that real review cycles can continue after multiple successful
|
|
19
|
+
// head advances.
|
|
20
|
+
const DEFAULT_REVIEW_FIX_BUDGET = 12;
|
|
16
21
|
const DEFAULT_ZOMBIE_RECOVERY_BUDGET = 5;
|
|
17
22
|
const ZOMBIE_RECOVERY_BASE_DELAY_MS = 15_000; // 15s, 30s, 60s, 120s, 240s
|
|
18
23
|
const ISSUE_SESSION_LEASE_MS = 10 * 60_000;
|
|
@@ -134,6 +139,34 @@ function appendTaskObjective(lines, issue) {
|
|
|
134
139
|
}
|
|
135
140
|
lines.push("");
|
|
136
141
|
}
|
|
142
|
+
function extractIssueSection(description, heading) {
|
|
143
|
+
if (!description)
|
|
144
|
+
return undefined;
|
|
145
|
+
const escaped = heading.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
146
|
+
const pattern = new RegExp(`^## ${escaped}\\s*$([\\s\\S]*?)(?=^##\\s+|$)`, "im");
|
|
147
|
+
const match = description.match(pattern);
|
|
148
|
+
const body = match?.[1]?.trim();
|
|
149
|
+
return body && body.length > 0 ? body : undefined;
|
|
150
|
+
}
|
|
151
|
+
function appendScopeDiscipline(lines, issue) {
|
|
152
|
+
const description = issue.description?.trim();
|
|
153
|
+
const scope = extractIssueSection(description, "Scope");
|
|
154
|
+
const acceptance = extractIssueSection(description, "Acceptance criteria")
|
|
155
|
+
?? extractIssueSection(description, "Success criteria");
|
|
156
|
+
const relevantCode = extractIssueSection(description, "Relevant code");
|
|
157
|
+
lines.push("## Scope Discipline", "");
|
|
158
|
+
lines.push("Stay inside the delegated task.", "Finish the issue completely enough to satisfy its stated scope and acceptance criteria, but do not widen it into unrelated product polish or follow-up cleanup.", "Only broaden to adjacent routes, copy, or supporting surfaces when the issue text or repository guidance explicitly says they are the same user flow.", "If you notice a worthwhile broader inconsistency that is not required to make this task correct, mention it in your summary as follow-up context instead of expanding the implementation.", "");
|
|
159
|
+
if (scope) {
|
|
160
|
+
lines.push("### In Scope", "", scope, "");
|
|
161
|
+
}
|
|
162
|
+
if (acceptance) {
|
|
163
|
+
lines.push("### Acceptance / Done", "", acceptance, "");
|
|
164
|
+
}
|
|
165
|
+
if (relevantCode) {
|
|
166
|
+
lines.push("### Relevant Code", "", relevantCode, "");
|
|
167
|
+
}
|
|
168
|
+
lines.push("### Likely Review Invariants", "", "- Check the surfaces explicitly named in the task before stopping.", "- If repository guidance says certain changed surfaces are one flow, verify that shared flow, but do not treat unrelated surrounding cleanup as part of this task.", "- A review repair should fix the concrete concern on the current head, not silently expand the Linear issue into a broader rewrite.", "");
|
|
169
|
+
}
|
|
137
170
|
function appendLinearContext(lines, context) {
|
|
138
171
|
const promptContext = typeof context?.promptContext === "string" ? context.promptContext.trim() : "";
|
|
139
172
|
const latestPrompt = typeof context?.promptBody === "string" ? context.promptBody.trim() : "";
|
|
@@ -404,6 +437,7 @@ function appendRequestedChangesInstructions(lines, runType, context) {
|
|
|
404
437
|
export function buildInitialRunPrompt(issue, runType, repoPath, context) {
|
|
405
438
|
const lines = buildPromptHeader(issue);
|
|
406
439
|
appendTaskObjective(lines, issue);
|
|
440
|
+
appendScopeDiscipline(lines, issue);
|
|
407
441
|
appendLinearContext(lines, context);
|
|
408
442
|
// Add run-type-specific context for reactive runs
|
|
409
443
|
switch (runType) {
|
|
@@ -440,6 +474,8 @@ export function buildInitialRunPrompt(issue, runType, repoPath, context) {
|
|
|
440
474
|
export function buildFollowUpRunPrompt(issue, runType, repoPath, context) {
|
|
441
475
|
const lines = buildPromptHeader(issue);
|
|
442
476
|
appendFollowUpPromptPrelude(lines, issue, runType, context);
|
|
477
|
+
appendTaskObjective(lines, issue);
|
|
478
|
+
appendScopeDiscipline(lines, issue);
|
|
443
479
|
// Add run-type-specific context for reactive runs
|
|
444
480
|
switch (runType) {
|
|
445
481
|
case "ci_repair": {
|