Skip to content

revert(cli): stage os skills writes and swap them in by rename, recording last (#35495) - #35616

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-35588-skills-staging-mkdtemp-base
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-35588-skills-staging-mkdtemp-base

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #35588

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:用命令行安装或更新技能包的开发者,回到上一个发布版的写入方式:更新中途失败(磁盘满、权限不足)时,技能目录可能新旧混杂,要再强制更新一次才能恢复。
  • 为什么做:为主干每四小时一次的全量检查解决变红,它被技能写入新加的暂存目录卡住;按席位指令先撤回那次改动,让主干恢复全绿。
  • 出错会怎样:本次只删不增,和原改动逐字节相反,影响只在技能安装与更新两条命令;万一有问题,可以直接撤回本次撤回。
  • 要你做什么:无

This is a revert

This PR reverts #35495 (578d3b1) and nothing else. The diff is byte-identical to the inverse of that commit (cmp of the two patches, exit 0).

Why. #35495 added a staging directory, mkdtempSync(join(dir, SKILLS_STAGING_PREFIX)) in applySkillsWrite. Its base dir is the caller's skills directory, which is cwd-relative (resolveSkillsDir(args.dir, cwd)). The dispatch-gates scratch-dir scan reads one file at a time and treats a cwd-relative base as unreadable on purpose, so the self-test case "no mkdtempSync site in this tree takes a base the scan cannot read" fails on that line. That one case of 2564 is what keeps main's scheduled full Lint & Type Check run red (#35588). No honest spelling inside the CLI file lets the scan read that base. Every spelling that turns the case green does so by a lie (a tmpdir() marker, a fabricated binding) or an evasion (mkdirSync, an aliased import), and the gate is not narrowed. The measurements are on #35588 (comment 7016701837). The seat ordered this revert as the named fallback.

What returns. The defect #35079 addressed comes back: an os skills install or os skills update that fails partway (disk full, permission, a locked file) can again leave the skill directories gone or half-written under the old record, and the next plain update refuses them as changed locally until --force. #35079 reopens.

Re-landing. The staged swap re-lands only after a gate-side ruling on how the scan judges a directory-creating call whose base is a caller's argument. Even a cross-file hop ends at process.cwd(), and a killed run at this repo's root would leave .claude/skills/.objectstack-skills-staging-*, which no tracked ignore rule covers. So the rule needs a policy, not a reading. That decision is outside this PR, and scripts/pm/dispatch-gates.mjs is untouched.

DELIBERATE CORRECTION

This PR deletes one pending release note it did not add: .changeset/35079-skills-write-staged-swap.md. It was never released. The behaviour it describes is the code this PR reverts, so the note would now be false. Its headline sentence, quoted as it stood on the merge base: "os skills install and os skills update stage the new catalog and swap it in by rename, so a write that fails partway leaves the previous skills and their record as they were". Corrected to: no note. With the note gone, the published @objectstack/cli never carried the staged swap, so this PR releases nothing and adds no changeset of its own. skip-changeset is not applied (ruling D on #18375). Check Changeset stays red by design (route 0 of its refusal text), and the dispatching seat confirms this correction by its own record.

What changes

  • packages/cli/src/utils/skills-install-state.ts: applySkillsWrite goes back to the pre-fix(cli): stage os skills writes and swap them in by rename, recording last #35495 write (remove the dropped and replaced skill directories, write the new ones, write the record last). SKILLS_STAGING_PREFIX, the staging directory, the rename swap and its undo are removed.
  • packages/cli/test/skills-commands.test.ts: the an interrupted write leaves the installed catalog usable block and the node:fs fault injection that served it are removed with the code they pinned.
  • .changeset/35079-skills-write-staged-swap.md: deleted (see above).

Read first

  1. packages/cli/src/utils/skills-install-state.ts, the applySkillsWrite hunk: the riskiest change, the non-atomic write coming back.
  2. packages/cli/test/skills-commands.test.ts: the deleted interrupted-write block. Every remaining test passes unchanged.
  3. .changeset/35079-skills-write-staged-swap.md: the deletion the correction above declares.

Two-minute verification

From the repo root on this branch:

node --input-type=module -e "const m = await import('./scripts/pm/dispatch-gates.mjs'); const u = m.exposedScratchDirs({}).unresolved.filter(function (s) { return s.call === 'mkdtempSync'; }); console.log(u.length); process.exit(u.length ? 1 : 0);"

Expect 0 and exit 0. On main the same command prints 1 and exits 1.

Tests

All readings below are on head dc83a28e. Exit codes were captured before any pipe.

The red case, before and after
  • Before, at e35cf035, where packages/cli/src/utils/skills-install-state.ts is byte-identical to the merge base f981dce3 (git diff --quiet exit 0). node scripts/pm/dispatch-gates.mjs --self-test (both tiers) printed ✗ no mkdtempSync site in this tree takes a base the scan cannot read — UNRESOLVED: packages/cli/src/utils/skills-install-state.ts:246 (dir is not bound in this file) and ✗ dispatch-gates self-test: 1 of 2564 case(s) failed., exit 1.
  • After: the one-case replay through the module's own exposedScratchDirs on this tree read sites=3127, inTree=93, exposed=0, unresolved(mkdtempSync)=0, exit 0. The classifier on the file alone gives 1 unresolved mkdtempSync site at base f981dce3 (:246 dir is not bound in this file) and 0 at dc83a28e.
  • The full self-test on dc83a28e was still running when this PR opened. Its verdict follows in the os-dev-report on 4-hourly full run: red on main (Lint & Type Check) #35588.
cli tests and typecheck
  • pnpm --filter @objectstack/cli exec vitest run --maxWorkers=2 test/skills-commands.test.ts: Test Files 1 passed (1), Tests 30 passed (30), lock VERDICT command-exit 0.
  • pnpm --filter @objectstack/cli exec vitest run --project unit --maxWorkers=2: Test Files 431 passed (431), Tests 6158 passed (6158), lock VERDICT command-exit 0. The integration layer is left to CI: the diff touches no integration file and no spawn entry.
  • pnpm --filter @objectstack/cli typecheck (tsc --noEmit && check:test-typecheck): lock VERDICT command-exit 0, check:test-typecheck: OK.
  • Dependency closure first: pnpm --workspace-concurrency=2 --filter '@objectstack/cli^...' build, VERDICT command-exit 0, then pnpm --filter @objectstack/cli build, VERDICT command-exit 0.

Acceptance notes

  • The case runs in the slow tier, so a pull request's own Lint & Repo Gates run (fast tier) does not execute it. The local full self-test under Tests is the evidence, and the next scheduled full run refreshes 4-hourly full run: red on main (Lint & Type Check) #35588.
  • Observation, not filed: the scan holds the completeness rule to the spelling mkdtempSync only. Async mkdtemp(join(PKG, 'tmp', ...)) builds in-tree fixture roots it does not see (packages/cli/src/utils/graft-runtime-hooks.test.ts:236, packages/cli/test/next-steps.test.ts:83). Both are covered by .gitignore tmp/, so nothing is exposed.

Verification

The PR opened while the local gate runs were still finishing, so the local readings follow in the os-dev-report on #35588. CI on this PR is the gate.

  • Derived set: node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack gives 64 commands for this change set (3 paths vs merge base f981dce3). They run locally, byte for byte, and are reconciled with --ran.
  • Expected red, by design: node scripts/check-empty-changeset.mjs --base origin/main exits 1 on the deleted foreign changeset (the DELIBERATE CORRECTION class above), and so does Check Changeset on this PR.
  • check:pm-dispatch-gates on a pull request runs its fast tier only, so the red case is not in this PR's check-runs. The full self-test above is the reading for it.

Generated by Claude Code

…ding last (#35495)

This reverts commit 578d3b1.

Why: that commit added a staging directory,
mkdtempSync(join(dir, SKILLS_STAGING_PREFIX)) in applySkillsWrite, whose base
is the caller's cwd-relative skills directory. The dispatch-gates scratch-dir
scan reads one file at a time and treats such a base as unreadable, so the
self-test case "no mkdtempSync site in this tree takes a base the scan cannot
read" fails on it. That is the one red case keeping main's scheduled full
Lint & Type Check run red (#35588). No honest spelling inside the CLI file
lets the scan read that base, and the gate is not narrowed.

Consequence: the defect #35079 addressed comes back. An os skills update that
fails partway can again leave the catalog and its record out of step, and
#35079 reopens. Re-landing the staged swap waits on a gate-side ruling about
how the scan judges a directory-creating call whose base is a caller's
argument.

The deleted changeset (.changeset/35079-skills-write-staged-swap.md) was never
released, so this revert ships nothing.

Claude-Session: https://claude.ai/code/session_01L6bhgTyMahdAdhXSzgy2nt
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

6 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 40 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 08d920a16e977a1c0842f511ef40158ee3bc7c61 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 91a226e733fa832494fad6e68ea8b83bb6a1ebf4 — the merge of head dc83a28e0e19b4903ca4570efff4dd896c905aa9 into base 08d920a16e977a1c0842f511ef40158ee3bc7c61, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 91a226e733fa832494fad6e68ea8b83bb6a1ebf4 && git checkout 91a226e733fa832494fad6e68ea8b83bb6a1ebf4
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 08d920a16e977a1c0842f511ef40158ee3bc7c61 dc83a28e0e19b4903ca4570efff4dd896c905aa9 && git checkout -B drift-repro 08d920a16e977a1c0842f511ef40158ee3bc7c61 && git merge --no-ff dc83a28e0e19b4903ca4570efff4dd896c905aa9

node scripts/docs-audit/affected-docs.mjs --json 08d920a16e977a1c0842f511ef40158ee3bc7c61

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt

L2 brief · 2026-11-19T18:24Z · handed to the isolated CONTRACT_REVIEW_TIER sub-agent on dc83a28e0e19b4903ca4570efff4dd896c905aa9. Reason: the DELIBERATE CORRECTION on a PR that changes code is confirmed only by a same-head at-tier L2 PASS (pm-dispatch landing-operations.md).

Contract review brief — PR #35616 @ dc83a28e0e19b4903ca4570efff4dd896c905aa9 (card #35588)

You review at CONTRACT_REVIEW_TIER. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template — with a PASS or FAIL verdict, and post it as ONE comment
on the PR or its card.

Inputs — these and nothing else:
· card #35588: its body and EVERY comment (rulings and earlier records included)
· PR #35616: its body, its file list, and the net diff against main at dc83a28e0e19b4903ca4570efff4dd896c905aa9
· the check-runs on dc83a28e0e19b4903ca4570efff4dd896c905aa9: their conclusions ARE the gate verdicts
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

Scope — the paths reviewFace returns as hits on this PR's file list: packages/cli/src/utils/skills-install-state.ts, packages/cli/test/skills-commands.test.ts;
plus every file IN THIS DIFF that directly implements or enforces them — the gate that enforces a rule, the code
a jsdoc or schema line describes, the validator a skill teaches — reviewed for agreement with the contract.
Widen it freely, ⛔ never below hits; the record's Scope: line names the implementing files apart from hits.
The rest of the diff (tests, unrelated modules, lockfiles, generated output, changesets) is the lane seat's
ACCEPT at TIER_DEFAULT, exactly as a standalone PR of those files.
④ judges the hits files and those implementing files ONLY:
lockfiles, generated output, changesets and prose elsewhere in the PR are not reviewed;
code outside the diff is READ to judge them, never reviewed.

Security — if a hits path is under skills/** or ui/skills/** and the change teaches security, auth or permission
behaviour the path name doesn't show, the record says so and the seat adopting the record adds the security label.
The record says so on its Security-touching: line, and the arm lands on no alone: write no ONLY when no changed
hunk teaches permission, sharing, credential, token, authentication or other security behaviour, else yes.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family, and a local run costs more than it returns.
If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.
Scratch space is /tmp/claude-0/-home-user/2348c2d3-196d-58f1-af3d-ba55473c3059/scratchpad/pr-35616/ alone; nothing there you did not write this round is read.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset (or skip-changeset) matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated.
On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a
finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).
④ Design judgment — for EVERY hits file: does the change hold against the code it cites and the
scenario it is accepted against? A skill file against the card's eval prompt and the spec it teaches
on main; a schema file against the ruling or ADR it implements and its first consumer; an ADR
against its first consumer and its execution plan. For EVERY implementing file in the diff: does the
code agree with the contract, sentence by sentence? Read the cited code in the live tree, and try to
break the design.
Grade each finding must-fix, should-fix or nit — a nit has no effect on correctness or the contract.
A must-fix is a FAIL; a must-fix or should-fix earns a delta review of its fix; nits alone end the round.
Spell a must-fix or should-fix with its id and grade, S1 (should-fix) — …, and a clean round as
No must-fix, no should-fix.: the queue guard reads a graded finding as OPEN on this head and
refuses the record; the delta record names those it closes by id alone, S1: closed.
A nit is fixed only on the prose faces, or left as an accepted deviation or a follow-up card: a fix
anywhere else moves the head, and this record no longer covers it.
⛔ Judge the tree, never the PR body's account of it.
Sign Implemented-by: with the dev's branch and Reviewed-by: with your session id — the value is the FIRST
thing after each colon.

Also judge, in ② and ④:
· that the diff is exactly the inverse of 578d3b1d66 (#35495), and nothing else;
· the DELIBERATE CORRECTION: the PR deletes the pending note .changeset/35079-skills-write-staged-swap.md. Quote its headline sentence as it stood on the merge base, and judge sentence by sentence whether, with the code reverted, that note would be false and whether no new changeset is right, i.e. whether the published @objectstack/cli never carried the staged swap;
· that the revert reinstates the pre-#35495 behaviour the PR body names (#35079 returns), with no other public-surface change.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt

Final green head for L1 + L2 (p0): dc83a28e0e19b4903ca4570efff4dd896c905aa9(2026-11-19T18:25Z)

  • A clean revert of fix(cli): stage os skills writes and swap them in by rename, recording last #35495 (578d3b1d66). The diff is byte-identical to that commit's inverse: 3 files, +14/-239.
  • CI on this head: 36 success, 16 skipped, and 1 failure, Check Changeset. That red is by design: route 0, the DELIBERATE CORRECTION class, and it is not a required context.
  • Local: the dispatch-gates self-test passes all 2564 cases, both tiers, exit 0; the case was red at the base. CLI unit tests: 6158 passed. CLI typecheck: exit 0. Dev report: 4-hourly full run: red on main (Lint & Type Check) #35588 comment 7018103582.
  • The DELIBERATE CORRECTION (deleted .changeset/35079-skills-write-staged-swap.md) is confirmed by a same-head at-tier L2. Its brief is 7018123041, run by an isolated sub-agent, and its record goes on this PR.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTcFanGhTvqS1V2Q4U

维护者速读

席位核对 — ACCEPT (L1-a) · repo:objectstack#1 · head dc83a28e0e19b4903ca4570efff4dd896c905aa9 · 2026-11-19T18:27Z


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: dc83a28e0e19b4903ca4570efff4dd896c905aa9
Local-runs: none
Scope: packages/cli/src/utils/skills-install-state.ts, packages/cli/test/skills-commands.test.ts + none
Security-touching: no

Inputs read: card #35588 with all six comments (triage 7015724643, claim 7015796595, withdrawal 7015822306, re-claim 7015849091, dev reports 7016701837 and 7018103582), the body of PR #35616, the net diff against merge base f981dce3be, commit 578d3b1d66, and the check-runs on this head. Nothing was built, run or checked out.

① Derived judgments

  • The diff is the exact inverse of 578d3b1d66 (fix(cli): stage os skills writes and swap them in by rename, recording last #35495), and nothing else: right. The head is one commit on merge base f981dce3be. Its reversed patch and the patch of 578d3b1d66 are the same text once the blob-id lines are set aside: 3 files, 14 lines added and 239 removed here against 239 added and 14 removed there. Both hits files at this head are identical to their state at the parent of 578d3b1d66, and no commit between 578d3b1d66 and the merge base touched any of the three files.
  • Public surface: right, nothing published changes. SKILLS_STAGING_PREFIX is removed. It was exported from the internal module utils/skills-install-state.ts only; on the merge base its only readers were that file and test/skills-commands.test.ts, and the package's exports map does not serve the module. No command, flag, output line, record file name or record shape changes. SKILLS_MANIFEST_FILE, DEFAULT_SKILLS_DIR, inspectSkillsDir, the plan and the applySkillsWrite signature are untouched.
  • Accept-set: right, unchanged. applySkillsWrite still judges every target with underRoot before the first write, so the same plans are refused and the same are accepted as before fix(cli): stage os skills writes and swap them in by rename, recording last #35495.
  • Behaviour that returns: right, and stated. The write is again remove, write, record last, in place. A failure partway can leave skill directories gone or half-written under the old record. This is the defect of cli: os skills install/update writes are not atomic — a failure partway removes the recorded skill directories under the old record, so the next update needs --force (stage and rename) #35079, and the PR body says so in plain words.
  • The red case on main: right by reading. The self-test case names mkdtempSync at skills-install-state.ts:246. At this head the file has no mkdtempSync and no renameSync, so the site the case reported no longer exists. scripts/pm/dispatch-gates.mjs is not in the diff: the gate is not narrowed, as triage 7015724643 required.
  • Gate verdicts on this head: Lint & Repo Gates, TypeScript Type Check, Test Core (10 of 10 shards), Build Core, Lint · PM dispatch-gates, Governed Surface Queue Guard and PR-body guards are success. Check Changeset is failure, which is the expected state of a deliberate correction that deletes a pending note it did not add; it is not a required context. The failing case runs in the slow tier, which a pull request's run does not execute, so no check-run on this head proves it; the dev's local full self-test (2564 cases pass, report 7018103582) and the reading above stand for it until the next scheduled run.

② Semver level

Clause-②: no — right. The diff touches no published schema, spec or protocol; it returns two CLI commands to the behaviour the released package already has.

The DELIBERATE CORRECTION: confirmed. The PR deletes the pending note .changeset/35079-skills-write-staged-swap.md. Its headline sentence, as it stood on merge base f981dce3be:

"fix(cli): os skills install and os skills update stage the new catalog and swap it in by rename, so a write that fails partway leaves the previous skills and their record as they were"

Judged sentence by sentence against the tree at this head:

  1. Front matter, '@objectstack/cli': patch. With the code reverted this would publish a patch release announcing a fix the package does not contain. Wrong if kept.
  2. The headline. False at this head: applySkillsWrite removes each dropped and each replaced directory in place with rmSync, writes the new files in place, and writes the record last with a plain writeFileSync. Nothing is staged, nothing is renamed, and a failure partway does not leave the previous skills as they were.
  3. "Before, a write removed the recorded skill directories first, then wrote the new ones, and wrote the record last: a failure partway ... refused them as changed locally until it was given --force." This describes as past the behaviour that is present again at this head. False as a "before".
  4. "Now every new skill directory is written into a hidden staging directory ... the record is renamed over the old one last; any failure undoes the renames already done and is reported, so the catalog is either wholly the old one or wholly the new one, and a plain os skills update simply runs again." False at this head: there is no staging directory, no rename, no undo, and no all-or-nothing outcome.
  5. "A staging directory a killed run leaves behind (.objectstack-skills-staging-*) is hidden, never read as a skill, and removed by the next write." False at this head: no write creates such a directory, and no code removes one.
  6. The note's own Clause-②: no and Metadata-protocol: none lines were true, and go with the note.

Every behavioural sentence of the note would be false once this PR merges, so deleting it is the right correction; there is no true remainder to keep or reword.

No new changeset: right. The note is still pending on the merge base, and no commit between 578d3b1d66 and the merge base touched packages/cli/package.json or packages/cli/CHANGELOG.md, whose text carries no entry for the staged swap. So no version of @objectstack/cli was cut with #35495 in it, and the published package never carried the staged swap. Relative to the last release the two commands do not change at all, so this PR has nothing to announce. A note of its own would describe a change no user of a published version can observe. skip-changeset is correctly not applied: the PR is not exempt from the rule, it corrects a pending note, and Check Changeset stays red for that reason.

③ Boundary flags

④ Design judgment

packages/cli/src/utils/skills-install-state.ts. The revert holds against the code it restores. Read at this head: every drop and write target is resolved through underRoot before mkdirSync(dir) and before the first removal, so a plan that names a path outside the skills directory is still refused with the directory untouched; only directories the plan names are removed; the record is written after the last skill file. The jsdoc on applySkillsWrite now ends at "Only directories the plan names are touched", and the module header no longer has "The write" section, so no remaining sentence in the file promises atomicity the code does not give. The import line drops mkdtempSync and renameSync and keeps relative, readdirSync and the rest, as before #35495; TypeScript Type Check and Lint · ESLint are success on this head. I tried to break it three ways. A leftover reference to the removed constant: none anywhere in the tree at this head. A half-reverted helper: removeStaging, undoSwap, removeStagingLeftovers and SwapStep are all gone with their only caller. A staging directory left by a build of unreleased main and now orphaned: it is a hidden directory, a skill name starts with a letter or a digit, the inspection code is not in this diff, and no published version ever created one, so no released user can hold one.

packages/cli/test/skills-commands.test.ts. The removed block is an interrupted write leaves the installed catalog usable, with the vi.mock('node:fs') fault injection that served only it and the readdirSync and SKILLS_STAGING_PREFIX imports only it used. Those tests pinned the staged swap; with the swap gone they would fail, so removing them with the code is right and is not a loosening of a surviving contract. The 27 remaining tests are unchanged. The file's own mkdtempSync import is its fixture temp directory, there before #35495.

No must-fix, no should-fix.

Nits, none of which touches correctness or the contract on this head:

  • N1 (nit) — for the re-landing decision. Report 7016701837 and the PR body class an exclusive mkdirSync of a randomly named sibling as an evasion. The tree already carries that exact remedy as a landed fix for the same red case in another package (packages/cloud-connection/CHANGELOG.md, the entry for 4-hourly full run: red on main (Lint & Type Check) #30467). Whoever rules on option B should say which reading holds, so the two packages are not judged differently. Follow-up for the seat; no change to this PR.
  • N2 (nit) — the PR body says the full self-test "was still running when this PR opened". Report 7018103582 has the verdict, 2564 cases pass. PR-body prose only.
  • N3 (nit) — Fixes #35588 closes a generated card whose own text says the next green scheduled run settles it. The slow-tier case is not in this PR's check-runs, so the seat should read the next scheduled full run before treating the card as done. No change to this PR.

Implemented-by: claude/issue-35588-skills-staging-mkdtemp-base
Reviewed-by: session_01L6bhgTyMahdAdhXSzgy2nt

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgTyMahdAdhXSzgy2nt

Landing (p0) · 2026-11-19T18:28Z · area b1-B. L1-a ACCEPT 7018187876 and contract-review record 7018204348 (PASS, CONTRACT_REVIEW_TIER, same head) are both on dc83a28e. The record is the same-head at-tier confirmation of the DELIBERATE CORRECTION. The pending note .changeset/35079-skills-write-staged-swap.md is deleted. Its headline sentence was "os skills install and os skills update stage the new catalog and swap it in by rename, so a write that fails partway leaves the previous skills and their record as they were". With the code reverted, that sentence is false. The published @objectstack/cli never carried the staged swap, so no changeset replaces the note.

Probe Reading
check-governed-merges.mjs --pr 35616 NOT governed · 253 changed lines ≤ 3000
check-runs on dc83a28e0e19b4903ca4570efff4dd896c905aa9 36 success, 16 skipped, 1 failure: Check Changeset, red by design (route 0, DELIBERATE CORRECTION; not a required context) · K = 4 since f981dce3
the red case dispatch-gates full self-test locally on this head: 2564 cases pass, exit 0 (os-dev-report 7018103582)

State: ready and auto-merge now; #35588 closes on merge. In the same round: #35079 is reopened as pm:blocked with Blocked-by: #35611, and #35502 is noted to wait on #35611. Read the next scheduled full run before treating main as green.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

L2 adoption · 2026-11-19T18:31Z · The seat adopts area b1-B's isolated record 7018204348 for head dc83a28e. It was posted with --tier-evidence, with all 16 turns at the tier, and it confirms the DELIBERATE CORRECTION of the pending changeset. The brief, 7018123041, came from --brief-template. This is a clean revert of #35495, ACCEPTed in 7018187876. If Fixes closes #35588 on merge, the next scheduled full run on main still has to confirm the fix: b1-B reads that run, and reopens #35588 if it is still red.

Merged via the queue into main with commit ae2a67d Nov 19, 2026
53 of 54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35588-skills-staging-mkdtemp-base branch November 19, 2026 18:56
zhuangjianguo pushed a commit that referenced this pull request Nov 22, 2026
…g last

Re-lands the staged swap of #35495 (merge 578d3b1), reverted by #35616
because the dispatch-gates mkdtempSync completeness rule could not read the
staging base. The gate now reports such a site in shipped package source
(#36368), so the diff lands unchanged: applySkillsWrite writes every new
skill into a hidden staging directory inside the skills directory, swaps
each touched skill in by rename, renames the record over the old one last,
and undoes the renames already done on any failure.

Claude-Session: https://claude.ai/code/session_01QsR2jTeURPvEm465RcoYEC
Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
…g last (re-land) (objectstack-ai#36465)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCxiFE11rsKwyNffJZKYqJs)_

Fixes objectstack-ai#35079

Clause-②: no
Metadata-protocol: none

## 维护者速读
-
用户能看到什么变化:命令行用户运行「安装技能」或「更新技能」时,若中途写盘失败(磁盘满、无权限、被中断),原有技能和安装记录保持原样,下次直接再运行更新即可,不再需要加强制参数。
-
为什么做:这是技能安装可靠性修复的重新合入;上次合入后因车队门禁读不懂暂存目录而被撤回,门禁那一侧已按你「扫描只管仓内运行的代码」的裁决改好。
- 出错会怎样:最坏是安装或更新在失败时留下一个隐藏的暂存目录,它不会被当成技能读取,下次写入时自动删除;可直接撤回本改动。
- 要你做什么:无。

## What changes

This re-lands the staged swap of PR objectstack-ai#35495 (merge commit `578d3b1d66`),
byte for byte. PR objectstack-ai#35616 reverted it because the dispatch-gates
`mkdtempSync` completeness rule could not read the staging base. That
base is computed from the caller's `dir`, and the scan reads one file at
a time. PR objectstack-ai#36368 (merged `fb6eb801b2c`) carries out ruling record
7075362923: an unresolved site in shipped package source is now
reported, not failed. So the diff lands as written.

- `packages/cli/src/utils/skills-install-state.ts`, `applySkillsWrite`:
every new skill directory is written into one hidden staging directory
inside the skills directory (`.objectstack-skills-staging-*`, from
`mkdtempSync`, so it sits on the same filesystem). Each touched skill is
renamed aside into it, and its staged copy is renamed into place. The
record is written into the staging directory and renamed over the old
one, after every swap. Any throw undoes the renames already done, newest
first. The next write removes any leftover staging directories. They are
hidden, so `status`, the plan and `inspectSkillsDir` never read them as
skills.
- `packages/cli/test/skills-commands.test.ts`: a new top-level
`describe` in the shared harness. It injects `ENOSPC` at three points (a
staged file write, moving the second skill into place, the record
rename) and has one leftover-staging case. The fault seam is a hoisted
pass-through `vi.mock('node:fs')`. The test's own scratch base is
`tmpdir()`, which the scan can read.
- `.changeset/35079-skills-write-staged-swap.md`: objectstack-ai#35495's patch
changeset for `@objectstack/cli`, unchanged.

Proof of identity with objectstack-ai#35495: `git diff --cached` after `git
cherry-pick -n 578d3b1` equals `git diff 578d3b1~1 578d3b1` (a
`diff` of the two outputs printed nothing). Both target files on
`origin/main` `ff601499008` are byte-equal to the merge's parent
`eb1f85d7f4`: `git diff eb1f85d HEAD` on those two paths was empty
before the pick. So nothing on main needed adapting.

Files to read first (risk order):
1. `packages/cli/src/utils/skills-install-state.ts`,
`applySkillsWrite`'s `try`/`catch` and `undoSwap`. This is the swap and
its rollback.
2. `packages/cli/test/skills-commands.test.ts`, the `vi.mock('node:fs')`
fault seam at the top of the file. It is a pass-through unless a test
arms it.
3. `packages/cli/test/skills-commands.test.ts`, the describe `an
interrupted write leaves the installed catalog usable`.

Two-minute check: `node scripts/pm/dispatch-gates.mjs --self-test 2>&1 |
grep "no mkdtempSync site in a test file"` should print one passing
line. It reports `packages/cli/src/utils/skills-install-state.ts:246`
under "reported, not failed".

## Tests

All readings at head `009ca680a2f` (base `origin/main` `ff601499008`).

- `packages/cli/test/skills-commands.test.ts`, run under the verify lock
after the `@objectstack/cli^...` closure build: `Test Files 1 passed
(1)`, `Tests 34 passed (34)`, `VERDICT command-exit 0`. That is the 30
existing cases plus the 4 new interrupted-write pins.
- `pnpm --filter @objectstack/cli build`: exit 0 in the same locked run.
- `node scripts/pm/dispatch-gates.mjs --self-test`, both tiers: `fast
2264 case(s) · slow 315 case(s)`, `✓ dispatch-gates self-test: 2579
cases pass.`, exit 0. It includes the slow case this re-land was blocked
on, which now passes.
- Declared narrowing: the full cli `unit` tier and `pnpm --filter
@objectstack/cli typecheck` did not get a lock turn before this PR
opened. Two long batteries owned by other seats held the shared lock for
more than an hour. Both are declared to CI (`Test Core`, `TypeScript
Type Check`). The `integration` tier is declared to CI: the diff touches
no integration-tier file and no spawn entry.

<details><summary>The live slow case, from the full self-test
log</summary>

```text
  ✓ the sweep really read this tree (3154 directory-creating site(s) across 23442 tracked source(s))
  ✓ and it really found in-tree fixture roots (93), so the coverage case below judges something
  ✓ every in-tree directory this tree's sources create is covered by a tracked ignore rule, or is tracked itself
  ✓ no mkdtempSync site in a test file or repo tooling takes a base the scan cannot read — reported, not failed (shipped package source, base chosen at run time): packages/cli/src/utils/skills-install-state.ts:246 (dir is not bound in this file)
dispatch-gates self-test tiers: fast 2264 case(s) in 576.2s · slow 315 case(s) in 1879.5s.
✓ dispatch-gates self-test: 2579 cases pass.
```
</details>

## Acceptance notes

- Gate-side unblock: the slow case's own logic also passed when called
through the scan's exports at head `009ca680a2f`
(`exposedScratchDirs({})` + `mkdtempCompleteness`): 3154 sites across
23442 tracked sources, 93 in-tree, exposed 0, unresolved 508, failing 0,
reported 1 (`packages/cli/src/utils/skills-install-state.ts:246 (dir is
not bound in this file)`). No `scripts/pm/**` file is touched.
- Residual, unchanged from objectstack-ai#35495: a hard kill (SIGKILL, power loss, an
unhandled SIGINT) inside the rename-only swap window can still leave
mixed state. The failure path the card names, a throw the process
survives, is handled. The hard-kill window is tracked as objectstack-ai#35502.
- Ablation not re-run: the source and test are byte-identical to objectstack-ai#35495,
whose red-before and ablation runs are on record in its os-dev-report
(7008338749): 4 failed / 30 passed on the old source, 34 / 34 on the
fix.

## Verification

<details><summary>Derived gate families: 64 derived, 61 run, 3 NOT
MEASURED, 0 unrun (head 009ca68)</summary>

- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 64 families. Each one ran with its
exit code captured before any pipe. Then `--ran` reconciled them: `✓
dispatch-gates --ran: 64 derived famil(ies) accounted for — 61 run, 3
NOT-MEASURED (3 DERIVED from a recorded exit 3).`
- 61 exited 0. Among them: `check:nul-bytes`,
`check:cross-package-test-inputs`, `check:test-source-alias`,
`check:cli-test-child-env`, `check:published-files`,
`check:dts-closure`, `check:i18n`, `check:lean-entry-closure`,
`check-changeset-no-major`, `check-empty-changeset`,
`check-adr-0087-registration` and `check-closing-keyword-parity` (each
with `--self-test` where it is derived). Eight gates first answered exit
3 before the build. They were re-run after the closure build, and five
of them went to exit 0.
- NOT MEASURED, exit 3 (PREREQUISITE NOT MET), all three left to CI:
`pnpm check:dual-build-cjs-loads` (packages outside the cli closure have
no `dist/`), `pnpm check:i18n-coverage` (example configs outside the
closure are not built), and `pnpm check:type-check-debt` (its re-measure
build did not get a turn on the shared lock).
- `node scripts/pm/dispatch-gates.mjs --tier`: no path-derived mandate.
Changed lines: 253 (+239 / -14), under the 3000 threshold.
- `node scripts/pm/overlap-check.mjs
--branch=claude/issue-35079-skills-staged-swap-reland`: `VERDICT clean
exit 0`, run before the push.
- Body gate: `node scripts/check-closing-keyword-parity.mjs --body`
binds exactly one declaration, this card's, on the line under the
header.
</details>

`@objectstack/cli` publishes, so the patch changeset from objectstack-ai#35495 comes
along unchanged. No `skip-changeset`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- signed: repo:objectstack#7 · zhuangjianguo ·
session_01QsR2jTeURPvEm465RcoYEC -->

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4-hourly full run: red on main (Lint & Type Check)

2 participants