Skip to content

search_package_docs: when nothing matches, the answer lists the manual pages the caller may read, so the agent can pick one #38445

In progress

Description

@objectstack-fleet

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

Filing gate: ③ maintainer-directed · Source: maintainer. Ruling-ref: 「目录兜底,A 暂停」 (record 7249168223 on #38352, 2026-11-29T02:01Z; the analysis he read is 7248908940). Filed under #37000 by seat repo:objectstack#5 area o5-ai37000, as that record's Next asks.
Grading: area:ai · Feature · p2 (maintainer-sourced; #38352's grade) · reach: every deployment that serves search_package_docs, on every edition · evidence: measured on a connected HotCRM test deployment in 7247373051 (潜在客户 0 hits, 谁来跟进新线索 0 hits, prospect hits a stage name, not the Leads page) and read from the code on main 0c1b2ff.

维护者速读

  • 做什么:智能体用手册搜索(search_package_docs)搜不到时,回答里附上它能看的手册目录(每页的名字、标题、所在手册、链接),让它自己挑一页,再用 read_package_doc 读。
  • 为什么:手册搜索只认原词。用户说「潜在客户」「催款」,手册写的是「线索」「回款」,今天搜不到就只能说手册没写。
  • 影响:所有部署一样生效。不用嵌入服务,内容不外发,不改受管文本。目录照样先过手册可见范围,看不到的页不出现,也不透露有多少页被挡。约 1 个 PR。
  • 要你做的:无。按您的裁决,A 等本卡的实测结果再提。

What happens today

createPackageDocMembers().searchPackageDocs (packages/runtime/src/domains/mcp-package-docs.ts:356) reads the docs and books the caller may read through the docs-audience gate (readableDocsAndBooks, :118). It then keeps only the pages whose title, a heading or the text contains a term (:365–392). With no term found it answers { terms, results: [], truncated: false }, and the server instruction (packages/mcp/src/mcp-server-runtime.ts:1994–1997) then has the model say the manuals do not cover it. A paraphrase of a word the manual uses finds nothing.

What

  1. When the search answers no hit (results empty after the gate), the answer also carries contents. That is the list of pages the caller may read, from the same readableDocsAndBooks read, within package when it is given. Each entry is the existing address shape McpPackageDocAddress (name, package?, title, book?, url?, packages/mcp/src/mcp-http-tools.ts:499), with no excerpt. The order is book order, then page order within the book, as the console's manual shows them.
  2. Gate first. The list is built only from pages the gate already passed. Nothing about a page the caller cannot read is returned: no entry, no count, and no truncated computed over unreadable pages (the gate order of 7247373051, ADR-0161 K9 rule 6 by analogy).
  3. Size cut. At most PACKAGE_DOC_CONTENTS_MAX_ENTRIES entries (50). Over that, contentsTruncated: true, and the description tells the model to narrow with package. Pages are cut whole, never mid-book where a book fits.
  4. A search with one hit or more carries no contents: the answer stays as it is today. The few-hit case is not covered here. If the probes show it matters, it comes back as its own card.
  5. The search_package_docs description and the server instruction say that when nothing matches, the answer lists the manual's pages. The model picks a page by its title and reads it with read_package_doc. If no title fits, it says the manuals do not cover it. Both stay true of the substring match.
  6. SearchPackageDocsOutput gains contents? and contentsTruncated? (packages/mcp/src/mcp-http-tools.ts:532), both optional and absent when there are hits.

Acceptance (each pinned)

Not in scope

Any meaning match or embedder (option A, on hold by the ruling); egress of manual text; option B or C; a server-side doc index; governed text (docs/adr/**, skills/**).

Declarations expected: Clause-②: yes (widening) (an added optional member of the published search_package_docs answer) · Metadata-protocol: none · a minor changeset on @objectstack/mcp and @objectstack/runtime.
Size: M (about 1 PR).
Related: #38352 (Restart-when names this card), #37000, #35442 (the docs tools), ADR-0046 (book-level search deferred, P3d).

Activity

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

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-project-manager · session_01FEkQ5oQLfL8thb6wtUHnTb
    Claim: PM loop round 1 · 2026-11-29T02:07Z
    Session: session_01FEkQ5oQLfL8thb6wtUHnTb
    Account: os-project-manager
    Branch: claude/issue-38445-package-docs-contents-fallback
    Worktree: objectstack-issue-38445
    Domain: domain:server
    Seat: repo:objectstack#5
    Area: o5-ai37000
    File surface: packages/runtime/src/domains/mcp-package-docs.ts (+ mcp-package-docs.test.ts), packages/mcp/src/mcp-http-tools.ts (the search_package_docs types, description and registration only), packages/mcp/src/mcp-server-runtime.ts (the docs paragraph of the server instruction only), packages/mcp/src/mcp-package-doc-tools-35442.test.ts, packages/mcp/src/package-doc-answer-rule-barrel-35633.test.ts, packages/mcp/src/mcp-server-runtime.agent-prompt-advertised.test.ts, one changeset .changeset/38445-package-docs-contents.md (stop on breach; explain in the report). packages/mcp/src/plugin.ts is not in it: card #38369's surface.
    Container & model: M, mode:subagent, model: default (dispatch-gates --tier at 0c1b2ff, "Model tier — no path-derived mandate"; a gate-order and answer-shape design, so not floor), effort: high (M)
    Clause-②: yes (widening)
    Metadata-protocol: none
    Responsibility: n/a — not a defect card
    Thread-read: none
    Premise: holds at 0c1b2ff — searchPackageDocs (packages/runtime/src/domains/mcp-package-docs.ts:356) reads the readable docs and books through the docs-audience gate (readableDocsAndBooks, :118) and then matches by substring (:365–392); with no term found it answers { terms, results: [], truncated: false } (:396–400); SearchPackageDocsOutput is packages/mcp/src/mcp-http-tools.ts:532, the address shape McpPackageDocAddress :499, the tool registration :3573–3600; the server instruction's docs paragraph is mcp-server-runtime.ts:1994–1997. The paraphrase miss is measured in 7247373051.
    Serial constraints cleared: check-handover --inflight at 0c1b2ffe: clear for the seven paths; no open pull touches mcp-package-docs.ts, mcp-http-tools.ts or mcp-server-runtime.ts (file lists read); card thread #38369 (this area) registers search_knowledge in the same mcp-http-tools.ts file outside its claimed surface: overlap-check before every push
    Pre-claim lane: packages/runtime/**, packages/mcp/** ⇒ domain:server (file ownership only); in this area by the seat's order (02:02Z, the #38352 round-2 fallback card under #37000).
    Pre-claim deps: none.
    Prior rulings read: record 7249168223 on #38352 「目录兜底,A 暂停」 (the card's what, gate first, no embedder, no egress, no governed text; its "Not ruled" items are the card's to state); 7247373051's gate order (gate, then match); ADR-0046 §6.7 (the docs-audience gate) and P3d (book-level search deferred), not re-opened.
    Widening: an added optional member (contents, contentsTruncated) of the published search_package_docs answer. Owed: the lane seat's own review of record on the Clause-②: yes declaration (TIER_DEFAULT), L1-a, then this area lands it if check-governed-merges --pr reads not governed.

  3. added
    pm:dispatched
    on Nov 29, 2026
  4. objectstack-fleet commented on Nov 29, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-project-manager · session_01FEkQ5oQLfL8thb6wtUHnTb
    os-dev-report

    {
      "issue": 38445,
      "status": "done",
      "branch": "claude/issue-38445-package-docs-contents-fallback",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/38462",
      "session": "session_01FEkQ5oQLfL8thb6wtUHnTb",
      "premise_still_valid": true,
      "summary": "searchPackageDocs (runtime mcp-package-docs.ts) now answers, only when nothing matches, `contents` (the gate-passed pages within `package`, each the exact address a hit carries via addressOf, no excerpt) and `contentsTruncated`, capped by PACKAGE_DOC_CONTENTS_MAX_ENTRIES = 50 (mcp-http-tools.ts, sent to the member as opts.maxContents). Order is the Console's, measured in ui/apps/console/src/pages/book-nav.ts (buildPortalBooks/sortBooks/resolveBookTree): authored manuals by order then label as served in the request locale, then implicit manuals, pages in their home manual's tree order, packageless pages last; titles in the request locale as read_package_doc serves them. A hit answer is byte-identical to main ({terms, results, truncated}). SearchPackageDocsOutput gains contents?/contentsTruncated?; the tool description and packageDocAnswerRule say to read the page whose title fits, else say the manuals do not cover it. Zone 2 measured: (1) order reused from the console as above; (2) stdio does not serve the doc tools (stdio-data-bridge.ts carries no doc members; both transports compose through wireBridgeTools), plugin.ts untouched; (3) probes ran over HotCRM's real manual (no in-repo example ships a CRM manual): before, 潜在客户/销售机会/催款/谁来跟进新线索 answered 0 hits and nothing else; after, each answers 0 hits plus contents of the member's 25 readable pages (4 admin pages absent, contentsTruncated false), whose titles include 线索——分配与转化, 商机——阶段、提醒与审批, 回款计划, 发票与回款; 签批 (3 hits via a heading) and prospect (1 hit via a stage name) still hit, so no contents; the control 线索 answers 9 hits and no contents. A live agent loop was not run (NOT MEASURED); the title-to-page picks in the PR body are my reading.",
      "tests": "At d6430a29: pnpm --filter @objectstack/mcp test: Test Files 88 passed (88), Tests 1653 passed (1653); mcp typecheck exit 0 (lock VERDICT command-exit 0). pnpm --filter @objectstack/runtime test: Test Files 656 passed (656), Tests 12491 passed | 25 skipped (12516). runtime typecheck: tsc --noEmit green; check:test-typecheck first read 3 TS2307 in three untouched turso test files because @objectstack/driver-turso had no dist here; after building it: 'check:test-typecheck: OK', VERDICT command-exit 0. mcp-package-docs.test.ts 35 passed (28 + 7 new). Ablation on disk against the committed fix: zero-hit branch disabled -> 6 of 7 new cases red (hit pin green); contents built from unscoped docs -> the package case red; file restored identical to HEAD. Probes: temporary test (not committed) over HotCRM 142e7a1 docs via collectDocsFromSrc + transcribed books, through HttpDispatcher.handleMcp bridge and MCPServerRuntime tools/call, before (base 84477b9e member code) and after.",
      "gates": "Local: dispatch-gates.mjs --commands (69 families) run at d6430a29 with exit codes captured before any pipe: 68 exit 0; pnpm check:dual-build-cjs-loads exit 3 PREREQUISITE NOT MET (needs every package dist) = NOT MEASURED locally, CI Lint & Repo Gates owns it. --ran with exit codes: '69 derived, 68 run, 1 NOT-MEASURED, 0 UNRUN' (✓ verdict line). overlap-check --branch=HEAD: VERDICT clean exit 0 (first attempt exit 3 on a GitHub 502, retried). CI: at report time every PR check-run on d6430a29 was in_progress (Check Changeset, Lint · *, Type Check · *, Governed Surface Queue Guard, PR-body guards, ...); conclusions NOT MEASURED, PM reads CI convergence.",
      "dogfood_battery": "n/a — no `!` in the PR title and the declaration carries the (widening) arm, not (narrowing)",
      "mcp_calls": "0",
      "api_writes": "2 — fleet-write relay pr_create (POST /repos/objectstack-ai/objectstack/pulls + POST /issues/38462/assignees, run 46219004901, read-back identical); os-dev-report comment POST /repos/objectstack-ai/objectstack/issues/38445/comments via post-stamped.mjs. Plus git push (not REST) twice: the empty-branch probe and d6430a29.",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed — packages/mcp/README.md (lines 88-95, 170) describes the docs pair without the new contents member; still true, outside the claim's file surface; in the PR's Acceptance notes",
        "carrier: none · noted, not filed — the Console labels an implicit manual by a humanized package id while the MCP address (unchanged from main) labels it by the package id, so implicit manuals sort by the id; in the PR's Acceptance notes",
        "carrier: #38352 · noted, not filed — the few-hit case (card What 4): on HotCRM 签批 hits via a heading and prospect hits a stage name, so neither answers contents; the probe table is in the PR body for the area to copy onto #38445 and #38352"
      ]
    }
  5. objectstack-fleet commented on Nov 29, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · sunhaolin · session_017xRBcSxvUE3fDrox79CL9t

    Triage (record; in flight, labels untouched): lands in packages/runtime/src/domains/mcp-package-docs.ts, packages/mcp/src/mcp-http-tools.ts, mcp-server-runtime.ts and their tests · area:ai · domain:server · Feature · p2 · pm:dispatched (draft PR #38462) · size M. Rationale: it adds answer members (contents, contentsTruncated) to the published search_package_docs output, a widening that executes the maintainer's ruling on #38352 (「目录兜底,A 暂停」). So it is pre-authorised, Clause-②: yes (widening). Attached to topic #37000 as a sub-issue in this pass. For L1: acceptance item 1 asks for the paraphrase probes end to end through an agent, and the dev report says the live agent loop was not measured. packages/mcp/README.md still describes the docs pair without contents.
    Recorded 2026-11-29T03:48Z.

  6. objectstack-fleet commented on Nov 29, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-project-manager · session_01FEkQ5oQLfL8thb6wtUHnTb
    os-dev-report

    {
      "issue": 38445,
      "status": "done",
      "branch": "claude/issue-38445-package-docs-contents-fallback",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/38462",
      "session": "session_01FEkQ5oQLfL8thb6wtUHnTb",
      "premise_still_valid": true,
      "summary": "Patch round on L2 FAIL record 7249958046, new head 3c22f05073 (merge of origin/main f459c863 at 8b594999, then one commit). M1: .changeset/38445-package-docs-contents.md grades @objectstack/mcp and @objectstack/runtime patch, both declaration lines kept; CI Check Changeset is now success. N1: the runtime member caps contents at PACKAGE_DOC_CONTENTS_DEFAULT_MAX = 50 when maxContents is absent or not a whole number >= 0 (member opts type maxContents?: number; the bridge type keeps it required). Deviation from 'defaults to the exported cap': @objectstack/runtime carries no runtime dependency on @objectstack/mcp by design (mcp is a devDependency; packages/runtime/src/domains/mcp.ts:545-552) and exporting the cap from the mcp barrel would add packages/mcp/src/index.ts outside the claim's file surface, so the runtime keeps its own 50 and each package's test pins its constant to 50. N2: the description now says each entry has its name and title and, where the page has them, its manual and url. N3: the comment now says how such pages are listed. The reviewer's reading that the home manual's tree does not list a page no manual of its package claims is not what the code does: resolveBookTree is called without sibling books, so that page lands in the home manual's Uncategorized group, after the claimed pages. A new case pins it (['ops_b', 'ops_a'], ops_a addressed through ops_manual). The append after the tree stays as a guard. Updated PR body written to /tmp/claude-0/-home-user/d80d6232-fbae-5e94-adce-f0c5c0a62e97/scratchpad/issue-38445/pr-body.md, not PATCHed.",
      "tests": "At 3c22f05073, one && chain under the verify lock (VERDICT command-exit 0): build closure 43/43 successful; pnpm --filter @objectstack/mcp test: Test Files 88 passed (88), Tests 1653 passed (1653); mcp typecheck: check:test-typecheck OK; pnpm --filter @objectstack/runtime test: Test Files 656 passed (656), Tests 12493 passed | 25 skipped (12518); runtime typecheck: check:test-typecheck OK. Two new runtime cases: a call without maxContents is capped at 50 with contentsTruncated true; a page no manual of its package claims is listed after that manual's claimed pages. The ablation from round 1 (at d6430a29) stands for the zero-hit branch and package scoping. No new ablation in this round; the default-cap case would go red with the default removed (slice(0, undefined) lists all 60).",
      "gates": "Local at 3c22f05073: dispatch-gates.mjs --commands derived 69 families, the same list as at d6430a29; 68 exit 0, pnpm check:dual-build-cjs-loads exit 3 PREREQUISITE NOT MET (NOT MEASURED locally). --ran with exit codes: '69 derived, 68 run, 1 NOT-MEASURED, 0 UNRUN' (✓). overlap-check --branch=HEAD: VERDICT clean exit 0. CI on 3c22f05073, all completed success: Check Changeset, Lint & Repo Gates, TypeScript Type Check, Test Core (12/12 shards and the aggregate), Build Core, Governed Surface Queue Guard, Test UI, Live E2E UI, Dogfood Regression Gate, PR-body guards, Check PR Size, every Lint and Type Check sub-job. Not seen in the list: Lint UI, Type Check UI, Build & E2E UI, Temporal Conformance (path-skipped or not yet listed).",
      "dogfood_battery": "n/a — no `!` in the PR title and the declaration carries the (widening) arm, not (narrowing)",
      "mcp_calls": "0",
      "api_writes": "1 this round — os-dev-report comment POST /repos/objectstack-ai/objectstack/issues/38445/comments via post-stamped.mjs. git push (not REST) once: d6430a29..3c22f050. PR body not PATCHed, per the order; it is at the scratchpad path above. Round 1: pr_create (pulls + assignees) and one report comment.",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed — packages/mcp/README.md (lines 88-95, 170) describes the docs pair without the new contents member; still true, outside the claim's file surface; in the PR's Acceptance notes",
        "carrier: none · noted, not filed — the Console labels an implicit manual by a humanized package id while the MCP address (unchanged from main) labels it by the package id, so implicit manuals sort by the id; in the PR's Acceptance notes",
        "carrier: #38352 · noted, not filed — the few-hit case (card What 4): on HotCRM 签批 hits via a heading and prospect hits a stage name, so neither answers contents; the probe table is in the PR body"
      ]
    }
  7. objectstack-fleet commented on Nov 29, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Probe result, tool half (acceptance item 1)

    PR #38462 (head 3c22f05) measured what the agent receives for the four paraphrases, before (84477b9) and after, through the real /mcp bridge and the real search_package_docs tool, over HotCRM's real manual (29 pages, 8 books, a member without the admin set). The four paraphrases go from 0 hits and nothing to read, to 0 hits plus a 25-page table of contents in manual order; 签批 and prospect still hit and carry no contents; the control 线索 answers 9 hits and no contents.

    Owed, NOT MEASURED: the agent half of item 1, which page a live model picks from that table and whether it then answers. This container has no agent loop. So PR #38462 is Part of #38445, and this card stays open for the agent probe; #38352's Restart-when is unchanged and has not fired.

    No in-repo example ships a CRM manual (examples/app-crm has no docs), so the probes ran over HotCRM's real manual: its 29 pages collected by the CLI's own loader (collectDocsFromSrc, packages/cli/src/utils/collect-docs.ts) from a local HotCRM checkout at 142e7a1, its 8 books transcribed from its *.book.ts files (the admin manual behind permissionSet: system_admin), served through the real /mcp bridge (HttpDispatcher.handleMcp) for a signed-in member without that set, and called through the real search_package_docs tool (MCPServerRuntime.handleHttpRequest, tools/call). Request locale zh-CN; with no locale the results are the same, with English titles. The probe was a temporary test file, not committed.

    term before after
    潜在客户 0 hits (none); no contents 0 hits; contents 25 pages, contentsTruncated false
    销售机会 0 hits (none); no contents 0 hits; contents 25 pages, contentsTruncated false
    签批 3 hits (crm_sales_opportunities, crm_overview, crm_getting_started); no contents 3 hits; no contents
    催款 0 hits (none); no contents 0 hits; contents 25 pages, contentsTruncated false
    谁来跟进新线索 0 hits (none); no contents 0 hits; contents 25 pages, contentsTruncated false
    prospect 1 hits (crm_sales_opportunities); no contents 1 hits; no contents
    线索 9 hits (crm_sales_leads, crm_analytics_metrics, crm_sales_activities, crm_overview, crm_ai_skills, crm_sales_opportunities, crm_getting_started, crm_marketing_campaigns, crm_marketing_automation); no contents 9 hits; no contents

    The 25 pages are the member's readable set (the 4 admin pages are absent), in manual order: User Manual (overview, getting started, assistant, then 线索——分配与转化, 商机——阶段、提醒与审批, 合同, 订单, 活动, 指标), Revenue, Marketing, Order to Cash (回款计划, 发票与回款), Service, Project Delivery, Expenses. By title, 潜在客户 and 谁来跟进新线索 lead to crm_sales_leads (线索——分配与转化), 销售机会 to crm_sales_opportunities (商机), and 催款 to crm_o2c_invoices_payments / crm_o2c_collection_plan (回款). Which page a live model picks was not run here (NOT MEASURED: no agent loop in this container); the answers above are what it receives. The positive control 线索 answers hits and no contents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:aidomain:serverpm:dispatchedpriority:p2

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions