Skip to content

[OPS-PTC P5] 区分未加载、已撤销及禁止调用的工具 #997

Closed

Description

@Thatgfsj

P5 · 区分未加载、已撤销及禁止调用的工具

总计划 #978,所属工作流 #978。

问题:注册表里的定义不一定属于当前请求。诊断装配可能看到完整池,正常 step 的程序绑定应与其 SDK 声明相符。

前置条件:可先复现;与 D3 串行修改 publication。

从哪里读

  • src/publication/ptc.ts
  • src/publication/registrar.ts
  • test/ptc-declaration-surface.test.mjs

认领前记录当前 main SHA。以上为优先检查的范围,需要扩大写域时先说明文件与原因。

按顺序执行

  1. 用同一 agent 分别捕获带 toolSet 的请求和不带 toolSet 的诊断装配,标记各自用途;分别留存已注册、已声明、已准入的名字。
  2. 按“本步可用、需加载、权限不允许、作用域已撤销”列出四行输入输出。先为实际经过分发器的失败写断言,再改错误分类。
  3. 执行加载操作并提交 step/end,在下一步检查选择;降为只读后检查撤销。若程序中压根没有该属性,应区分 JS 缺失绑定和工具返回的错误。

验收清单

  • 允许但未加载的名字不冒充本步可调;有 loader 才建议 load。权限禁止时不建议重新加载同一工具。
  • Native 子 agent 恢复其原有发布面;撤销的授权不能因重新装配复活。

范围边界与停手条件:不通过注册全池来掩盖未加载,不把无 toolSet 的快照报成正常首个模型请求。

验证与交付

先运行 npm run build;依赖 native worker 的测试先运行 npm run build:ptc。定向入口:node test/run.mjs ptc-declaration-surface。确认过滤器命中目标套件,记录实际 pass / skip / fail。

认领模板:编号 / 当前 SHA / 目标文件 / 第一个失败样例。提交时贴修改前与修改后结果,以及撤掉改动后会失败的断言。已有 PR 请先在原讨论协作。行为及中英文文档同 PR。


原问题讨论:#968。本单与其指向同一交付,评论处保留原始复现记录。

