Skip to content

[Bug] Document summary remains “being prepared” when automatic AI reading is off #788

Description

@HercoGC

Human impact

First, thank you for the very quick and complete response to the earlier reports, and for releasing v1.37.13 so quickly. This is a separate observation from the follow-up verification.

After uploading a document with automatic reading off, the detail view says The summary is being prepared indefinitely. The separate Summarise action is still visible, so it is unclear whether HealthLog is actually working, whether the user should wait or whether pressing Summarise would start a duplicate request.

Steps to reproduce

  1. Turn Read documents automatically with AI off.
  2. Upload a PDF through Documents.
  3. Open the new document and wait for the background activity to settle.
  4. Optionally run the separate Read with AI action and reopen the document.

Actual behaviour

  • The detail view continues to display The summary is being prepared.
  • Summarise remains available as a separate action.
  • In the observed test, the document's summary state remained PENDING, but the background document-summary job had already started and completed within approximately one second.
  • The user's automatic-reading setting was off, no summary request was active and no summary was created.
  • The separate document-index request completed successfully; it did not change the stale summary state.

Expected behaviour

  • With automatic reading off, the page should say that no summary exists yet and offer the explicit Summarise action.
  • Being prepared should be reserved for a job that can still produce a summary.
  • A completed opt-out/no-op job should return the state to NONE or another honest terminal state.

Technical observation

The v1.37.13 upload route calls enqueueDocumentSummary() for every fresh upload. enqueueDocumentSummary() sets summaryState to PENDING once pg-boss accepts the job. runDocumentSummaryJob() then checks documentsAutoAiRead; when the setting is off, it returns as an autoSkipped opt-out and intentionally leaves the state unchanged. DocumentSummaryBlock renders every PENDING state as being generated. The observed pg-boss row was completed, which confirms that the displayed pending state did not represent active work.

This appears to be a state-transition gap rather than a slow provider call. A narrow fix could avoid queueing/marking pending while opted out, or move the completed opt-out path back to an honest non-running state.

Environment

  • HealthLog v1.37.13, build 7e4a4d25446e
  • Official Docker image
  • Chrome 151 on macOS 27

Duplicate and privacy check

No matching issue was found for the exact summary is being prepared wording or the completed opt-out/PENDING state. No document name, content, summary, health value, identifier, screenshot or raw log is included.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions