Skip to content

Synthesis failure UX: error-state storage + regeneration workflows #229

@charlie83Gs

Description

@charlie83Gs

Context

Originally drafted as PR #58 (closed). The PR was based on v0.7.1 and conflicts heavily with the current synthesizer architecture (ReadGraphEngine/WorkerGraphEngine split, model_id_override, normalize_ai_links, resolve_sessions/graph_id). Closing and re-opening as a narrower, additive change against current main.

Problem

When the synthesizer or super-synthesizer agent ends without producing text, the workflow currently stores a placeholder string ("Synthesis completed but no document was produced.") as the node's definition. That masks failure — users see a junk document instead of a clear "this failed, retry it" affordance.

Proposed behaviour

Backend — worker-synthesis

  • On empty agent output, do NOT set a definition. Instead store:
    • metadata_.synthesis_error = {message, timestamp}
    • metadata_.synthesis_input = <original SynthesizerInput dump> (for regeneration)
  • On success: clear synthesis_error, persist synthesis_input.
  • Super-synthesizer: stamp parent_supersynthesis_id onto each sub-synthesis so sub regeneration can cascade a recombine.

New workflows

  • regenerate_synthesis_wf(node_id) — re-runs the synthesizer agent on a failed synthesis node in-place (preserves node ID). If it has a parent super-synthesis, dispatches recombine_supersynthesis_wf on completion.
  • recombine_supersynthesis_wf(node_id) — re-runs only the combine step on an existing super-synthesis using its current sub-synthesis documents.

Register both in worker-all.

API — services/api

  • Add status: \"completed\" | \"error\" + error_message: str | null to SynthesisDocumentResponse and SynthesisListItem.
  • POST /api/v1/syntheses/{id}/regenerate — validates node is in error state, dispatches the right regeneration workflow via dispatch_with_graph.

Hatchet I/O models — libs/kt-hatchet

  • RegenerateSynthesisInput(GraphAwareMixin) { node_id: str }
  • RecombineSuperSynthesisInput(GraphAwareMixin) { node_id: str }

Frontend

  • Show red "Failed" badge on failed syntheses in the investigate list.
  • In the synthesis document view, replace the body with an error banner + "Regenerate" button when status === \"error\".
  • regenerateSynthesis(id) helper in lib/api.ts (uses graphRequest).
  • Optional: poll for regeneration progress.

Scope notes

  • Keep it additive. No rewrite of the existing synthesizer/super_synthesizer bodies beyond swapping the placeholder-text branch for the error-state storage.
  • The PR feat(worker-synthesis): store synthesis errors and add regeneration #58 draft (branch feat/synthesis-error-state-regenerate, commit 98d7a3e) has working reference code — but its _helpers.py was designed around the old GraphEngine. Port the error-state pieces onto the current ReadGraphEngine + WorkerGraphEngine pattern.

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions