Skip to content

home-lock.test.js removes its home before the host is disposed, and the fix cannot be generated without git #2730

Closed

Description

@Birfy

Written-by: Chief

core/test/home-lock.test.js leaves two ds-bot-lock-* directories in TMPDIR on every run. The cause is order, not a missing hook: tempHome(t) registers t.after(() => rmSync(home)) when the home is created, while start(t, home) registers t.after(() => ctx.dispose()) later (core/test/home-lock.test.js:14 and :125). node:test runs after-hooks in registration order, so the home is removed first and dispose()'s diagnostics append re-creates it through mkdir(dirname(logPath), { recursive: true }) (core/src/host/diagnostics.js:197).

Measured on main 3e90f475 with a private TMPDIR: # tests 14 / # pass 14 / # fail 0, leftovers 2. Same tree with the removal registered after dispose(): leftovers 0, 14/14, and 10 repeat runs stayed at 0. The split-out PR #2729 fixes the other four files of #2726.

Why this is open instead of fixed. test/home-lock.test.js is an upstream file, so its change lives as a hunk inside patches/ds-bot/0001-core-fixes.patch. Writing that hunk needs node scripts/ds-bot-patches.mjs generate, which asks git for the diff, and this host has no git. The gate that would catch a hand-written hunk is canonical (test.yml → package → node scripts/ds-bot-patches.mjs canonical): it re-runs generate into a scratch copy and compares the series byte for byte, so a hunk whose boundaries differ from git's output fails even when it reproduces core/. Reproducing git's hunk layout by hand is a guess, and a wrong guess is a red required check.

What unblocks it, one of:

  • a workstation (or CI job) that has git, so generate + check + canonical can run — the honest route; or
  • an owner decision to ship a hand-written hunk and let one CI run confirm it, accepting a red package job if the layout misses.

The fix itself is small and already verified: a tempHome(t, { defer: true }) for the eight host tests, with start() registering t.after(() => ctx.dispose()) first and t.after(() => removeHome(home)) last.

Activity

  1. added
    area:automationScheduled tasks and automation
    bugSomething isn't working
    needs-humanThe agent loop stopped; a person must decide (reason in the last comment)
    on Nov 9, 2026
  2. self-assigned this
    on Nov 9, 2026
  3. Birfy commented on Nov 9, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Chief

    core/test/home-lock.test.js 的修法已经验证过(tempHome(t,{defer:true}):14/14、连跑 10 次残留 0),但它改的是上游文件的 patch 分块——本机没有 git,ds-bot-patches.mjs generate 跑不了,canonical 检查又是逐字节比对 generate 的输出,手写 hunk 有较大概率直接红。

    选一个:

    • A 给一台有 git 的环境(哪怕只是临时容器):我跑 generate + check + canonical,然后一条龙开 PR;
    • B 授权我手写 patches/ds-bot/0001-core-fixes.patch 的 hunk,开一个 draft PR 冒一次 CI——canonical 红就关掉,不留痕;
    • C 先挂着,等以后有 git 再说(这条只是每次测试残留 2 个临时目录,不影响功能)。

    回 A、B 或 C 就行。

  4. Birfy commented on Nov 10, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: FlyBot 实现线

    git is on this host now (git --version 2.39.5 under /data/dsh/bot/workspace/tools/bin), so the honest route ran end to end: the patch hunk is node scripts/ds-bot-patches.mjs generate output, check reports 0 problems, and canonical is green — ok patches/ds-bot/ is what generate writes (generate is a no-op). Nothing in the series was hand-written.

    The fix is the verified one: tempHome(t, { defer: true }) for the eight host tests, start() registering ctx.dispose() first and the home's removal after it. Measured with a private TMPDIR:

    • before: # tests 14 | # pass 14 | # fail 0, leftover ds-bot-lock-* = 2
    • after: 14/14 and leftover 0 on three runs in a row
    • TZ=UTC npm run verify: green (core 3185 tests, 0 fail, 1 skipped; four plugin suites, .github scripts, interop, live-e2e)

    PR: #2794 (branch dev/2730-home-lock-dispose-order, tip e2340c9a6bf7cd89ea6e14cce70d6a9228d7d117), label agent-pr, assignee Birfy. Left the needs-human label alone — that is Triage's call now that the git blocker is gone.

  5. added a commit that references this issue on Nov 10, 2026
    6f6da95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:automationScheduled tasks and automationbugSomething isn't workingneeds-humanThe agent loop stopped; a person must decide (reason in the last comment)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions