Repository navigation
fix(headless): retry malformed meta-agent candidates - #382
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
candidateRationaleschema.candidateRationale.evidenceRefsstring-vs-array crash and invalid JSON retry prompt redaction.Closes #311.
Why
A real RSI pilot crashed after round-0 because the meta-agent returned
candidateRationale.evidenceRefsas a string instead of an array. That is a recoverable schema correction, not a reason to kill the whole run after Harbor work has already been spent.With #311 scoped to first accepted pilot evidence, this PR also carries the closing validation: the fixed pilot run completed, discarded one flat candidate, kept one improving candidate, passed structural smoke, and preserved the R2 safety boundary.
Scope
Changed:
packages/headless/src/prompt-candidate-loop.tspackages/headless/src/__tests__/prompt-candidate-loop.test.tsNot included:
Verification
node --test --test-name-pattern "retries scripted meta-agent after candidateRationale schema errors" packages/headless/dist/__tests__/prompt-candidate-loop.test.jsfailed withcandidateRationale.evidenceRefs must be an arraybefore the fix.node --test --test-name-pattern "does not echo invalid JSON text into the meta-agent retry prompt" packages/headless/dist/__tests__/prompt-candidate-loop.test.jsfailed before the redaction fix because the retry prompt containedSECRET_CANfromSyntaxError.message.node --test --test-name-pattern "retries scripted meta-agent after candidateRationale schema errors|does not echo invalid JSON text into the meta-agent retry prompt" packages/headless/dist/__tests__/prompt-candidate-loop.test.jsnpm run -w @maka/headless testrsi-meta-retry-pilot-light-20260701-011258rounds_complete0.119795 / 1.25discard/held_in_within_noisekeep/held_in_improved6/8to7/8; held-out passed3/3User-facing impact
No desktop UI impact. Headless RSI prompt-optimization runs are less likely to waste a run when the meta-agent returns a fixable JSON schema mistake.
Reviewer notes
Run artifacts are under
/Users/yuhan/workspace/oss/maka-agent/maka-eval/rsi-runs/rsi-meta-retry-pilot-light-20260701-011258on the local machine.