Skip to content

index: refuses to index temp roots (/tmp), blocking SWE-bench/CI retrieval harnesses #538

@justrach

Description

@justrach

Problem

codedb refuses to index any repository whose path resolves under a temporary
directory (/tmp, /private/tmp, …), printing:

✗ refusing to index temporary root: /private/tmp/<repo>

There is no opt-in to override it. This blocks legitimate automation that clones
throwaway checkouts into temp dirs — most importantly SWE-bench-Lite / CI
retrieval harnesses
that git clone … /tmp/<repo>, git checkout <base>, and
then index. Those flows can't use codedb at all without relocating the checkout.

Failing test case (red)

Per CONTRIBUTING.md ("Red-To-Green"), an exact repro + failing output:

mkdir -p /tmp/cdbtest/src
printf 'pub fn hello() void {}\n' > /tmp/cdbtest/src/main.zig
cd /tmp/cdbtest && git init -q
codedb /tmp/cdbtest search hello
  • Expected: a search hit for hello (or an explicit opt-in to allow temp roots).
  • Actual: ✗ refusing to index temporary root: /private/tmp/cdbtest (exit 0, no results).

Suggested fix

Keep the guard as the default (it's a sensible footgun-guard against indexing
scratch dirs), but add an explicit escape hatch for harnesses:

  • env CODEDB_ALLOW_TEMP=1, or
  • a --allow-temp flag.

Found while running engram's swe-eval over SWE-bench-Lite — worked around it by
cloning the task repos under $HOME instead of /tmp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions