Skip to content

Feature: durably retry failed and truncated summary tasks - #325

Open
doftorul wants to merge 1 commit into
HazAT:mainfrom
doftorul:fix/summary-retry-282
Open

doftorul wants to merge 1 commit into
HazAT:mainfrom
doftorul:fix/summary-retry-282

Conversation

@doftorul

Copy link
Copy Markdown

Fixes #282

Problem

When a conversation summary request fails transiently (provider error, timeout, malformed JSON) or hits stopReason: 'length', SummaryTask immediately marks the summary status as error, appends conversations.summary-discarded, and terminates without retrying. The conversation keeps its previous summary/abstract until a later reply succeeds, leaving readers with out-of-date context.

Changes

  • Bounded durable retry in SummaryTask (extensions/conversations/summary.ts):
    • Retries transient and incomplete failures up to twice (SUMMARY_RETRY_DELAYS_MS = [2_000, 10_000]) using durable Pi Durable sleeping transitions (attempt in checkpoint) and per-attempt response/reply memo keys (response, response:1, response:2) so failed responses are not replayed and usage is accounted once per attempt (also across aborts and restarts).
    • Doubles maxTokens on stopReason === 'length' (clamped to model.maxTokens) so reasoning + abstract JSON responses that truncate at the default 2048 output budget can succeed on retry.
    • Stops immediately without retrying on permanent failures (unavailable model via SummaryModelUnavailableError), superseded revisions/pending tasks, disabled automatic summaries, or stale context.
    • Still records conversations.summary-discarded and error status once retries are exhausted.
  • Quiet out-of-date indicator on open History abstracts (extensions/lineage/rows.solid.tsx):
    • Marks an open (unlanded) Abstract row · out of date when OverviewDoc reports summaryStatus === 'error' or assessmentStatus === 'error' for that branch, matching the sidebar's error state.
  • Docs & fast deterministic tests:
    • Updated extensions/conversations/README.md.
    • Added fake-clock unit tests in extensions/conversations/test/summary-retry.test.ts covering transient/malformed retry recovery across reopen, length budget doubling clamped to model.maxTokens, retry exhaustion + recovery on next reply, permanent unavailable-model bailout, and superseding during sleep.
    • Added a Solid-DOM test in extensions/lineage/test/web/rows.test.solid.tsx for the out of date abstract marker.

Verification

  • pnpm check (format, lint, types, extension deps, Pi upstream checks): passed
  • pnpm test extensions/conversations/ extensions/lineage/: 23 test files, 162 tests passed

@HazAT HazAT added the feature Reference implementation, left open and unmerged; borrow from it label Nov 24, 2026
@HazAT HazAT changed the title fix(conversations): durably retry failed and truncated summary tasks Feature: durably retry failed and truncated summary tasks Nov 24, 2026
@HazAT

HazAT commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thanks for this, and for the careful tests. On our side summaries already recover on the next reply, and our own history shows no summaries lost to provider errors or truncation (every discard here is a superseded or stale one, which retries rightly skip), so a retry state machine plus a stale marker is more machinery than the core needs right now. We're keeping this open as a feature reference: anyone whose summary model fails often (like the proxy model in #282) can have their @ultimate adopt it from here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Reference implementation, left open and unmerged; borrow from it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conversation summaries that don't finish are discarded and never retried

3 participants