Copilot repo hook test can fail with BrokenPipe when RTK is absent
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 85/100
Research direction
Read tests/copilot_repo_hook_test.rs, especially the fixture around lines 28-55, alongside .github/hooks/rtk-rewrite.json. Run the provided reproduction script to force the empty-PATH ordering. Change only the empty-PATH test to use null stdin and keep the piped payload for the installed-RTK case; done when the test passes without a broken pipe.
Written by the indexing model from the issue text.
Description
What happened
hook_is_silent_and_succeeds_without_rtk was the sole failure in two full Linux test runs based on develop at 3ab08bec. Both runs reported 5,423 passes and eight skips. The only local change was in the Cargo formatter. The hook and its integration test match upstream.
thread 'hook_is_silent_and_succeeds_without_rtk' panicked at tests/copilot_repo_hook_test.rs:45:10:
write payload: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }
With an empty PATH, the shell command exits 0 before reading stdin. The fixture assumes the test process always writes first.
Reproduction
This forces the failing order against the real hook. Run it from the checkout root.
import json, os, subprocess, tempfile
from pathlib import Path
hook = json.loads(Path(".github/hooks/rtk-rewrite.json").read_text())["hooks"]["PreToolUse"][0]["bash"]
with tempfile.TemporaryDirectory() as empty:
with subprocess.Popen(
["/bin/sh", "-c", hook], env={"PATH": empty},
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
) as child:
assert child.wait() == 0
assert child.stdout.read() == child.stderr.read() == b""
os.write(child.stdin.fileno(), b'{"tool_name":"run_in_terminal","tool_input":{"command":"git status"}}')
With stdin connected to /dev/null, the empty-PATH case exited 0 silently ten times. The installed-RTK case still consumed the original payload and returned rtk git status in all ten runs.
Would a fixture-only PR be welcome? I would give the empty-PATH test null stdin and keep the existing piped payload and assertions for the installed-RTK test.
- Dominant language
- Rust
- Stars
- 86.4k
- Forks
- 5.5k
- Avg merge
- 7d 6h
- Merged PRs (30d)
- 48
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rtk-ai/rtk
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
delegates call `rtk rewrite <cmd>` without `--`, so a command of `--help` or `-h` comes back as rtk's help text with exit 0Possibly taken @LeviReisJs claimed this 2 days ago. Openarea:cli area:security bug priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
rtk-ai/rtk#5127 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
hooks: version floor says `rtk rewrite` came in 0.23.0; it came in 0.25.0Possibly taken @TechWizard9999 claimed this 2 days ago. Openarea:docs bug good first issue priority:low
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
tinystream-dev/tinystream#132 ·
-
contract good first issue testing
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Emmyt24/nova-launch#2436 ·
Maintainers usually reply within 1 day