Skip to content

fix: throwaway repros silently used the live session - #2600

Open
HackAttack wants to merge 1 commit into
herdrdev:masterfrom
HackAttack:isolation-fail
Open

fix: throwaway repros silently used the live session#2600
HackAttack wants to merge 1 commit into
herdrdev:masterfrom
HackAttack:isolation-fail

Conversation

@HackAttack

@HackAttack HackAttack commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

The herdr-throwaway-repro skill did not have its intended effect. A disposable session never started, and once it failed there was nothing left to stop the reproduction from running in the user's live session.

The skill's only documented way to create a disposable session was herdr --session <name> typed into an outer pane. That launches the TUI, and a TUI launched from a Herdr-managed pane exits 1 with "nested herdr is disabled by default" unless the user opted into experimental.allow_nested.

The rejection was printed inside the scratch pane, which was closed later, while the driving shell only saw 25 seconds of "No such file or directory" from polling for a session socket that was never going to appear. Then it fell back to herdr pane send-text/send-keys/read with no explicit session and no env prefix, which hit the default session.

Fix by starting the disposable session with herdr --session <name> server, which is dispatched before the nested gate and needs no config change or outer pane. Address it with the --session flag, which marks the session explicit so the inherited HERDR_SOCKET_PATH is ignored and a missing session fails with server_not_running. The HERDR_SESSION variable the skill used for targeting does not do this; it loses to that inherited socket path and answers from the user's session instead.

@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The throwaway reproduction workflow now starts a headless Herdr server, creates its initial workspace, optionally supports an attached client, targets control commands explicitly, and performs verified cleanup.

Changes

Throwaway session isolation

Layer / File(s) Summary
Headless session startup
.agents/skills/herdr-throwaway-repro/SKILL.md
The workflow rejects conflicting session names, starts a headless server with cleared inherited context, waits for the session, creates an 80x24 workspace, and uses temporary configuration for attached clients.
Explicit control and cleanup
.agents/skills/herdr-throwaway-repro/SKILL.md
Control commands require --session, pane run requires a pane ID and command, and cleanup verifies session removal and removes temporary resources.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🟡 Moderate · up to ea2df

The change prevents throwaway repros from silently using the live session, but unsafe session-name handling, predictable temporary-file paths, and a session-ownership race can still cause command/path injection, unrelated-file damage, or cleanup of another session. The PR is not merge-ready until these bounded risks are addressed or explicitly accepted.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary fix: preventing throwaway reproductions from using the live session.
Description check ✅ Passed The description explains the session-isolation failure, its cause, and the implemented fix using an explicit disposable session.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8731fef1-46d1-4e5a-a8fe-e1a3dc923c35

📥 Commits

Reviewing files that changed from the base of the PR and between 6c6ddcd and 87141db.

📒 Files selected for processing (3)
  • .agents/skills/herdr-throwaway-repro/SKILL.md
  • docs/next/CHANGELOG.md
  • skills/herdr/SKILL.md

Comment thread .agents/skills/herdr-throwaway-repro/SKILL.md Outdated
Comment thread docs/next/CHANGELOG.md Outdated
@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown

Greptile Summary

The PR revises the throwaway-reproduction skill to start explicitly named headless sessions and consistently target them with --session, preventing accidental commands against the live user session.

  • Adds safeguards for session-name reuse and startup failure.
  • Documents headless workspace creation and optional nested-client setup.
  • Updates command targeting and cleanup guidance.

Confidence Score: 4/5

The PR is not yet safe to merge because the documented server startup can still block the driving shell and prevent the throwaway reproduction from proceeding.

The skill recognizes that the server is foreground-running but supplies only a direct server invocation and refers to an unspecified background primitive, leaving the previously reported workflow-blocking failure outstanding.

Files Needing Attention: .agents/skills/herdr-throwaway-repro/SKILL.md

Important Files Changed

Filename Overview
.agents/skills/herdr-throwaway-repro/SKILL.md Reworks disposable-session startup, targeting, client attachment, and cleanup guidance, but the previously reported nonblocking-launch defect remains unresolved.

Reviews (4): Last reviewed commit: "fix: throwaway repros silently used the ..." | Re-trigger Greptile

Comment thread .agents/skills/herdr-throwaway-repro/SKILL.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.agents/skills/herdr-throwaway-repro/SKILL.md (1)

50-60: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Run the server in the background before continuing.

The command ends with herdr --session <session-name> server, but the server stays in the foreground. A shell or pane that follows these instructions blocks at this step, so session list, workspace creation, and reproduction commands do not run.

Use the installed tool's background primitive, or background the process and redirect its output to a /var/tmp log.

Proposed shell change
-  herdr --session <session-name> server
+  nohup herdr --session <session-name> server \
+    >"/var/tmp/<session-name>-server.log" 2>&1 </dev/null &

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7daea657-a646-483a-bf63-c445b1a2ea86

📥 Commits

Reviewing files that changed from the base of the PR and between 87141db and 8e86978.

📒 Files selected for processing (2)
  • .agents/skills/herdr-throwaway-repro/SKILL.md
  • docs/next/CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/next/CHANGELOG.md

Comment thread .agents/skills/herdr-throwaway-repro/SKILL.md Outdated
Comment thread .agents/skills/herdr-throwaway-repro/SKILL.md Outdated
@HackAttack
HackAttack force-pushed the isolation-fail branch 2 times, most recently from c7fc62a to 7708d15 Compare August 11, 2026 15:28
Comment thread .agents/skills/herdr-throwaway-repro/SKILL.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f247886a-071d-4de4-80a9-a208fdafce70

📥 Commits

Reviewing files that changed from the base of the PR and between c7fc62a and 7708d15.

📒 Files selected for processing (2)
  • .agents/skills/herdr-throwaway-repro/SKILL.md
  • docs/next/CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/next/CHANGELOG.md

Comment on lines 60 to +67
env \
-u HERDR_SOCKET_PATH \
-u HERDR_CLIENT_SOCKET_PATH \
-u HERDR_SESSION \
-u HERDR_WORKSPACE_ID \
-u HERDR_TAB_ID \
-u HERDR_PANE_ID \
herdr --session <session-name>
herdr --session <session-name> server

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Validate and quote the session name before shell interpolation.

The suggested repro-<topic>-<timestamp> format does not constrain <topic>. When the placeholder is replaced with whitespace, shell metacharacters, /, or .., the commands can split arguments, execute unintended commands, or escape /var/tmp. Require a name such as ^[A-Za-z0-9][A-Za-z0-9_-]*$, and quote every session-name expansion.

Proposed validation pattern
+case "$session_name" in
+  ''|*[!A-Za-z0-9_-]*) exit 1 ;;
+esac
+
-  herdr --session <session-name> server
+  herdr --session "$session_name" server

Comment on lines +80 to +82
```bash
printf '[experimental]\nallow_nested = true\n' > /var/tmp/<session-name>-config.toml
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Create the nested-client config with an exclusive temporary path.

printf ... > /var/tmp/<session-name>-config.toml can follow an existing symlink or overwrite an unrelated file. Cleanup can then remove that file. Use mktemp, store the returned path, pass that path through HERDR_CONFIG_PATH, and remove only that exact path.

Proposed temporary-file handling
-printf '[experimental]\nallow_nested = true\n' > /var/tmp/<session-name>-config.toml
+config_path="$(mktemp /var/tmp/herdr-repro-config.XXXXXX)"
+printf '[experimental]\nallow_nested = true\n' >"$config_path"

- HERDR_CONFIG_PATH=/var/tmp/<session-name>-config.toml
+ HERDR_CONFIG_PATH="$config_path"

- Remove /var/tmp/<session-name>-config.toml
+ Remove "$config_path"

Also applies to: 166-167

Comment thread .agents/skills/herdr-throwaway-repro/SKILL.md

@ogulcancelik ogulcancelik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the throwaway-repro correction is useful, but please keep this PR to . tracks the latest stable release and cannot change in normal feature/fix work, and is for user-facing runtime changes rather than project skill maintenance. after dropping those two edits, please rebase onto current master and rerun the checks.

@ogulcancelik
ogulcancelik dismissed their stale review August 24, 2026 20:02

replacing a malformed review body

@ogulcancelik ogulcancelik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the throwaway-repro correction is useful, but please keep this PR to .agents/skills/herdr-throwaway-repro/SKILL.md. skills/herdr/SKILL.md tracks the latest stable release and cannot change in normal feature/fix work, and docs/next/CHANGELOG.md is for user-facing runtime changes rather than project skill maintenance. after dropping those two edits, please rebase onto current master and rerun the checks.

The herdr-throwaway-repro skill did not have its intended effect. A
disposable session never started, and once it failed there was nothing
left to stop the reproduction from running in the user's live session.

The skill's only documented way to create a disposable session was
`herdr --session <name>` typed into an outer pane. That launches the
TUI, and a TUI launched from a Herdr-managed pane exits 1 with "nested
herdr is disabled by default" unless the user opted into
`experimental.allow_nested`.

The rejection was printed inside the scratch pane, which was closed
later, while the driving shell only saw 25 seconds of "No such file or
directory" from polling for a session socket that was never going to
appear. Then it fell back to `herder pane send-text/send-keys/read` with
no explicit session and no env prefix, which hit the default session.

Fix by starting the disposable session with `herdr --session <name>
server`, which is dispatched before the nested gate and needs no config
change or outer pane. Address it with the `--session` flag, which marks
the session explicit so the inherited HERDR_SOCKET_PATH is ignored and a
missing session fails with server_not_running. The HERDR_SESSION
variable the skill used for targeting does not do this; it loses to that
inherited socket path and answers from the user's session instead.
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@HackAttack

Copy link
Copy Markdown
Contributor Author

Got it, done.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
.agents/skills/herdr-throwaway-repro/SKILL.md (1)

81-82: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Create the nested-client configuration with an exclusive temporary path.

printf ... > /var/tmp/<session-name>-config.toml uses a predictable path. It can follow an existing symlink or overwrite an unrelated file. Cleanup can then remove that file.

Use mktemp, retain the exact returned path, pass it through HERDR_CONFIG_PATH, and remove only that path.

Proposed temporary-file handling
-printf '[experimental]\nallow_nested = true\n' > /var/tmp/<session-name>-config.toml
+config_path="$(mktemp /var/tmp/herdr-repro-config.XXXXXX)"
+printf '[experimental]\nallow_nested = true\n' >"$config_path"

-HERDR_CONFIG_PATH=/var/tmp/<session-name>-config.toml
+HERDR_CONFIG_PATH="$config_path"

-Remove /var/tmp/<session-name>-config.toml
+Remove "$config_path"

Also applies to: 166-167


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8a169859-dd8a-4453-861e-df5357e50602

📥 Commits

Reviewing files that changed from the base of the PR and between d79fd74 and ea2dfd3.

📒 Files selected for processing (1)
  • .agents/skills/herdr-throwaway-repro/SKILL.md

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment on lines +46 to +52
Choose a short unique name such as `repro-<topic>-<timestamp>`, then prove it is unused before launching:

Use `/var/tmp` or a dedicated reproduction directory as the new pane's cwd. Save the returned outer pane ID. This is the only parent-session pane that cleanup may close.
```bash
herdr session list --json
```

## Start the disposable session
That lists stopped sessions as well as running ones. A running name is refused, but starting a server on the name of a stopped session silently restores that session's saved workspaces and panes, and cleanup would then delete someone else's session. Pick another name on any exact match.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Reserve the session name atomically before launch.

session list and server are separate operations. Another process can create a stopped session after the list check. The server then restores that session, and cleanup deletes it as if it belonged to this reproduction.

Use an atomic name reservation or creation operation. Otherwise, require an ownership token before cleanup; a second list check is not sufficient.

Comment on lines +46 to +54
Choose a short unique name such as `repro-<topic>-<timestamp>`, then prove it is unused before launching:

Use `/var/tmp` or a dedicated reproduction directory as the new pane's cwd. Save the returned outer pane ID. This is the only parent-session pane that cleanup may close.
```bash
herdr session list --json
```

## Start the disposable session
That lists stopped sessions as well as running ones. A running name is refused, but starting a server on the name of a stopped session silently restores that session's saved workspaces and panes, and cleanup would then delete someone else's session. Pick another name on any exact match.

Choose a short unique name such as `repro-<topic>-<timestamp>`.
Start it as a headless server. `herdr --session <name>` launches the TUI, and launching the TUI from inside a Herdr pane exits with `nested herdr is disabled by default` unless the user enabled `experimental.allow_nested`. The `server` command has no such gate.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Validate and quote session-name before substitution.

The suggested repro-<topic>-<timestamp> format does not constrain <topic>. Whitespace, shell metacharacters, /, or .. can split arguments or escape /var/tmp through the generated configuration path.

Require a safe pattern such as ^[A-Za-z0-9][A-Za-z0-9_-]*$, and quote every substituted value.

Also applies to: 81-82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Trigger automated AI reviews for pull requests admitted by the PR gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants