buildFailureToolResponse keeps build failures as JSON carried in a normal text tool response. The chatprompt pipeline flattens IsError responses into a single string and drops structured fields, so quota and generic build failures both keep IsError false and let the frontend detect failures via the
( ctx context.Context, logger slog.Logger, db database.Store, ownerID uuid.UUID, organizationID uuid.UUID, action buildFailureAction, buildID uuid.UUID, err error, )
| 166 | // failures both keep IsError false and let the frontend detect failures via |
| 167 | // the "error" key. |
| 168 | func buildFailureToolResponse( |
| 169 | ctx context.Context, |
| 170 | logger slog.Logger, |
| 171 | db database.Store, |
| 172 | ownerID uuid.UUID, |
| 173 | organizationID uuid.UUID, |
| 174 | action buildFailureAction, |
| 175 | buildID uuid.UUID, |
| 176 | err error, |
| 177 | ) fantasy.ToolResponse { |
| 178 | msg := err.Error() |
| 179 | if codersdk.JobIsInsufficientQuotaErrorCode(buildErrorCode(err)) { |
| 180 | return quotaErrorToolResponse( |
| 181 | ctx, |
| 182 | logger, |
| 183 | db, |
| 184 | ownerID, |
| 185 | organizationID, |
| 186 | msg, |
| 187 | buildID, |
| 188 | action, |
| 189 | ) |
| 190 | } |
| 191 | return buildToolResponse(newBuildError(msg, buildID)) |
| 192 | } |
no test coverage detected