Skip to content

fix(knowledge): surface batch reparse failures - #2453

Merged
lyingbug merged 1 commit into
Tencent:mainfrom
Myang-print:agent/fix-batch-reparse-failures
Jul 31, 2026
Merged

fix(knowledge): surface batch reparse failures#2453
lyingbug merged 1 commit into
Tencent:mainfrom
Myang-print:agent/fix-batch-reparse-failures

Conversation

@Myang-print

Copy link
Copy Markdown
Contributor

Description

Batch reparse previously hid per-item submission failures:

  • ReparseKnowledge reset a document to pending, then returned success when payload marshaling or task enqueueing failed.
  • ProcessKnowledgeListReparse counted failed submissions but always returned nil, so the wrapper task was reported as successful.

This change persists failed document state, propagates submission errors, attempts every item in a batch, and returns an aggregate non-retryable error. The wrapper uses asynq.SkipRetry because automatically retrying a partially submitted batch would clear and reparse documents that were already submitted successfully. Failed documents remain available for an explicit retry.

Regression tests cover the failed state transition, mixed-success aggregation, non-retryable behavior, and the all-success path. The batch-reparse API and its failure semantics are now documented.

There are no API shape, UI, or other breaking changes.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📚 Documentation update
  • 🎨 Refactor
  • ⚡ Performance improvement
  • 🧪 Test
  • 🔧 Configuration / Build / CI

Related Issue

Fixes #1651

Testing

  • go test ./internal/application/service -count=1 — passes.
  • go vet ./internal/application/service — passes.
  • go build ./cmd/server — passes.
  • golangci-lint run --new-from-rev=upstream/main ./... — passes with 0 issues.
  • git diff --check origin/main...HEAD and git diff --check upstream/main...HEAD — pass.
  • go test ./... -count=1 — all changed packages pass; the full run is blocked only by unrelated DNS-dependent SSRF tests in internal/datasource, internal/models/chat, internal/models/embedding, and internal/utils. On this WSL/TUN environment, public test hosts such as example.com, open.feishu.cn, and example.openai.azure.com resolve to synthetic 198.18.0.0/15 addresses, which the existing SSRF guard correctly rejects.

Checklist

  • git diff --check origin/main...HEAD passes
  • Changed source files are formatted
  • Targeted tests for the changed packages/components pass
  • Diff-scoped lint passes where applicable (for Go: golangci-lint run --new-from-rev=origin/main ./...)
  • Full-repository checks were run, or any unrelated/environment-dependent failures are documented above
  • Self-reviewed the code
  • Added/updated tests covering the change
  • Updated related documentation (README, docs/, Swagger annotations, etc.)
  • Breaking changes are clearly called out in the description above

Screenshots / Recordings

Not applicable. This change affects backend failure handling and API documentation only; the existing batch-reparse UI is unchanged.

Signed-off-by: Myang_print <1182470296@qq.com>
@Myang-print
Myang-print marked this pull request as ready for review July 31, 2026 05:19
@lyingbug
lyingbug merged commit 5780aff into Tencent:main Jul 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: 批量操作增加批量重建知识

2 participants