Skip to content

feat(platform): re-queue pii_scan_failed documents when the scan works #5239

Closed

Description

@tale-code-bot

Follow-up of #5233 (task TALE-317), split off it by the Coder.

Today, with #5233. Under an enabled PII policy, a document the policy could not scan is refused as Failed with pii_scan_failed instead of being indexed as it is. This happens in two cases:

  • the policy's scrubber cannot be built (scrubberForPolicy in services/platform/backend/core/knowledge/pii_gate.ts, typically an image without the PII data tree, which backend/main.ts probes at boot);
  • a part of the text could not be scanned whole (a step_error).

Those documents are queued again by every save of the PII policy, an unchanged one included (requeuePiiScanFailedDocuments in services/platform/backend/domains/knowledge/service.ts), and one at a time by Retry indexing. Nothing queues them on its own.

What to add. Once the platform can build the scrubber again (an operator fixed the image or the data tree), queue the documents refused because the protection could not start (PII_SCAN_FAILED_REASONS.unavailable, in backend/core/knowledge/indexing.ts) without waiting for an admin to save the policy.

For the plan.

  • The scrubber cache and the set of reported failures live in one process. A redeploy, the usual fix, starts a new process that never saw the failure, so "builds again" cannot be read from that set alone. One option: when the boot probe in backend/main.ts loads the data tree, a worker queues those documents, bounded per organization and idempotent.
  • Only the unavailable cause heals that way. A step error (incomplete) repeats for the same text and policy, so it stays with the policy save and Retry indexing.
  • Files carry the code on app.file_metadata. Email bodies are found by their corpus row's fixed reason, as requeuePiiScanFailedDocuments does.

Parent: #5233.

Activity

  1. added
    feat
    agent-ready
    on Nov 1, 2026
  2. added a commit that references this issue on Nov 2, 2026
    2de23ea
  3. added 2 commits that reference this issue on Nov 2, 2026
    6649041
    53e869d
  4. tale-code-bot commented on Nov 2, 2026

    @tale-code-bot
    CollaboratorAuthor

    Done on the feature line: feature train #5297 landed on release/0.6 by rebase at 2026-11-02 09:37:43 UTC. This issue's change is commit 53e869da2ca77031adf81e1a8d1784679e0c1baf (feat(platform): re-queue pii_scan_failed documents when the scan works) on release/0.6, and it ships with Tale 0.6.0. GitHub closes issues itself only for commits that reach main, so the feature-train role closes this one now. Board task: TALE-322.

  5. added 13 commits that reference this issue on Nov 2, 2026
    6e48ec0
    d799c25
    759a7c2
    808cd91
    955e6a5
    40f7126
    0b3c2d7
    653dda8
    a1efea2
    f0ddd4f
    7c0c4d0
    ddba8b7
    af9c692
  6. added a commit that references this issue on Nov 15, 2026
    6db3afc
  7. added a commit that references this issue on Nov 23, 2026
    bd98102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyfeat

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions