Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions .mux/workflows/simplify.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ const DIFF_STAT_CHAR_BUDGET = 20000;
const REVIEW_EVIDENCE_ITEM_BUDGET = 3;
const REVIEW_EVIDENCE_CHAR_BUDGET = 500;
const NO_REVIEWABLE_CHANGES_SUMMARY = "No reviewable changes found.";
const GIT_CONTEXT_SOURCE = "parent-workflow-checkout";
const GIT_CONTEXT_PROVENANCE_NOTE =
"Git context was captured from the parent workflow checkout before child agent workspaces were spawned. Child agent branches may differ; status.branch/upstream describe the reviewed parent checkout.";
const READ_ONLY_PROMPT =
"This is a read-only review step. Do not edit files, create commits, apply patches, push branches, or open PRs. Inspect repository evidence only as needed and report findings.";
const VALUE_FLAGS = [
Expand Down Expand Up @@ -563,10 +566,11 @@ function targetNeedsUntrackedContent(input, gitContext) {
}

function untrackedPaths(gitContext) {
return asArray(gitContext.status && gitContext.status.untracked)
const paths = asArray(gitContext.status && gitContext.status.untracked)
.concat(asArray(gitContext.changedFiles && gitContext.changedFiles.untracked))
.map(filePath)
.filter(Boolean);
return Array.from(new Set(paths));
}

function filePath(value) {
Expand Down Expand Up @@ -650,6 +654,7 @@ function promptContexts(input, gitContext) {
function renderContext(input, gitContext) {
return fencedJson({
input: { target: input.target, fix: input.fix, maxFindings: input.maxFindings },
gitContextSource: GIT_CONTEXT_SOURCE,
gitContext: gitContext,
});
}
Expand Down Expand Up @@ -784,8 +789,9 @@ function reviewPrompt(lane, input, reviewContext) {
"The synthesis step will keep at most " +
input.maxFindings +
" actionable findings. Use stable finding ids and arrays for filePaths/evidence.",
"\nLane checklist:\n- " + lane.instructions.join("\n- "),
"\nReview context:\n" + reviewContext,
"Lane checklist:\n- " + lane.instructions.join("\n- "),
GIT_CONTEXT_PROVENANCE_NOTE,
"Review context:\n" + reviewContext,
].join("\n\n");
}

Expand All @@ -797,8 +803,9 @@ function synthesisPrompt(input, compactContext, reviewOutputs) {
" highest-value issues.",
"Do not edit files in this step. Produce triage and fix plans for the later fixer step. If a finding is false positive or not worth addressing, put it in skippedFindings without debating it.",
"Allowed severity values are: high, medium, low. Prefer minimal cleanup over broad refactors.",
"\nCompact review context without raw diff text:\n" + compactContext,
"\nCompacted lane outputs:\n" + fencedJson(compactReviewOutputs(reviewOutputs)),
GIT_CONTEXT_PROVENANCE_NOTE,
"Compact review context without raw diff text:\n" + compactContext,
"Compacted lane outputs:\n" + fencedJson(compactReviewOutputs(reviewOutputs)),
].join("\n\n");
}

Expand All @@ -809,8 +816,9 @@ function fixPrompt(compactContext, synthesized) {
"Use the compact context for file lists and diff metadata; inspect files directly instead of relying on raw diff text being embedded in this prompt.",
"Preserve existing style and functionality. Run targeted validation for touched code when feasible and report exact commands/results.",
"If a finding is false positive or not worth addressing, skip it and note why. Set madeChanges true only when files changed.",
"\nCompact review context:\n" + compactContext,
"\nActionable findings:\n" + fencedJson(fixerPayload(synthesized)),
GIT_CONTEXT_PROVENANCE_NOTE,
"Compact review context:\n" + compactContext,
"Actionable findings:\n" + fencedJson(fixerPayload(synthesized)),
].join("\n\n");
}

Expand Down
Loading