Repository navigation
chore(release): consolidate the OPS-PTC 18-card release with #1002–#1008 (#1000) - #1033
Merged
Merged
Conversation
A scope without the loader was still taught to call `tools.ops_load_sdk`, so every such session spent a round trip on a call that cannot succeed and failed with "is not a function". The guidance and the `bypass` notice now render from the surface the scope actually publishes: - a loader-less scope gets a direct-call step in place of the load step, its table row, and any fenced example that teaches loading, and says so when nothing is published at all; - the file-work line names only the file APIs that are loadable or resident, never the shell it just accused, and a read-only policy drops the mutating APIs from that list; - the surface is resolved per agent at delivery time, so a narrow pool or a read-only session is never told to load what it cannot reach. The loader-present path is byte-identical for a full pool. Two limits are documented in the reference: the shipped lesson itself is substituted only when the loader is absent, and the lists follow the configured pool and the read-only policy without the per-agent ownership narrowing. Closes #922
`hideOfficialTools` was inert for every PTC-based preset: `replacementTargets` gated the file targets behind `plan.nativeFiles`, and PTC plans declare `nativeFiles: false`, so the target map only ever contained the Windows shell names. The PTC projection kept the official `read`/`glob`/`grep` SDK bindings next to the `ops_*` ones. The replacement controller now receives a `PtcServability` accessor from `mountPtc`: `servable` is the set of raw APIs the publisher itself would admit for the agent (`permitted ∧ (resident ∨ allowedApis)`), and `isPtc` is the same per-activation presentation predicate the publisher already uses. The shadow `when` hides an official name only when it is a reviewed replacement, the activation is PTC, the name is servable, and the publisher registered a counterpart. A presentation probe failure keeps the official tool (fail-open), because a rejected `when` fails the whole step resolve on this host. Both the built-in mode gate and the integration path now include the PTC presentation. `write`/`edit`/`read_image` stay visible.
…nders (#814) A foreground command that outlived its timeout is promoted to a host job, and the render offered job_output/job_kill as if the kill stopped one command. The host's subprocess and job layer actually terminates the whole tree, so daemons the command started and left attached to its pipes (an adb server, a dev-server watcher) went down with it. The host layer owns that semantics and this repository cannot fix it; the render now states what a job kill reaches and how to keep daemons out of the blast radius.
…870) A default DSH_HOME (~/.dsh) inside a home workspace made every full-access Niubash call refuse with 'the prepared payload must be outside the session workspace'. The boundary exists so confined workspace labeling and write gating never reach an executable through the workspace or a junction into it; full access runs without confinement and is not a security boundary against the account, so the refusal only removed a working configuration.
…vailable (#409) msys-2.0.dll prints a per-user section conflict as 'CreateFileMapping S-<user SID>.<n>, Win32 error 5. Terminating.' with no 'fatal error' prefix, so the restricted-token runtime failure reached the model as a bare non-zero exit and read like a command or denial problem. Classify that message like the signal-pipe failure: EXECUTOR_UNAVAILABLE with sandbox.runnerFailed, never a user authorization denial. The proxy still arms only new objects; a foreign DACL is not rewritten.
A report described ops_bash children still carrying the restricted Low token (S-1-16-4096) in danger-full-access while the host pwsh ran Medium. The projection chain (standing policy, per-call approval, the full-access short-circuit and the skipped confine) checks out in this repository, and a full-access child reports the caller's own integrity label here, so the failure did not reproduce. Lock the boundary with a guard that fails when full access ever routes through confinedBash or sandbox.confine, and document the whoami /groups token comparison for the next report.
…tes (#744) A OneDrive workspace root carries IO_REPARSE_TAG_CLOUD with no target, and the bootstrap's ancestry walk refused any reparse point before the DACL decision could run, so every workspace-write tool failed on an otherwise ready folder. The reparse check moves to the single branch that actually writes the DACL: an already-ready root answers without any tag inspection, the cloud-files family (Microsoft's 0x90000000-0x9FFFFFFF band) passes because a placeholder keeps a real directory entry behind the point, and every other tag fails closed with the tag named, read through FSCTL_GET_REPARSE_POINT on the point itself. Unreadable points fail closed too.
A husky v9 hook with the shebang #!/usr/bin/env sh failed under the niu-Git command while the same script with #!/bin/sh ran. The interpreter lookup happens inside the niu-Git payload, which this repository cannot patch, so the entry documents the diagnostic pair and the shebang workaround and marks the root cause unresolved-upstream.
…ws Terminal (#828) Each ops_bash call flashed a console window on Windows 10 when Windows Terminal was the default terminal. Niubash is a console-subsystem binary launched without an interactive parent, and the Windows-10 terminal hand-off re-creates a visible console per call; no dsh-ops setting controls console hosting, and the shipped binary cannot be patched here. Record the default-terminal comparison as the diagnosis and mark the hidden-console build upstream work.
A Defender or ESET event removed only niu.exe from an otherwise complete payload, so selection failed with the member-level diagnostic from #844. The quarantine is an external security-product decision: collect the matching threat event, restore the pinned tree with provision-shells, and if an allow-list is chosen target the fixed prepared location. No repository behaviour claims to prevent it.
#669) The WSL 9P redirector (\\wsl.localhost and \\wsl$) exposes no NTFS security descriptor, so the bootstrap's Get-Acl threw on every WSL workspace and all of run_code died in workspace-write mode. Exactly those two Microsoft-fixed prefixes now answer ready before Get-Item or Get-Acl is touched, decided by the pure classifier Get-DshOpsWorkspaceNtfsState. This is a prefix decision, not a catch that swallows ACL errors: every other path keeps its existing behaviour and a real ACL failure there still fails closed; authority inside the distribution remains its own uid/gid mapping.
…rences (#958, #828) Review follow-up: the shebang and console-flash entries stated upstream mechanisms as established facts. Separate what the reporter observes (the two-shebang comparison, the default-terminal comparison) from the attributed mechanism, which this repository cannot verify inside the upstream payloads, so both entries point a diagnosis instead of claiming a proven root cause.
…669) The redirector prefix decision ran before Get-Item, which turned '9P has no NTFS ACL' into 'the workspace need not exist': a nonexistent-distro path answered ready. The decision now runs after the existence and container validation and before Get-Acl, so a missing path fails exactly like any other missing workspace and a live 9P root still answers ready without reaching Get-Acl. The live end-to-end case becomes an explicit DSH_OPS_TEST_WSL_DISTRO opt-in that registers only after probing the provider, reports not-run without counting it as passed, and runs before the negative case because touching a nonexistent distribution leaves the redirector unable to answer valid paths for under two seconds.
The tag classifier accepted the whole 0x9xxxxxxx band on the high nibble alone, which is wider than the issue's proven family and let unproven tags through before a DACL write. The rule is now the exact family shape: (Tag -band 0xFFFF0FFF) -eq 0x9000001A, i.e. IO_REPARSE_TAG_CLOUD, CLOUD_ROOT, CLOUD_ON_DEMAND and family members sharing 0x9000?01A; 0x9FFFFFFF and a 0x9 tag whose low 16 bits are not ?01A are pinned as negative cases. Decimal literals keep the Windows PowerShell 5.1 unsigned arithmetic working. Docs state the precise family instead of the reserved band, and the same three files also carry the post-review wording that the 9P allowance runs after existence validation (#669).
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.
…call (#576) Each optional WSL read drove one wsl.exe invocation per Windows drive mapping, one more for the payload sha256, and a final one for the worker, so a small read paid four WSL startups for one result. Preparation is now a single fixed /bin/sh -c script: the text is a constant and every drive root and the payload path travel as positional arguments, so no Windows path can alter the command shape. The wslpath mappings are still resolved anew per call, the payload digest must still match the packaged receipt, and a refused mapping (exit 9), refused digest (exit 8) or failed spawn still falls back to the Windows worker exactly as before.
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.
This was referenced Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1032, #870, #409, #581, #744, #669, #576, #579, #842, #873, #928, #939, #788, #874, #968, #764, #934, #962, #701, #753, #929, #966
Refs #958, #828, #771, #814, #750, #836, #897, #1000
What was wrong
按仓库约定「同一批改动 PR 数量过多、存在合并冲突时经确认合并为一个 PR 统一合并」,本 PR 把共同构成 0.4 OPS-PTC 构建阶段的 8 个 PR 合并为一个可评审变更,并在统一构建阶段只跑一次 CI:
release/ops-ptc-18-cardsfix-shell-runtime-localfix-workspace-wsl-localfix-session-lifecycle-localfix/file-edit-pdffix/windows-metadata-asarfix-publication-ptc-localfix/guidance-integration8 个分支各自对
main@58f6e281可合,但两两之间在docs/CHANGELOG.md、src/publication/{ptc,registrar,replacements}.ts、src/consumer/mount.ts、test/resident-switch.test.mjs上有 12 处文本冲突。其中教学通道是真冲突,不是排版问题:#1008 把一次性教学从 step-tail(写入 logged history 的 user 消息,触发 #929 自持循环)改到工具结果的additionalContexts;#1023 的 P7 卡(#998)建立在「教学进入历史」之上并加了压缩后短提醒。#1023 的说明本身已标注「两者不应盲合,若 #1008 先合,P7 需 rebase 到 ephemeral 通道」。本 PR 按该说明取了 ephemeral 通道。The change
分支 =
origin/main(58f6e28) 依次 merge 7 个 fix 分支,最后 mergerelease/ops-ptc-18-cards;12 处冲突在 merge 过程中语义化解决,收成一个 merge commit(6c770080)。冲突决议:
docs/CHANGELOG.md## [Unreleased]条目并集去重(823 行,无重复行)src/consumer/mount.tsptc = mountPtc(...)句柄,同时保留 fix 的keepOfficial: () => bashUnavailable(#962)src/publication/registrar.tsPUBLICATION_GRANT_REVOKED判定(#997)src/publication/replacements.tstools/post-execute)与 release 的隐藏名系统提示退休(system-prompt/assemble)是两个并列 handlersrc/publication/ptc.tssurfaceFor/renderBatchingGuidance(P1)与 P5 四类裁决;把 #1008 的 #929 ephemeral 教学嫁接到该 surface 上(contributorbatching-guidance:lesson,投递点即 latch);把 #968 的deferredRejection(带可执行nextAction)并入!selected分支,使SDK_NOT_LOADED同时点名ops_load_sdk;移除 P7 的 step-tail provider 与COMPACTED_TEACHING_REMINDERtest/resident-switch.test.mjsrun_code结果的additionalContexts读取跨分支的语义整合(不是文本冲突但同属并集):
ops_status:内置预设现在旁挂只读诊断行,4 个 PTC 套件的首轮枚举/预算期望补上该诊断名;ptc-two-tier-matrix把它放进行级OPS_ADMITTED_EXTRA,两级披露内核的集合比较仍保持精确相等。test/prompt-injection.test.mjs中 4 个依赖 step-tail teacher 的 P7 用例随通道移除;ephemeral 契约由test/prompt-ephemeral-teaching.test.mjs(用户批次零教学、首个根结果恰好一次、之后不再教)与 resident-switch 共同覆盖。test/ptc-cost-accounts.test.mjs的 history 账随之只记录 notice,教学不再计入历史。run_code结果、同一步additionalContexts、从不进入历史」,设计决策里的 P7 引用降为 P1/P2。为让统一 PR 真的跑通 CI,又补了 5 个构建/平台修复(均为合并体特有的红,不是新行为):
cargo fmt统一;ea.rs的0xC000_191改为0x0C00_0191。windows-metadata测试里 1 处 needless borrow、3 处vec!、1 处 unusual byte grouping,按 clippy 建议修正(无行为变化)。DSH_OPS_REQUIRE_RUNTIME=1变成失败;把三个名字加进ALLOWED_SKIPS(与windows-security同类)。file_path_tests的 ASAR 用例直接用temp_dir(),macOS 的/var -> /private/var让checked_leaf先撞上符号链接组件而报PATH_RESTRICTED;先canonicalize根目录再走。ops_bash),PTC 套件的等级枚举漏了它;同时canonical-file-runtime把含反斜杠的路径直接拼进正则、workspace-reparse-ready用icacls处理 junction(icacls 跟随重解析点,而Get-Acl读的是点本身)。分别改为:枚举时剔除 shell 工具、转义正则、用Set-Acl安装受保护 DACL。刻意没做:没有保留 P7 的压缩短提醒(依赖历史可见性,ephemeral 通道下无法成立;违规时的逐条短提醒仍在),没有改任何工具 schema 或参数语义。
Validation
四目标矩阵与所有 gate 作业在本 PR 的
pull_requestrun 上跑。本机 4 个失败均为环境缺失(
release-tar-modes、niubash-consumer、niubash-payload-integration需要 npm bundled tar;pwsh-upgrade需要 PowerShell),#1023 的对照记录里它们在纯净origin/main上同样红;CI(Linux/macOS/Windows)上这些套件全部执行并通过。定向读数:撤回本次实现会变红的断言(行为级):ephemeral 契约在
test/prompt-ephemeral-teaching.test.mjs;#968 的可执行 nextAction 在ptc-declaration-surface;两级披露矩阵在ptc-two-tier-matrix;P1 的只读/无 loader 教学渲染在resident-switch。Environment
Linux x64 / Node.js v24.21.0 / 基于上游
origin/main@58f6e281;本地源码构建(npm ci --ignore-scripts、npm run build、npm run build:ptc,linux-x64 worker sha25613e2bd42…)。合并后处理