Identify built-in generation preparation failures

This commit is contained in:
2026-11-05 13:48:16 +00:00
parent b8dc8a49a9
commit 1c075bd510
8 changed files with 54 additions and 8 deletions

View File

@@ -85,6 +85,12 @@ func (c *Coordinator) GenerateWithEvidence(
return c.generate(ctx, req, true)
}
// PreparationError identifies a built-in request preparation failure.
type PreparationError struct{ Cause error }
func (e *PreparationError) Error() string { return e.Cause.Error() }
func (e *PreparationError) Unwrap() error { return e.Cause }
func (c *Coordinator) generate(
ctx context.Context,
req domain.GenerateRequest,
@@ -95,7 +101,7 @@ func (c *Coordinator) generate(
}
prepared, err := c.builtIn.PrepareGeneration(req)
if err != nil {
return nil, err, GenerationEvidence{}
return nil, &PreparationError{Cause: err}, GenerationEvidence{PreparationFailed: true}
}
evidence := GenerationEvidence{}

View File

@@ -10,6 +10,8 @@ import (
// GenerationEvidence contains invocation-local request evidence without raw
// provider bodies, headers, credentials, or generated content.
type GenerationEvidence struct {
// PreparationFailed identifies a built-in request rejected before attempts.
PreparationFailed bool
// InitialEndpoint is the frozen built-in request URL, if prepared.
// Injected generation leaves it unknown.
InitialEndpoint string