Repository navigation
fix: recover CLI stability and runtime safety - #519
Conversation
|
Checkpoint 2026-08-09: query-stall recovery is recorded in c749a58..1e5c3e9; the clean-runner assertion fix is 898676a; doctor quick/deep separation is d6752e3; macOS module portability follow-ups are 1199f21 and db4cc0b. Runtime-authority work is now in RED/GREEN development. All remaining slices will be added as granular commits to this Draft PR, without amend/rebase/force-push, and each staged diff will be checked for local usernames, machine names, credentials, and private paths before push. |
|
Runtime checkpoint pushed as 71b996c. The shared guard now rejects host-loader plus payload core runtime, cross-payload and cross-provider loader/libc splits, mixed SubOS core symlinks, and copied host core paths; leaf graphics libraries remain legal. SubOS runtime authority now compares manifest declaration with the exact active workspace version, rejects ordinary mismatching use before legacy self-heal or config writes, preserves multiple global glibc payloads, and cannot be bypassed by unrelated manifest defects. Verification: clean no-cache unit run 36/36 targets; SameSource 16/16; SubosRuntime 5/5; full unfiltered unit run 36/36; three focused runtime E2Es pass. Staged and committed diffs passed private-path, username, machine-name, credential, and whitespace scans. |
|
Design checkpoint pushed as 36df44a. It adds the stabilization design and the cross-repository dependency/task plan, marks Tasks 1-7 with recorded evidence, links the separate architecture discussion in #518, keeps D6 on versioned JSON rather than SQLite, and removes local worktree/user paths before publication. Tasks 8-16 remain explicitly pending in the plan. |
|
Task 8 checkpoint — #513/#514 host integration (
The PR remains Draft. #506, SubOS candidate UX, native-CI follow-ups, final integrated gates and release are still pending. |
|
Native-CI follow-up checkpoint ( The previous Draft head exposed two independent runtime regressions, now fixed in separate additive commits:
Both commits passed focused RED-to-GREEN gates, diff checks and privacy/credential scans. A fresh native matrix is running at the new head. |
|
Task 9 / #506 checkpoint — commit
Fresh verification at this commit:
The PR remains Draft. Next additive commits address the Windows path-separator regression and the namespace E2E setup that still assumed query-side index sync. |
|
Native-CI follow-up checkpoint:
Focused verification:
Both are additive commits on the existing Draft PR. Native checks are rerunning at the new head. |
交接文档:稳定性回归恢复与运行时闭环
一、目标与边界本轮不是做泛化重构,而是先恢复 xlings 作为通用用户态 OS/包管理基础设施应有的稳定性:
明确边界:本轮 D6 继续使用版本化 JSON,不引入 SQLite;图形栈以稳定现有能力和真实验证为主,不为了 mcpp 做专用适配。 二、已经完成并进入 PR #519 的工作1. 设计、依赖关系与跨仓前置
2. 本地命令卡顿与查询正确性提交范围:
3. doctor quick/deep 分层提交:
4. SubOS runtime 权威与图形叶子库边界提交:
5. #513 / #514 的 xlings host 集成提交:
6. #506 provider-aware removal提交:
7. 原生 CI 暴露后的增量修复
评论发布时,PR 远端 HEAD 为 三、当前工作区已有、但尚未提交/推送的 Task 10目标: 当前实现已完成:
已跑过的验证:
尚未做的收口:
四、过程中遇到的主要问题与结论
五、还没有完成的工作A. xlings PR #519 与发布
B. mcpp #392 与 runtime/graphics
C. xim-pkgindex / xlings-res 生态收口
D. 最终真实用户路径
六、建议的接手顺序
七、必须继续遵守的过程约束
当前交接点没有需要丢弃或回滚的修改;最重要的是先把 Task 10 作为独立可审提交送入 Draft PR,再继续 release 和跨仓闭环。 |
|
Task 10 / 交接后续 checkpoint:可提交内容已全部更新到本 Draft PR。
先前交接评论中“Task 10 尚未提交/推送”的段落现已由上述两个 additive commits 完成。PR 正文也已更新为当前状态。新 HEAD |
Measured on a real home: of ~25 SubOS, three carried a `subos_info.runtime`
and the rest predated the block entirely. Every one of those was declared
against DEFAULT_RUNTIME the first time anything rebuilt its block -- and once
the declaration became authoritative, that stamp made `self doctor` report an
error and `use` refuse to activate the runtime the SubOS was already on, for
a state nobody chose.
Three separately reasonable changes composed into it:
1. `preserved_runtime` kept a RECORDED binding and fell straight through to
the caller's constant otherwise. A subos that predates `subos_info`
recorded nothing, so it got the constant.
2. D5 moved from "is the declared runtime installed anywhere" (Warning) to
"is it this SubOS's active runtime" (Error, counted in the exit code).
3. `use` gained a guard that refuses a contradicting activation.
Fixes, in the same order:
1. `observed_runtime` reads the workspace in the SAME file. A subos that
never recorded a binding is not silent about its runtime -- `use` has
been maintaining that record all along. Declaring what it runs makes the
declaration true rather than absent; recording nothing is not an option,
because validate_block requires a well-formed binding and a block without
one is reported broken forever.
2. `--fix` adopts the active runtime for homes already stamped by
2026.8.9.1/.2, reading it back through the same `observed_runtime` the
detection used so reporter and repairer cannot drift. Only the Error
shape is adopted: a declaration with no active runtime is a cold intent
(`subos new --runtime X` before installing X) and overwriting it would
undo a decision someone took.
3. Both messages now name two ways out that exist. "Create a new SubOS" was
never the only one -- activating the DECLARED version is exactly what the
guard permits -- so the dead end was in the text, not the code.
tests/e2e/subos_runtime_declaration_upgrade_test.sh covers all three states:
legacy (no block), already-stamped, and cold intent.
`xlings subos use` with no name lists candidates and exits 0. That is right on
its own, but the check ran BEFORE the mode dispatch, so it also swallowed every
form that asked for an effect:
subos use --cmd 'make' exit 0, make never ran
subos use --sandbox --cmd '...' exit 0, the command never ran
subos use --global exit 0, nothing persisted
subos use --shell exit 0, and a rendered candidate TABLE went
to stdout -- the stream the caller eval's
Never-happened and succeeded produced the same exit code, which is this repo's
recurring shape. It also aimed at the release's own acceptance path: the
evidence for this whole round is `subos use <name> --sandbox --cmd ...`, and a
typo in that name would have printed a list and reported success.
Discovery now requires the rest of the command to have asked for nothing else.
Four E2E cases pin it: each exits 1, none executes its marker, --shell emits no
candidate table, and --global persists nothing.
…ll one `list <filter>` skips a workspace pair before resolving it, using a cheap over-approximation of the owner candidates. The approximation walked only a version's OWN outgoing binding edges, while the real resolver builds an incoming index and reaches members through it -- and `legacy_root_in_selection`, which decides which members become candidates at all, is precisely a question about incoming edges. So an owner reachable only by walking backwards was invisible to the skip decision: `list <name>` omitted a row that plain `list` showed, and nothing in either output said they disagreed. The walk now follows edges in both directions. Only a filtered query can skip a pair, so only a filtered query pays for the reverse index. Stated as an invariant rather than one hand-picked case: for the same fixture, `list <F>` must equal `list` filtered by F. A second test pins the mechanism, asserting the blind walk really does miss the owner -- so the invariant test is a genuine RED turned GREEN, not a tautology.
…g it the host's
Measured against a real home: the new reverse rule produced 145 loader/libc
findings, and 143 of them were the same false positive.
interpreter -> <repo>/.xlings/subos/default/lib/ld-linux-x86-64.so.2
core file -> ~/.xlings/data/xpkgs/xim-x-glibc/2.39/lib/ld-linux-x86-64.so.2
That interpreter IS our loader, reached through a SubOS view. `payload_of` is
documented to return empty for a subos directory, so an empty interpPayload was
read as "the host's loader" and every migrated binary tripped the rule.
The RUNPATH side already resolves through symlinks -- that is what
core_runtime_sources_ exists for. Resolving only one side is what made the two
sides disagree. The interpreter now gets the same treatment when it does not
land in a store directly.
Real home after the fix: 143 -> 0. The two findings that remain are real, and
are ones the previous same-provider filter structurally could not see:
xim-x-godot/4.6.3/godot
interpreter -> ~/.xlings/data/xpkgs/xim-x-glibc/2.39/lib64/ld-linux-x86-64.so.2
RUNPATH -> /usr/lib/x86_64-linux-gnu
our loader paired with the host's libc, which is the crash-before-main case.
Two tests: a real symlink farm that must pass, and a genuine host interpreter
with a payload core that must still violate.
Also pins the spelling invariant the Windows-separator test was already
guarding: payload_of and store_root_of both slice the caller's own spelling,
and normalization only finds the split point. An earlier attempt to "fix" a
divergence here broke that test, which was right to fail.
…ion" The unresolvable-coordinate path returned 1, three lines above a comment promising the opposite -- that removing what is not there is success, "without breaking scripts that re-run `remove` defensively". A package whose recipe has left the index, or a local --add-xpkg recipe since deleted, is as gone as it gets, and reporting a failure to go is wrong. Turning it into a blanket exit 0 was wrong too, and the existing payloadless config test said so: `remove [email protected]` must fail. Both contracts are right because they answer different questions: remove pkg "make sure pkg is gone" -- warn, exit 0 remove [email protected] "remove THIS version" -- exit 1; the coordinate itself is wrong, and success would confirm removing something that cannot exist The discriminator is whether the user named a version. Both halves are pinned: the existing explicit-coordinate case, plus a new bare-name defensive re-run.
…s what it narrows Two small honesty fixes found while reviewing the round. get_catalog: a default-constructed `expected<void, E>` is a SUCCESS value, so when a LocalOnly caller had already initialized the singleton, the InstallReady self-heal held "the result of a rebuild that never happened" and could only ever fire on the sub-index branch. `optional` makes never-probed its own state. doctor --scope narrows the payload/runtime audit only; every other check, and every repair --fix performs, still covers the whole home. The announce line now says so instead of letting the reader infer a confinement that is not there.
… never committed .agents/docs/2026-08-10-pr519-review-and-completion-design.md A review of #519 with each finding carried through to a measurement. Two of my own calls did not survive it: R5 (I read payload_of's return backwards -- it slices the caller's spelling, exactly like store_root_of, and the existing Windows test was already guarding that) and R2(b) (by_identity resets on a store-name mismatch, so a stamped row's identity is never rewritten and the pre-filter cannot disagree with itself). Both are kept and marked, because the gap between what I expected and what the home actually held is the part worth reading. R4 went the other way: a finding I rated "needs a number" turned out to be 143 false positives. Headline measurement, real 71 GB home: `self doctor` 195.16s -> 0.63s. .agents/plans/2026-08-10-pr519-completion-implementation.md Task split and cross-repo DAG for the rest. Names the three places where the angles conflict (stability vs consistency, compatibility vs architecture, UX vs seamless upgrade) and how each was decided, since those are where this round was easiest to get wrong. Also records that mcpp #392 does NOT need the published xlings it was scheduled behind. .agents/docs/2026-08-09-instant-query-and-userspace-os-architecture-design.md .agents/docs/2026-08-09-open-issues-deep-triage.md Existed only in a working tree. The first is the groundwork for #518; the second triages all 44 open issues. Committing them so neither depends on a directory surviving.
Ordinary date version. Latest tag is v2026.8.9.2 and today is 2026-08-10, so the plan's expected `2026.8.9.3` is behind -- recomputed at cut time as that plan's own constraint requires. No `.0` for a routine release.
…ntime family at a time Two failures, both invisible from Linux. **Windows has been red for four consecutive HEADs** (6f229b1, 7ada4cc, a6d13e2, 3a8676b) on one line: src/core/subos.cppm:131: error: too many arguments provided to function-like macro invocation next[j + 1] = std::min({prev[j + 1] + 1, next[j] + 1, replace}); note: macro 'min' defined here (windows.h) windows.h defines min/max as function-like macros. Three of the four modules that include it already defined NOMINMAX first; subos.cppm was the exception. The error names the algorithm and says nothing about the include, and it cannot reproduce on Linux or macOS -- so every local gate stayed green through all four runs. tests/scripts/test_windows_header_hygiene.py now asserts the rule at the source level, where a Linux machine can check it. Writing it immediately found a SECOND module with the same latent problem (src/core/subos/sandbox.cppm), which had simply not been hit yet because nobody had written the call there. Both are fixed; the check is registered in xlings-ci-linux. **glibc and musl are not each other's core runtime.** The loader/libc rule compared any core-runtime file against any other, so a glibc binary carrying a musl toolchain's libdir on its RUNPATH -- which is what a musl cross-compiler bakes in -- was reported as a loader/libc split. It never was one: a glibc binary asks for `libc.so.6`, which a musl libdir does not contain under any name, so that path resolves nothing. Comparison is now within one family, with Unknown on either side still comparing so an unrecognised payload is never silently excused. Verified against the real home: the two genuine godot findings (our glibc loader with the host's glibc libc) still fire, and `closure_guard_differential_test.sh` passes again -- it had been failing locally where the rig's RUNPATH reaches a real musl-gcc payload that CI runners do not have.
Checkpoint:第二轮评审的修复已全部推入,版本
|
| 命令 | 2026.8.9.2 | 本 PR |
|---|---|---|
self doctor(默认) |
195.16s | 0.63s |
跑完 slice-real-home.sh verify-untouched 证明真实 store 未被改动。
这一轮修掉的 9 个问题
R0 —— 升级过的老 home 会变成「按新规则永久不合规」。
真实 home 普查:~25 个 SubOS 只有 3 个有 subos_info.runtime,其余全部 ABSENT,
升级时被 preserved_runtime 的常量兜底盖成 [email protected],而它们实际在跑 2.39。
叠上本 PR 把 D5 从 Warning 提成 Error、use 新增拒绝,结果是
doctor 变红 + use glibc 2.39(它本来就在跑的版本)被拒,
而提示的唯一出路「新建 SubOS」是假死局 —— 正向迁移一直是通的。
修法:声明的第二来源改为 observed_runtime(读同一个文件里 workspace 的 active 版本),
--fix 采纳已盖坏的 home,两处提示改成命名两条真实存在的出路。
「不写 runtime」不可行:validate_block 要求合法 binding。
R4 —— ELF 规则在真实 home 上报 147 个 broken payload,其中 143 个是误报。
PT_INTERP 指向 SubOS 视图(symlink farm)时 payload_of 返回空,被当成「宿主 loader」。
RUNPATH 一侧早就 weakly_canonical 穿链接了,只穿一侧两侧就不可能一致。
修后 143 → 0,剩下 2 条是真的:godot 用我们的 glibc loader 配 /usr/lib 的宿主 libc
—— 旧规则的同 provider 过滤结构性看不到它。
Windows 已经红了四个 HEAD(6f229b1→3a8676b),一行:
std::min({...}) 撞上 windows.h 的 min 宏,而 subos.cppm 是唯一没写 NOMINMAX 的模块。
诊断只指算法不指 include,且在 Linux/macOS 上不可能复现。
新增 tests/scripts/test_windows_header_hygiene.py 在源码层断言这条规则(Linux 上可跑,已注册进 CI),
写完立刻又找出第二个同样的地雷 subos/sandbox.cppm。
其余:R1(subos use --sandbox --cmd 缺名字时 exit 0 且不执行 —— 正是本轮验收命令的形状)、
R2(list <filter> 可能是 list 的真子集)、R3(remove 退出码与自己的注释矛盾,拆成
裸名 exit 0 / @版本 exit 1)、R6、R7、glibc/musl 跨 family 误判。
两条我自己的判断被测量推翻,都留在文档里:R5(我把 payload_of 的返回读反了,
它返回原始拼写,本来就一致 —— 既有测试挡住了我的「修复」)、R2(b)(by_identity
在 store 名不等时 reset,身份不会被改写)。
本地门禁
unit 36/36;E2E run_all.sh 81/81(含新增 E2E-78 三态);
test_generated_command_reference / test_cli_spec_parity(240 + 64)/ test_docs_examples /
test_windows_header_hygiene / no_xlings_version_pin_check 全过;
Linux static release candidate 已构建(xlings-2026.8.10.1-linux-x86_64.tar.gz)。
push 前 whitespace、本机身份/路径/凭据扫描通过。
文档
.agents/docs/2026-08-10-pr519-review-and-completion-design.md—— 评审 + 每条发现的实测结论.agents/plans/2026-08-10-pr519-completion-implementation.md—— 八角度拆分、三对冲突的裁法、跨仓 DAG- 另外两份从未提交的设计(instant-query 架构、44 条 open issue 触诊)也一并落盘
剩余
全平台 CI terminal green → squash merge → release → 本地 gtc 补 GitCode → GET+sha256 →
pointer A → xlings subos <name> --sandbox --cmd 真实验证。
mcpp #392 不依赖本 PR 发布,可立即并行开工。
Written for someone upgrading, not for someone who read the PR. Leads with the number that matters (self doctor 195.16s -> 0.63s on a real 71 GB home) and says plainly that the upgrade needs no action -- and what the one command is if a home was already stamped by 2026.8.9.1/.2. Frames the ELF change as "more accurate, not stricter", because that is what the measurement showed: 143 false positives removed, 2 real findings added.
The earlier figure ("~25 SubOS, 3 declared") came from a listing I had
truncated with `head -25` and then read as if it were the whole set. The full
count is larger and the ratio is worse:
total subos 35
with a subos_info.runtime declaration 2
ABSENT 33
of those, with an active glibc 20 <- would be declared
against a runtime they
never ran
Twenty is the number that matters: those are the SubOS an upgrade would have
stamped with [email protected] while they ran 2.39. It does not change any conclusion
or any fix -- it makes the case stronger than it was stated.
…ls it With the NOMINMAX fix in place, Windows got far enough to RUN this suite for the first time in four HEADs -- and four assertions failed there and only there. All four are of the form "the diagnostic must contain this path", and all four compare a POSIX-shaped test literal against a path std::filesystem handed back after normalising it. `/home/u/.xlings/...` is not an absolute path on Windows, so it goes through `lexically_normal()` and comes back with backslashes; canonicalisation can also change case. Neither says anything about the behaviour under test -- these tests are about the loader/libc pairing rule, which is Linux-only in production, and about whether `describe()` names both payloads. So compare in one spelling and one case. The paths are still compared whole: this loosens the rendering, not the claim.
…arators Second Windows round. Two causes behind five failures, and the first fix only addressed one of them. **8.3 short paths.** GitHub's Windows runners return `C:\Users\RUNNER~1\AppData\Local\Temp` from `temp_directory_path()`, while the code under test canonicalises through `weakly_canonical` and gets `C:\Users\runneradmin\...`. Those are the same directory and never the same string -- and no amount of case or separator folding reconciles `RUNNER~1` with `runneradmin`, which is why the previous commit's `names()` helper still returned false for every TempTree-based assertion. Canonicalise the fixture root up front so both sides start from the same spelling. **Round-tripped vs. handed-through spellings.** `f.interpPayload` is sliced from the string the caller passed, so it keeps forward slashes; `f.rpathPayload` has been through `fs::path` and `lexically_normal()` and comes back with native separators. The two are compared against the same POSIX-shaped literal. Compare through `gen()`, which is about the separator, not the path. Neither is a defect in the rule: the loader/libc pairing is Linux-only in production. Both were fixtures asserting a spelling the platform owns.
发布后闭环证据(2026.8.10.1)全部针对已发布产物,不是本地构建。 发布链路
冷 home(用 tarball 自带的
|
| 命令 | exit |
|---|---|
subos use --sandbox --cmd '…' |
1(命令未执行,标记字符串出现 0 次) |
subos use --shell |
1 |
subos use --global |
1 |
subos use(无参数) |
0,列候选 |
R0:老 home 升级(最关键的一条)
构造一个 2026.8.5.1 之前的 home —— 没有 subos_info 块,workspace 实际在跑 glibc 2.39,
全局同时存在 2.39 与 2.44 两份 payload:
BEFORE runtime declaration : ABSENT
AFTER doctor --fix : [email protected] <- 不是 2.44 默认值
subos runtime findings : 0
use glibc 2.39 : 未被 runtime guard 拒绝
(该 fixture 的 doctor/use 仍以 1 退出,是 fixture 自身的噪声——没建 shim、bindingGroup 没有
bindingMembers——use 的失败发生在 binding manifest 阶段,不在 runtime guard。)
冷意图仍然只是 warning
新建 SubOS 声明 [email protected] 而尚未安装它:⚠ warning,self doctor exit 0。
「声明了但还没 active」和「声明与 active 冲突」是两种状态,没有被混为一谈。
一个已知代价,不是回归:self doctor --fix 在 71 GB home 上 >10 分钟,因为 --fix 蕴含 --deep
且每轮 repair 后的 refresh 会重跑整个 payload 审计。旧版默认路径同样慢(195s),所以不是本轮引入的。
把 --fix 需要的 catalog 与它不需要的 ELF 扫描拆开是明确的后续优化。
范围
本 Draft PR 恢复 xlings 的稳定性与本地命令即时响应,并收口真实正确性问题:
info/list工作量与目标成比例;self doctor默认 bounded quick,昂贵 payload/ELF 审计仅由显式--deep触发;0.0.55,修复 install hook: stdout/log.error/stderr swallowed — failing install() surfaces only as an empty E_INTERNAL #513、pkginfo.install_dir() returns nil for a dependency that exists only in the shared registry cache #514;removefails on a package that delegates its install: "exact removal version is not registered" #506,同时保护其他 provider 的状态与 payload;xlings subos use无参数列候选,并提供安全的大小写/唯一前缀匹配。架构取舍单独讨论于 #518。D6 本轮继续使用版本化 JSON,不引入 SQLite。
相关问题:#506、#513、#514、mcpp-community/mcpp#392。
头条:真实 71 GB home 上的实测
self doctor(默认)info gcclist gcclist切片由
.agents/tools/slice-real-home.sh构建,跑完verify-untouched证明真实 store 未被改动。第二轮评审(2026-08-10)修掉的 7 个问题
第一轮交付后做了一次带实测的评审,见
.agents/docs/2026-08-10-pr519-review-and-completion-design.md。其中两条我自己的判断被测量推翻,也留在文档里。
use走不出来[email protected]而实际在跑 2.39 → doctor Error +use glibc 2.39被拒,提示的唯一出路「新建 SubOS」是假死局(正向迁移一直是通的)subos use --sandbox --cmd '…'缺名字时 exit 0 且不执行--shell更严重,候选表会进入被eval的 stdoutlist <filter>可能是list的真子集remove的退出码与它自己三行外的注释矛盾@版本= 「删这个版本」exit 1get_catalog自愈分支在一条真实路径上永不触发expected是成功值--fix --scope X只窄化检测不窄化修复R5Windows 路径拼写不一致payload_of返回原始拼写,本来就一致。改动已回滚,既有测试是对的验证证据
subos_runtime_declaration_upgrade_test.sh三态、4 条subos use无名修饰符用例、remove两半契约)test_generated_command_reference/test_cli_spec_parity(240 option spellings、64 parser literals)/test_docs_examples全过no_xlings_version_pin_check.sh过verify-untouched干净版本
2026.8.10.1。计划里的预期值2026.8.9.3已过期(最新 tagv2026.8.9.2,今天 2026-08-10),按计划自身「cut 前重新计算」的约束重算;常规修复不使用
.0。剩余闭环
见
.agents/plans/2026-08-10-pr519-completion-implementation.md。全平台 CI terminal green → squash merge → release → 本地
gtc补 GitCode → GET+sha256 →xim-pkgindex pointer A →
xlings subos <name> --sandbox --cmd真实验证 → mcpp #392 / pointer B。mcpp #392 不依赖本 PR 发布:它读的是编译器所属 registry home 的 SubOS manifest,
subos_info.runtime自 2026.8.5.1 起就在公开发布里,可以立即并行开工。过程约束