Skip to content

Commit df75cda

Browse files
samchonCopilot
andauthored
feat(core): previous validation errors also customized. (#513)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 85e5606 commit df75cda

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

packages/core/prompts/validate_repeated.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
## Recursive Error Pattern Analysis
1+
# Recursive Error Pattern Analysis
22

3-
### Historical Error Input
3+
## Historical Error Input
44

55
You have been provided with `IValidation.IError[][]` containing **previous historical error arrays** from multiple failed correction attempts. Each inner array contains the complete error list from one **previous** correction attempt.
66

7-
**CRITICAL**: Compare the current `IValidation.IFailure.errors` with this historical data to identify recurring patterns.
7+
**CRITICAL**: Compare the current validation errors (shown in the validation failure message above) with this historical data to identify recurring patterns.
88

9-
```json
109
${{HISTORICAL_ERRORS}}
11-
```
1210

13-
### Critical Response Protocol
11+
## Critical Response Protocol
1412

1513
**When error paths recur across current + historical attempts:**
1614

packages/core/src/orchestrate/call.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,17 @@ async function correctTypeError(
256256
"",
257257
AgenticaSystemPrompt.VALIDATE_REPEATED.replace(
258258
"${{HISTORICAL_ERRORS}}",
259-
JSON.stringify(previousValidationErrors.slice(0, -1).map(e => e.result.errors)),
259+
previousValidationErrors
260+
.slice(0, -1)
261+
.map((ve, i) => [
262+
`### ${i + 1}. Previous Validation Error`,
263+
"",
264+
"```json",
265+
stringifyValidateFailure(ve.result),
266+
"```",
267+
].join("\n"))
268+
.join("\n\n"),
269+
// JSON.stringify(previousValidationErrors.slice(0, -1).map(e => e.result.errors)),
260270
),
261271
]
262272
: []),

0 commit comments

Comments
 (0)