MCPcopy Create free account
hub / github.com/compozy/agh / Retry

Method Retry

internal/daemon/memory_runtime.go:279–329  ·  view source on GitHub ↗
(
	ctx context.Context,
	req contract.MemoryExtractorRetryRequest,
)

Source from the content-addressed store, hash-verified

277}
278
279func (e *daemonMemoryExtractor) Retry(
280 ctx context.Context,
281 req contract.MemoryExtractorRetryRequest,
282) (contract.MemoryExtractorRetryResponse, error) {
283 if e == nil || e.proposalSink == nil {
284 return contract.MemoryExtractorRetryResponse{}, errors.New("daemon: memory extractor is not configured")
285 }
286 failures, err := e.loadFailures()
287 if err != nil {
288 return contract.MemoryExtractorRetryResponse{}, err
289 }
290 targetFailureID := strings.TrimSpace(req.FailureID)
291 targetSessionID := strings.TrimSpace(req.SessionID)
292 var response contract.MemoryExtractorRetryResponse
293 for _, failure := range failures {
294 if targetFailureID != "" && failure.Payload.ID != targetFailureID {
295 continue
296 }
297 if targetSessionID != "" && failure.Payload.SessionID != targetSessionID {
298 continue
299 }
300 if err := ctx.Err(); err != nil {
301 return response, fmt.Errorf("daemon: retry memory extractor failures: %w", err)
302 }
303 candidates, decodeErr := failure.Candidates()
304 if decodeErr != nil {
305 response.Failed++
306 continue
307 }
308 if len(candidates) == 0 {
309 response.Failed++
310 continue
311 }
312 var failed bool
313 for _, candidate := range candidates {
314 if _, proposeErr := e.proposalSink.ProposeCandidate(ctx, candidate); proposeErr != nil {
315 failed = true
316 break
317 }
318 }
319 if failed {
320 response.Failed++
321 continue
322 }
323 if err := fileutil.AtomicRemoveFile(failure.Payload.Path); err != nil {
324 return response, fmt.Errorf("daemon: remove retried extractor failure: %w", err)
325 }
326 response.Retried++
327 }
328 return response, nil
329}
330
331func (e *daemonMemoryExtractor) Drain(ctx context.Context) (contract.MemoryExtractorDrainResponse, error) {
332 if e == nil || e.runtime == nil {

Callers

nothing calls this directly

Calls 5

loadFailuresMethod · 0.95
AtomicRemoveFileFunction · 0.92
CandidatesMethod · 0.65
ProposeCandidateMethod · 0.65
ErrMethod · 0.45

Tested by

no test coverage detected