Skip to content

fix(publication): point deferred tools at their loader and fail open on executor failure (#968, #764, #934, #962) - #1007

Closed
Nicholas023 wants to merge 6 commits into
mainfrom
fix-publication-ptc-local
Closed

Nicholas023 wants to merge 6 commits into
mainfrom
fix-publication-ptc-local

Conversation

@Nicholas023

Copy link
Copy Markdown
Collaborator

Closes #968, #764, #934, #962

What was wrong

The change

  • src/publication: deferred rejections now answer SDK_NOT_LOADED (naming ops_load_sdk and the raw name, effective next model step) and CAPABILITY_NOT_SELECTED (naming ops_discover_tools and a select: query), keeping the honest generic denial when the policy cannot load/select at all. The registrar consults every same-agent deferred() advisor in grant order; undefined/throwing advisors no longer mask a later pointer.
  • src/publication/replacements.ts: an unrecoverable counterpart executor failure (bash-runtime-missing, bash-ipc-mismatch, bash-lifecycle-lock-busy, bash-cache-unusable, bash-runtime-incompatible) stops hiding the official tools from that agent's next model step; staging interruptions that the next call repairs keep the replacement.
  • src/legacy/host.ts: the tooling table is rendered from the calling scope's admitted view (step tool set with a context.scope fallback).
  • New tests: ptc-deferred-rejection 4/4, discovery-deferred-rejection 4/4, publication-fail-open 4/4, publication-legacy-admission-surface 2/2, publication-registrar 14/14; 46-suite regression batch green; check:size 826 files.

Validation

$ npm run build
build: compiled src/ to lib/ and copied 60 assets

$ node scripts/verify-gate.mjs --skip-install --keep-going
268 suites passed; skipped: linux-attributes, linux-shell, tui-host, tui-native (allowed: file-metadata, linux-attributes, linux-shell, tui-host, tui-native)
manifest: 92/59 checks
win32-x64: gate green

The gate lines above were produced on the local integration head b21274dd (all slices merged) with the pinned local fixtures:
DSH_OPS_TEST_BASH = a verified pinned MSYS bash (sha256 6cc575e9…), DSH_OPS_NIUBASH_ARCHIVE = the shipped frozen archive. Each PR branch was also built and its own suites were run before push; the counts below are from those runs.

CI required run: the pull_request event for this PR triggers ci.yml; paste the aggregate CI required run URL here once it finishes.

Environment

  • OS: Windows x64 25H2; Node.js v24.21.0; DSH 0.2.2-rc.1
  • Based on upstream main commit 58f6e281 (origin/main at submission)
  • Install channel: local source build (npm ci --ignore-scripts --offline, npm run build, npm run stage:niubash -- --offline --archive <frozen archive>)

A registered-but-unselected pool API answered direct dispatch with PUBLICATION_GRANT_UNAVAILABLE (retry: never) on the file-lease path and a bare POLICY_DENIED on the PTC-only path, neither naming the loader. The registrar lease contract gains an optional deferred() advisor that pool publications supply; both paths now answer SDK_NOT_LOADED with a next action naming ops_load_sdk and the raw name, and stay silent when the current policy cannot load the API. Loader-less scopes still register nothing from the pool (#887).
An unselected discovery capability answered direct dispatch with PUBLICATION_GRANT_UNAVAILABLE on the shared-file lease path and POLICY_DENIED on the provider path, with a next action that never mentioned the selector. Both paths now answer CAPABILITY_NOT_SELECTED with a select: query pointer; read-only scopes that can never select a mutating capability keep the generic refusal, and a committed selection stops answering with the deferred rejection.
…ve (#962)

A pwsh shadow kept the official tool hidden even when the replacing Bash executor was dead, and a consumer whose Bash slot never resolved an executor still hid the official tools behind a foreign same-name registration. Replacement shadows now lift per agent once a counterpart call settles with an unrecoverable Bash preparation failure (runtime missing, IPC mismatch, lifecycle lock busy, cache unusable, incompatible build), and mountConsumer keeps the officials admitted when its own Bash slot never resolved. Staging interruptions that the next call repairs keep the shadow.
The retained file/shell row rendered its table from the root registration view, so a registered-but-unadmitted tool - a replacement shadow on a host whose definition reads ignore when - could appear in the read_image row while the step excluded it. The row now reads the calling scope admitted view with the step tool set and falls back from context.agent to context.scope. Host-side sections that read registrations directly remain an upstream boundary.
A no-entitled-grant call consulted only the first same-agent grant
carrying a deferred() advisor; when that advisor answered undefined or
threw, the caller got the generic PUBLICATION_GRANT_UNAVAILABLE even
though a later grant could point at ops_load_sdk or ops_discover_tools.
One entry can hold several same-agent file leases (a PTC pool grant and
a discovery pool grant for the same public name), so the consultation
now walks every same-agent advisor in grant order, returns the first
outcome that carries an error, falls through undefined and throwing
advisors, and keeps the honest generic denial when none can help.
Regression: publication-registrar gains a three-advisor ordering test
plus first-wins and helpless controls.
@Thatgfsj

Copy link
Copy Markdown
Collaborator

Coordination note from #997 (P5; branch on top of ).\n\nI read this PR before starting and agree its scope — #968 loader pointers (/), #764 discover pointers, #934 admitted-view tables, #962 fail-open — is owned here. To avoid duplicating it, P5 implements only what this PR does not cover, aligned with the D3 full-tier branch:\n\n1. Permission-forbidden verdict: a mutating API inside the configured pool but forbidden under read-only refuses with an explicit permission message and no load suggestion — through (today it misanswers for pool members) and through the definition dispatcher.\n2. Revoked verdict, distinct from never-loaded: withdrawn scope ownership, a permission downgrade on a previously-selected API, and a pulled registrar grant each answer their own revocation wording ( message distinction in , new in ) instead of the single "must be admitted"/"no eligible grant" refusal.\n3. No-tool-set diagnostics: a diagnostic assembly without a step tool set no longer consumes pending loads as though it were a first model request.\n\nFor consistency we reuse your spelling for the load pointer at the PTC dispatch layer; the deferred-advisor plumbing you own in stays untouched, so expect only a small textual conflict in the code union at merge time.

@Thatgfsj

Copy link
Copy Markdown
Collaborator

Superseded by #1033:按仓库约定把 #1023 与 #1002–#1008 合并为一个统一 PR(冲突已在 #1033 内解决,CI 在 #1033 上跑)。

@Thatgfsj Thatgfsj closed this Nov 20, 2026
@Thatgfsj
Thatgfsj deleted the fix-publication-ptc-local branch November 20, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment