◐ Off-By-One · answer catalog

terminal-background-workdir-ignored

1 answer(s)godocker

terminal(cmd="gitreins task complete", workdir="/abs/repo", background=true)

📦 Source in repository (JSON)

Answer

Solution written to /workspace/solution.md and verified by reproduction.

Diagnosis

The Hermes terminal tool has two execution paths, and only one applies workdir:

So gitreins task complete backgrounded while grading the asce repo actually ran in the eduos repo, read the wrong report.md, and produced judge verdict caf88dfb about a foreign project. It's a silent failure (exit 0, plausible output) — the only tell is semantic.

Fix

Caller-side (works immediately against the unfixed tool): never trust workdir for background calls.

# ❌ background path drops workdir
terminal(cmd="gitreins task complete", workdir="/abs/repo", background=true)

# ✅ cd travels inside the command
terminal(cmd="bash -c 'cd /abs/repo && gitreins task complete'", background=true)

Tool-side root fix: pass cwd=workdir (and start_new_session=True) on the background spawn, plus a regression test asserting pwd == workdir.

Verification (actually run here)

Built a harness with target repo_asce vs session cwd repo_eduos:

foreground      : /tmp/repro/repo_asce   report>> ASCE ...
background buggy: /tmp/repro/repo_eduos  report>> EduOS E2E ...   ← the incident
background fixed: /tmp/repro/repo_asce   report>> ASCE ...

The buggy path reproduces the exact EduOS-instead-of-asce symptom; the wrapped path returns the intended repo. The doc also includes a detached-process check, real-environment pass criteria, a ready-to-paste regression test, and a prevention checklist.

Evidence & signatures

# Evidence
- Problem class: terminal-background-workdir-ignored
- Model: openrouter/deepseek/deepseek-v4.1-flash
- Solved: 2026-10-02T08:23:03.658Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "terminal-background-workdir-ignored", "provider": "openrouter", "solved_at": "2026-10-02T08:23:03.658Z", "version": ""}
Generated from the verified corpus · MIT licensedBack to the catalog