Skip to content

knowledge_source: a hit brings its neighbouring content (expand, siblings slice of the #38412 ruling) #38504

Backlog

Description

@objectstack-fleet

repo:objectstack#5 · os-project-manager · session_01FEkQ5mzSTSPADAvwapnhxr

Filing gate: ① ruled. Ruling-ref: 7251603512 on #38412 (maintainer 「A 精简:排序加带出」, option A-lean; analysis 7251063339). Built to the ADR-0161 dated note of 2026-11-29 (PR #38511, merged; card #38502), K1 "What follows from the two lists". Body rewritten by the seat after the note landed (the first body said "both stores" and predates the note's shape).
Grading: area:ai · Feature · p3, dispatched in the topic's order · reach: every app with a knowledge source · contract-tier review (a new authorable key, built to the note).
Part of #38346.

维护者速读

What

Build source.expand.window exactly as the note fixes it (the note's bullets "◆ expand.window", "◆ Neighbouring passages are cut again from the record", "When a hit brings no neighbours", "◆ How an expansion rides", "Refused when it is written", "No index is rebuilt"):

  • The key, on the object arm, with its first reader (K4, K10 rule 1). Set the upper bound of window and state it on the key (the note fixes no number).
  • Neighbours are cut again from the hit's record (splitDocument) under the expected fingerprint when the record's hash equals the hit's docHash; no adapter member is added. Only adapters declaring capabilities.chunks.
  • They ride as neighbours { offset, snippet, headingPath? } beside the hits on the report the tool already reads; KnowledgeHit gains no key, IKnowledgeService.search keeps its signature, the tool gains no argument.
  • Not counted in topK, not ordered, no passage answered twice in one answer; under record granularity, the neighbours of the passage standing for the record or group.
  • The no-neighbour cases answer the hit as today with nothing saying why, and the stale-hash case repairs the document as the freshness check does.
  • Refusals at write time: window on a whole split; not a positive integer; over the bound.
  • Carry nit N4 of the note's review: one log line when a whole batch's re-cut comparison fails.

Acceptance

  • A source declaring window returns each hit with its neighbours, attached only for a row that passed the caller's re-check in this search; a source not declaring it answers byte-for-byte as before.
  • Each no-neighbour case of the note is pinned (no chunks capability, no docHash or record id, hash behind the record, no passage with the hit's chunkId or a snippet mismatch, a failed read).
  • The refill bound and the no-count rule (K9 rule 6, K10 rule 4) hold; tests pin both.
  • The docs sentences this code makes untrue are rewritten in the same PR, never ahead of it (K2).

Not in scope: affinity (#38503); expand.follow (#38505); the heading-bounded mode (siblingsBy, not taken by the note); filter mode; date decay; any opt-out argument on the tool.

Dedupe: expand neighbouring passages knowledge_source 0 open.

Activity

  1. added
    area:ai
    domain:server
    on Nov 29, 2026
  2. objectstack-fleet commented on Nov 29, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · sunhaolin · session_017xRBcSxvUE3fDrox79CL9t

    Triage: lands in packages/spec/src/ai/knowledge-source.zod.ts (the expand neighbouring-content key) and packages/services/service-knowledge (knowledge-tools.ts hit shape, re-cutting neighbours from the live record), with pins · area:ai · domain:server (+ domain:spec for the key) · Feature · p3 · pm:blocked (Blocked-by: #38502, in the body) · size M. Rationale: the expand siblings slice named by the maintainer's #38412 ruling (record 7251603512), so pre-authorised execution. Its key and reading are fixed by the Tier H note #38502 (draft PR #38511). The card carried no pm state, a half state this touch resolves. Once the note merges, the seat rewords "both stores": the note re-cuts neighbours from the live record and changes no store.

    Recorded 2026-11-29T06:54Z.

  3. added
    pm:blocked
    on Nov 29, 2026
  4. added
    pm:queue
    and removed
    pm:blocked
    on Nov 29, 2026
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

    area:aidomain:serverpm:queuepriority:p3

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions