Skip to content

WIP document metadata config update - #1

Closed
xugangqiang wants to merge 2 commits into
xugangqiang:doc-metadata-configfrom
infiniflow:main
Closed

xugangqiang wants to merge 2 commits into
xugangqiang:doc-metadata-configfrom
infiniflow:main

Conversation

@xugangqiang

Copy link
Copy Markdown
Owner

What problem does this PR solve?

Briefly describe what this PR aims to solve. Include background context that will help reviewers understand the purpose of the PR.

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

writinwaters and others added 2 commits April 22, 2026 11:48
### What problem does this PR solve?

Added v0.25.0 release notes

### Type of change


- [x] Documentation Update
### What problem does this PR solve?

As description.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
@xugangqiang
xugangqiang deleted the branch xugangqiang:doc-metadata-config April 22, 2026 04:49
xugangqiang pushed a commit that referenced this pull request May 25, 2026
…infiniflow#14849)

## What problem does this PR solve?

Closes infiniflow#12582.

When a Retrieval component sits inside an Iteration with a **manual**
metadata filter that references the iteration variable (e.g.
`{IterationItem:abc@item}`), every iteration reuses the value resolved
on the **first** pass.

Root cause: [`_resolve_manual_filter` in
`agent/tools/retrieval.py`](https://github.com/infiniflow/ragflow/blob/main/agent/tools/retrieval.py#L144-L171)
mutated `flt["value"]` in place. The `filters` list passed in is the
live `self._param.meta_data_filter["manual"]` (see
[`apply_meta_data_filter` in
`common/metadata_utils.py:257-261`](https://github.com/infiniflow/ragflow/blob/main/common/metadata_utils.py#L257-L261)),
so after the first iteration the param dict permanently held the
resolved string instead of the original variable reference.

```text
iter #1: flt["value"] = "{IterationItem:abc@item}"  →  resolved to "AI"
         after mutation: flt["value"] = "AI"        ← written back into _param

iter #2: flt["value"] = "AI"                         ← no {…} matches
         retrieval keeps filtering by "AI" forever
```

This PR returns a shallow copy with the resolved value instead, leaving
the original filter (and its variable reference) intact for the next
iteration.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## Test plan

- [ ] Build an agent: `Agent (structured output → list of areas) →
Iteration → Retrieval (manual filter: Area = {IterationItem/Item}) →
Message`. Run with a multi-area query and confirm each iteration's
Retrieval result matches its own item, not the first item.
- [ ] Regression: Retrieval with a manual metadata filter outside an
Iteration still resolves the variable correctly on each request.
- [ ] Regression: Retrieval with no metadata filter and with `auto` /
`semi_auto` filters behave unchanged.
xugangqiang added a commit that referenced this pull request Aug 17, 2026
- Pad only the header row (not every row) to the furthest merged column,
  and cap that width at maxMergeExtentCols, so a pathological far merge
  (e.g. A1:XFD1) cannot exhaust parser memory or flood data rows with
  empty <td> cells (review comment #5).
- Add tests for padRowToWidth, mergeExtentCol, decodeChunkRows, multi-sheet
  output, empty-sheet handling, and a far-merge no-bloat regression guard.
- Check all Excelize fixture errors in tests (errcheck, review comment #1).
xugangqiang added a commit that referenced this pull request Sep 3, 2026
…uild

The overlap path stores the previous chunk's merged_items as [tailItems...,
cur] and builds cp.Text = overlap + cp.Text, so there is NO separator before
the final (cur) item. overlapTailItems reconstructed offsets by inserting
joinSep before every item (including cur), inflating the rune offsets by one
rune on the JSON path (joinSep="\n") and over-truncating the tail -- the
chained-overlap convergence defect flagged by CodeRabbit #1 on infiniflow#19068.

Reconstruct the offsets to match cp.Text exactly (separator between
consecutive items, none before cur). Positions are still carried wholesale per
item, so output text and coordinates stay correct; this tightens the internal
sliding-window convergence and its truncation precision.

Adds TDD tests:
- TestOverlapTailItems_JoinSepNoSeparatorBeforeCur (RED->GREEN): proves no
  phantom separator before cur under joinSep="\n".
- TestOverlapTailItems_TagBearingUsesVisibleRuneOffsets: tag-free offsets.
- TestMergeByTokenSizeFromJSON_ChainedOverlapPerChunkConvergence: every chunk
  excludes head coordinates, not just the final one.

Co-authored-by: CodeBuddy <[email protected]>
xugangqiang added a commit that referenced this pull request Sep 8, 2026
Addresses the architecture review (F1-F3) and CodeRabbit findings on the
per-chunk cache introduced in feat/ingestion-checkpoint-chunk-cache.

Cache key contract (F1/F2):
- chunkcache.Key now guards an empty modelID symmetrically with an empty
  chunkID, so a caller that forgot to resolve the model cannot collapse
  every model onto one bucket. The doc spells out the modelID semantics:
  embd_id for the "emb" kind, and the chat model id (or resolved tenant
  default) for extractor:*/meta/tagger kinds.
- extractor.go adds extractorCacheModelID, which resolves an empty llmID to
  the real tenant-default chat model identity ("driver/modelName") instead
  of keying on the empty override. This keeps the default-model path cached
  while still scoping entries per actual model.

Key coverage of model inputs (F3 / CodeRabbit #2):
- tagger key now folds in the chunk text from getChunkText (includes
  important_kwd), so a keyword change busts stale tags.
- embedding key now includes the truncated embedded text (post field
  selection + truncation), so a Fields/model change forces a fresh embed.
- Added regression tests pinning the model dimension into the key for the
  extractor / meta / tagger kinds (TestKey_EmptyModelIDYieldsNoKey,
  TestEmbedChunks_CacheKeyScopedByFields,
  TestTaggerCacheKey_ScopedByChunkID_ModelAndText).

Manifest TTL rollback (CodeRabbit #1):
- chunkcache.Set now deletes the manifest key if Expire fails, instead of
  leaving a TTL-less set that leaks one key per abandoned task.

Purge ordering (CodeRabbit #3):
- Moved chunkcache.PurgeTask to after all failure-capable persist steps
  (index write, compiled-product reconcile, Wiki active-state) succeed, so a
  retry still finds the cache intact and does not re-pay every
  embedding/LLM call — which is the cost the cache exists to absorb.

All three packages (chunkcache, component, task) pass `build.sh --test`.
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.

3 participants