Activity

  1. Thatgfsj commented on Nov 19, 2026

    @Thatgfsj
    CollaboratorAuthor

    认领 P5。\n\n- 编号:997\n- 基线:main@58f6e28;工作分支 card/p5-declaration-admission,叠加在 card/d3-full-publication(d0fcd6f)之上\n- 要改的文件:src/publication/ptc.ts、src/publication/registrar.ts、test/ptc-declaration-surface.test.mjs(按仓库规则同步双语设计决策文档与 CHANGELOG Unreleased,不扩其他代码文件)\n- 第一个失败样例(先红):dsh-ops test: 1 suites, 16 worker(s); exclusive suites run afterwards

    === ptc-declaration-surface.test.mjs (0.42s)
    dsh-ops: native worker selected without provenance verification — explicit selection (config.binaryPath / DSH_OPS_WORKER_BIN) — trusting the named path is the whole point of selecting it: /home/thatgfsj/.local/node-v24.21.0-linux-x64/bin/node
    ok a loader-less scope declares no selectable API even without a step tool set
    dsh-ops: native worker selected without provenance verification — explicit selection (config.binaryPath / DSH_OPS_WORKER_BIN) — trusting the named path is the whole point of selecting it: /home/thatgfsj/.local/node-v24.21.0-linux-x64/bin/node
    ok an explicit full tier declares the whole permitted pool in the first round, loader-less
    dsh-ops: native worker selected without provenance verification — explicit selection (config.binaryPath / DSH_OPS_WORKER_BIN) — trusting the named path is the whole point of selecting it: /home/thatgfsj/.local/node-v24.21.0-linux-x64/bin/node
    ok read-only keeps mutating APIs out of the full-tier declaration
    dsh-ops: native worker selected without provenance verification — explicit selection (config.binaryPath / DSH_OPS_WORKER_BIN) — trusting the named path is the whole point of selecting it: /home/thatgfsj/.local/node-v24.21.0-linux-x64/bin/node
    ok an empty allowed pool declares only the resident surface plus result
    dsh-ops: native worker selected without provenance verification — explicit selection (config.binaryPath / DSH_OPS_WORKER_BIN) — trusting the named path is the whole point of selecting it: /home/thatgfsj/.local/node-v24.21.0-linux-x64/bin/node
    ok duplicate allowed names register exactly once in the full tier
    dsh-ops: native worker selected without provenance verification — explicit selection (config.binaryPath / DSH_OPS_WORKER_BIN) — trusting the named path is the whole point of selecting it: /home/thatgfsj/.local/node-v24.21.0-linux-x64/bin/node
    ok the same agent keeps registered, declared and admitted names distinct across the two assembly paths
    dsh-ops: native worker selected without provenance verification — explicit selection (config.binaryPath / DSH_OPS_WORKER_BIN) — trusting the named path is the whole point of selecting it: /home/thatgfsj/.local/node-v24.21.0-linux-x64/bin/node
    FAIL a diagnostic assembly without a tool set is not reported as a first model request
    AssertionError [ERR_ASSERTION]: the pending load survives the diagnostic assembly
    + actual - expected

         [
       -   'ops_batch',
           'ops_inspect_local_file',
           'ops_load_sdk'
         ]
       
           at file:///home/thatgfsj/AIagent/wt-p1b/test/ptc-declaration-surface.test.mjs:160:12
           at async test (file:///home/thatgfsj/AIagent/wt-p1b/test/lib/harness.mjs:79:5)
           at async file:///home/thatgfsj/AIagent/wt-p1b/test/ptc-declaration-surface.test.mjs:144:1
    

    dsh-ops: native worker selected without provenance verification — explicit selection (config.binaryPath / DSH_OPS_WORKER_BIN) — trusting the named path is the whole point of selecting it: /home/thatgfsj/.local/node-v24.21.0-linux-x64/bin/node
    FAIL calling an unloaded pool member through the dispatcher points at the loader, not at denial
    AssertionError [ERR_ASSERTION]: {"status":"rejected","error":{"code":"POLICY_DENIED","message":"This API must be admitted for the calling PTC scope; no action executed.","effectState":"none","retry":"never","nextAction":"Correct the request or restore host authority."},"data":{"status":"error","error":{"code":"POLICY_DENIED","phase":"preflight","retryable":false,"effectState":"none","nextAction":"Correct the request or restore host authority.","message":"This API must be admitted for the calling PTC scope; no action executed."}}}
    + actual - expected

       + 'POLICY_DENIED'
       - 'SDK_NOT_LOADED'
       
           at file:///home/thatgfsj/AIagent/wt-p1b/test/ptc-declaration-surface.test.mjs:178:12
           at async test (file:///home/thatgfsj/AIagent/wt-p1b/test/lib/harness.mjs:79:5)
           at async file:///home/thatgfsj/AIagent/wt-p1b/test/ptc-declaration-surface.test.mjs:165:1
    

    dsh-ops: native worker selected without provenance verification — explicit selection (config.binaryPath / DSH_OPS_WORKER_BIN) — trusting the named path is the whole point of selecting it: /home/thatgfsj/.local/node-v24.21.0-linux-x64/bin/node
    FAIL a permission-forbidden API answers denial without a load suggestion
    AssertionError [ERR_ASSERTION]: {"status":"error","error":{"code":"INVALID_ARGUMENT","message":"API is not in this scope’s allowed pool: batch","effectState":"none","retry":"after-input-change","nextAction":"Correct the request or restore host authority."}}
    + actual - expected

       + 'INVALID_ARGUMENT'
       - 'POLICY_DENIED'
       
           at file:///home/thatgfsj/AIagent/wt-p1b/test/ptc-declaration-surface.test.mjs:196:12
           at async test (file:///home/thatgfsj/AIagent/wt-p1b/test/lib/harness.mjs:79:5)
           at async file:///home/thatgfsj/AIagent/wt-p1b/test/ptc-declaration-surface.test.mjs:186:1
    

    dsh-ops: native worker selected without provenance verification — explicit selection (config.binaryPath / DSH_OPS_WORKER_BIN) — trusting the named path is the whole point of selecting it: /home/thatgfsj/.local/node-v24.21.0-linux-x64/bin/node
    FAIL a loaded API whose admission is later withdrawn answers a revoked verdict
    AssertionError [ERR_ASSERTION]: The input did not match the regular expression /revoked/. Input:

       'This API must be admitted for the calling PTC scope; no action executed.'
       
           at file:///home/thatgfsj/AIagent/wt-p1b/test/ptc-declaration-surface.test.mjs:229:14
           at async test (file:///home/thatgfsj/AIagent/wt-p1b/test/lib/harness.mjs:79:5)
           at async file:///home/thatgfsj/AIagent/wt-p1b/test/ptc-declaration-surface.test.mjs:212:1
    

    FAIL a pulled publication grant answers revoked rather than never available
    AssertionError [ERR_ASSERTION]: {"status":"rejected","error":{"code":"PUBLICATION_GRANT_UNAVAILABLE","effectState":"none","retry":"never","message":"Publication has no eligible grant or has conflicting dispatch grants for this agent."}}
    + actual - expected

       + 'PUBLICATION_GRANT_UNAVAILABLE'
       - 'PUBLICATION_GRANT_REVOKED'
                            ^
       
           at file:///home/thatgfsj/AIagent/wt-p1b/test/ptc-declaration-surface.test.mjs:263:12
           at async test (file:///home/thatgfsj/AIagent/wt-p1b/test/lib/harness.mjs:79:5)
           at async file:///home/thatgfsj/AIagent/wt-p1b/test/ptc-declaration-surface.test.mjs:244:1
    

    dsh-ops ptc-declaration-surface: 5 of 11 check(s) failed

    10 slowest suites:
    0.42s ptc-declaration-surface.test.mjs → 5 of 11 check(s) failed。首例 a diagnostic assembly without a tool set is not reported as a first model request:pending 的 load 被无 toolSet 诊断快照当作首个模型请求消费,step/end 后声明缺 ops_batch(期望 )。\n\n另四例红:未加载池成员经分发器返回泛化 POLICY_DENIED(应 SDK_NOT_LOADED 指向 ops_load_sdk,仅当 loader 存在);只读下经 loader 请求池内变更 API 答 INVALID_ARGUMENT "not in this scope's allowed pool"(应 POLICY_DENIED 权限不允许、不给加载建议);已加载后降只读的分发仍是泛化 POLICY_DENIED(应区分已撤销);registrar 授权被拉走后空集仍答 PUBLICATION_GRANT_UNAVAILABLE(应 PUBLICATION_GRANT_REVOKED)。与 OPEN PR #1007 已覆盖范围(#968 loader 指针、#764 discover 指针、#934/#962)不重叠,已在其评论区留协作说明。

  2. Thatgfsj commented on Nov 20, 2026

    @Thatgfsj
    CollaboratorAuthor

    已由 #1033 合入 main 交付(18 张卡并集,见 PR 描述与 docs/CHANGELOG.md 的 Unreleased 条目)。

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions