Skip to content

bench: a symlinked checkout makes the preflight exit 0 without doing anything (the gate is silently skipped) #3363

Not planned

Description

@HugoXK

Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment on this issue.

Written-by: FlyBot Lead
Claimed-by: FlyBot Lead
Claim-Id: 1dc23814741e45b2a45238eb4c354eca
Branch: dev/1-preflight-symlink-entry
Base: bab1fe9
At: 2026-11-24T08:51:01Z

Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment.

Written-by: FlyBot Lead
Bot: FlyBot Dev-1

Read against live main bab1fe963b65913f5cd1021d30e6598a7f571627 (GitHub Date: Tue, 24 Nov 2026 08:49Z).

What is wrong today, in one user sentence: when the checkout is reached through a symlink (a worktree directory linked into place, or a path that crosses one), the bench preflight silently does nothing and exits 0 — so bench.sh walks straight past the gate #3360 hardens and dies later in the shell exactly as before, with no line saying the preflight was skipped.

Readings at bab1fe96:

  • core/dev/bench-preflight.mjs:84-86 — the CLI entry point is guarded by identity of the script URL:
    if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
      process.exit(main())
    }
    import.meta.url is the resolved module URL, while pathToFileURL(process.argv[1]) keeps whatever path the shell passed. Reached through a symlink the two never match, so main() never runs, the process exits 0, and problemLine(...) is never printed.
  • core/dev/bench.sh:90 — the caller is exactly that shape: node "$PLUGIN/dev/bench-preflight.mjs" "$DSH_HARNESS" || exit 1. $PLUGIN comes from dirname "$0", so any symlinked component in the invocation path reaches the guard above unchanged.
  • core/test/bench-preflight.test.js:97-128 — the fixture already builds a checkout-shaped tree and spawns /bin/sh bench.sh (:124) with a bin/ of symlinks (:108 symlinkSync(process.execPath, join(bin, 'node'))); it never exercises a symlinked script path, which is why this stays green today.

Red first

In core/test/bench-preflight.test.js:

  1. Build the same checkout-shaped fixture, but invoke the script through a symlink: symlinkSync(join(root,'core','dev','bench-preflight.mjs'), join(root,'linked-preflight.mjs')), then spawnSync(process.execPath, [join(root,'linked-preflight.mjs'), harnessMissingATool]) → expect status === 1 and stderr naming the missing tool. Today: status === 0, empty stderr (the guard is false).
  2. Run bench.sh with $PLUGIN reached through a symlinked directory and a PATH that lacks the tool → expect the bench home is not created (the preflight refuses first). Today it proceeds past the preflight.

Expected shape of the fix: compare the resolved paths (realpathSync(argv[1]) against fileURLToPath(import.meta.url)) and treat an unreadable argv[1] as "not the entry point" without throwing; keep the module import side-effect free.

Scope

May touch: core/dev/bench-preflight.mjs (:84-86 only), core/test/bench-preflight.test.js, docs/** if arch-docs asks for a line, changelog.d/<issue>.fixed.md, and the generated mirror under patches/ds-bot/ if topics.json assigns core/dev/** (regenerate, never hand-edit).
Must not touch: the missing-tool state and bench.sh ordering that open #3362 is changing (branch from the new main once it lands, or keep to :84-86 if it has not); core/src/**, core/client.js, plugins/**.

Dedupe

repo:ThinkFlowLab/FlyBot bench preflight → 0 issues before #3360; #3360 is the missing-tool state, a different hunk of the same file (:54-70 + bench.sh ordering). No issue mentions the symlink entry-point guard (symlink, pathToFileURL, realpath → 0 hits against core/dev/bench-preflight.mjs).

Activity

  1. Birfy commented on Nov 25, 2026

    @Birfy
    Collaborator

    基于已退役布局关闭(关闭原因,非验收结论)

    • main 锚点:d8898cad(2026-11-25T12:20:16Z,2156 blobs)
    • 正文引用的定位路径在 main d8898cad 上不存在
    • Release FlyBot 0.3.0 with the OpenTeamily workspace #3377(FlyBot 0.3.0,2026-11-25T01:29Z)移除了 core/ plugins/ policy/ patches/ .github/agent/ .github/scripts/ workflows/test.yml
    • 结论:重构前血缘的条目,无法在当前 main 上复现或评审;如仍需该项能力,请在现行线上重开一条并写明当前路径
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions