feat(agent): 1 retry change for realize functions.#1282
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the “realize” correction workflow to standardize per-function success reporting and centralize retry orchestration across collector/operation/transformer realization.
Changes:
- Introduces
IAutoBeRealizeFunctionResultand updates overall-correction entry points to return per-function success/failure results. - Adds
orchestrateRealizeCorrectWithRetryand updates collector/operation/transformer orchestration to use a unified 1-retry flow. - Enhances operation rewrite to optionally target only failed endpoints; updates prompts to enforce null-guards and non-null DB default handling guidance.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| website/src/content/_meta.ts | Renames the “benchmark” page title text. |
| packages/agent/src/orchestrate/realize/structures/IAutoBeRealizeFunctionResult.ts | Adds a common result wrapper for realized functions. |
| packages/agent/src/orchestrate/realize/programmers/AutoBeRealizeTransformerProgrammer.ts | Adds HttpException to generated transformer imports to support new null-guard guidance. |
| packages/agent/src/orchestrate/realize/orchestrateRealizeTransformerCorrectOverall.ts | Updates transformer overall-correction to return standardized per-function results. |
| packages/agent/src/orchestrate/realize/orchestrateRealizeTransformer.ts | Switches transformer realization to the unified retry orchestrator. |
| packages/agent/src/orchestrate/realize/orchestrateRealizeOperationWrite.ts | Adds targetEndpoints filtering to focus rewrites on failed operations. |
| packages/agent/src/orchestrate/realize/orchestrateRealizeOperationCorrectOverall.ts | Updates operation overall-correction to return standardized per-function results. |
| packages/agent/src/orchestrate/realize/orchestrateRealizeOperation.ts | Switches operation realization to the unified retry orchestrator and uses selective endpoint retry. |
| packages/agent/src/orchestrate/realize/orchestrateRealizeCollectorCorrectOverall.ts | Updates collector overall-correction to return standardized per-function results. |
| packages/agent/src/orchestrate/realize/orchestrateRealizeCollector.ts | Switches collector realization to the unified retry orchestrator. |
| packages/agent/src/orchestrate/realize/correct/orchestrateRealizeCorrectWithRetry.ts | Adds the new shared 1-retry orchestration utility. |
| packages/agent/src/orchestrate/realize/correct/orchestrateRealizeCorrectOverall.ts | Refactors overall-correction to produce success/failure results per function. |
| packages/agent/prompts/REALIZE_TRANSFORMER_WRITE.md | Adds guidance for null-guarding nullable Prisma relations. |
| packages/agent/prompts/REALIZE_TRANSFORMER_CORRECT.md | Adds correction guidance/checklist for nullable relation null-guards. |
| packages/agent/prompts/REALIZE_OPERATION_WRITE.md | Adds guidance on column-name verification and non-null DB defaults for nullable DTO fields. |
| packages/agent/prompts/REALIZE_OPERATION_CORRECT.md | Adds correction guidance/checklist for nullable relation null-guards and non-null DB defaults. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const retryResults: IAutoBeRealizeFunctionResult<Func>[] = await process( | ||
| await props.rewrite(failures), | ||
| ); | ||
| return [...success, ...retryResults.map((r) => r.function)]; |
There was a problem hiding this comment.
The retry path appends all retry results (retryResults.map(r => r.function)) without filtering on r.success. This means functions that still failed after retry are returned as if they succeeded, contradicting the intended “return only successful results” behavior and potentially propagating uncompilable output. Filter retryResults to only successful entries (and consider merging with the same success/failure filtering used for the first attempt).
| return [...success, ...retryResults.map((r) => r.function)]; | |
| return [ | |
| ...success, | |
| ...retryResults | |
| .filter((r) => r.success === true) | |
| .map((r) => r.function), | |
| ]; |
| return await correct(ctx, props, life); | ||
| } | ||
| return props.functions; | ||
| return props.functions.map((f) => ({ success: true, function: f })); |
There was a problem hiding this comment.
predicate treats any non-"failure" compile result as success and marks every function with success: true. That includes result.type === "exception", which isn’t a successful validation and will be reported as success in the new result type. Consider mapping exception to success: false (or extending the result model to distinguish retryable/non-retryable failures) so callers can accurately report outcomes.
| return props.functions.map((f) => ({ success: true, function: f })); | |
| if (props.event.result.type === "success") | |
| return props.functions.map((f) => ({ success: true, function: f })); | |
| ctx.dispatch(props.event); | |
| return props.functions.map((f) => ({ success: false, function: f })); |
* feat(agent): 1 retry change for realize functions. * fix format * fix logics * fix prompts * fix title * benchmark summary
This pull request refactors the realization correction workflow to introduce a unified retry mechanism and standardized result reporting for function realization steps. The main improvements are the addition of a generic result type to consistently report success/failure for each function, and the introduction of a reusable retry orchestration utility. This leads to more robust error handling and clearer control flow across collector, operation, and transformer realization processes.
Core infrastructure changes:
IAutoBeRealizeFunctionResult, to encapsulate the success state and value of each realized function.IAutoBeRealizeFunctionResultinstead of plain function arrays, ensuring standardized reporting of individual function results. [1] [2] [3] [4] [5] [6] [7] [8] F0cd17e3L20R21, [9] [10] [11] [12]Retry orchestration improvements:
orchestrateRealizeCorrectWithRetry, which encapsulates the logic for first-attempt realization, result filtering, and retrying failed functions, returning only successful results.Selective retry targeting:
orchestrateRealizeOperationWriteto accept an optionaltargetEndpointsparameter, allowing retries to focus only on failed endpoints.These changes collectively improve error handling, code reuse, and maintainability in the realization orchestration logic.