Skip to content

docs(custom): add PATH modification example#2882

Open
rh-hemartin wants to merge 1 commit into
mainfrom
docs/document-path-modification
Open

docs(custom): add PATH modification example#2882
rh-hemartin wants to merge 1 commit into
mainfrom
docs/document-path-modification

Conversation

@rh-hemartin

@rh-hemartin rh-hemartin commented Jul 2, 2026

Copy link
Copy Markdown
Member
  • Add a section documenting how to modify the PATH when you add new tools.

Closes #2883

Signed-off-by: Hector Martinez <hemartin@redhat.com>
@rh-hemartin rh-hemartin requested a review from a team as a code owner July 2, 2026 06:45
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Document how to modify PATH for custom tools via host_files

📝 Documentation 🕐 Less than 5 minutes

Grey Divider

AI Description

• Add a walkthrough for injecting new executables and PATH changes into the sandbox.
• Show using host_files to stage a script and an .env.d file.
• Clarify why env.sandbox cannot be used to modify PATH.
Diagram

graph TD
  A["Harness config: host_files"] --> B["Stage tool: /tmp/bin/my-tool.sh"] --> D["Agent execution"] --> F["PATH includes /tmp/bin"]
  A --> C["Stage env: .env.d/path-modification.env"] --> E["Workspace .env sources .env.d/*"] --> D
Loading
High-Level Assessment

The chosen approach (documenting host_files + .env.d sourcing) is the most practical and least surprising for users because it matches the existing sandbox initialization behavior and avoids relying on restricted environment variables like PATH in env.sandbox.

Files changed (1) +35 / -0

Documentation (1) +35 / -0
customizing-agents.mdAdd example for modifying PATH via host_files and .env.d +35/-0

Add example for modifying PATH via host_files and .env.d

• Introduces a new “Modifying the PATH” section showing how to copy an executable into the sandbox and prepend its directory to PATH using an '.env.d' file. Adds an explanatory note that 'env.sandbox' cannot be used for PATH changes due to variable restrictions.

docs/guides/user/customizing-agents.md

@fullsend-ai-review

fullsend-ai-review Bot commented Jul 2, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 6:46 AM UTC · Completed 6:57 AM UTC
Commit: 82f560a · View workflow run →

@rh-hemartin

Copy link
Copy Markdown
Member Author

cc @ralphbean as stated in the docs env.sandbox is preventing me from modifying the PATH (reservedSandboxKeys) but I can modify them with the environment files. I think I can make the agent malfunction using env files instead of env.sandbox and I think we need to let the users modify the PATH, so maybe there is a followup here to allow PATH to be set on env.sandbox.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Site preview

Preview: https://7cf3db48-site.fullsend-ai.workers.dev

Commit: 82f560ac9a3fed11418375dd88487e3d4374015d

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (1)

Context used
✅ Compliance rules (platform): 54 rules

Grey Divider


Action required

1. PATH procedure lacks numbered steps 📜 Skill insight ✧ Quality
Description
The new ### Modifying the PATH section describes a procedure using prose and code blocks, but it
does not present the procedure as a numbered (ordered) list of steps. This makes the procedure
harder to follow and violates the guide requirement to express procedures as numbered steps.
Code

docs/guides/user/customizing-agents.md[R303-334]

+To modify the agent's `PATH` so it gains access to new executables,
+use the harness' `host_files` key:
+
+```yaml
+host_files:
+  - src: scripts/my-tool.sh
+    dest: /tmp/bin/my-tool.sh
+  - src: env/path-modification.env
+    dest: /sandbox/workspace/.env.d/path-modification.env
+    expand: false  # expand works outside the runner, so we set it to false
+```
+
+The `scripts/my-tool.sh` file:
+
+```bash
+#!/bin/bash
+
+echo "Hello from $0"
+```
+
+And the `env/path-modification.env`:
+
+```bash
+PATH=/tmp/bin:$PATH
+```
+
+The agent execution sources the special file  `/sandbox/workspace/.env` which
+sources all the files under `/sandbox/workspace/.env.d/`, including your
+`path-modification.env` that includes `/tmp/bin/` into the `PATH`.
+
+**Note**: the harness' `env.sandbox` does not work to modify the `PATH` as it
+rejects numerous special variables to avoid the malfunction of the agent.
Relevance

⭐⭐⭐ High

Same doc guide previously updated to numbered procedure steps; suggestion accepted in PR #2663.

PR-#2663

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 1062079 requires procedures in documentation guides to use numbered steps rather
than narrative prose. In docs/guides/user/customizing-agents.md, the added `### Modifying the
PATH` procedure is presented as paragraphs with embedded code blocks, with no ordered list steps.

docs/guides/user/customizing-agents.md[303-334]
Skill: writing-user-docs

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `### Modifying the PATH` section is procedural but written as prose paragraphs instead of a numbered step list.

## Issue Context
This file is a documentation guide under `docs/guides/`, and procedural content in guides must be written as numbered (ordered) steps.

## Fix Focus Areas
- docs/guides/user/customizing-agents.md[303-334]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Upload to /tmp/bin fails 🐞 Bug ≡ Correctness
Description
The new example copies scripts/my-tool.sh to /tmp/bin/my-tool.sh, but the runner only
pre-creates /sandbox/workspace/bin (not /tmp/bin) before copying host_files, so the upload can
fail and the recipe won’t work. The runner already prepends /sandbox/workspace/bin to PATH, so
using that location avoids both the directory-creation and PATH-modification pitfalls.
Code

docs/guides/user/customizing-agents.md[R306-327]

+```yaml
+host_files:
+  - src: scripts/my-tool.sh
+    dest: /tmp/bin/my-tool.sh
+  - src: env/path-modification.env
+    dest: /sandbox/workspace/.env.d/path-modification.env
+    expand: false  # expand works outside the runner, so we set it to false
+```
+
+The `scripts/my-tool.sh` file:
+
+```bash
+#!/bin/bash
+
+echo "Hello from $0"
+```
+
+And the `env/path-modification.env`:
+
+```bash
+PATH=/tmp/bin:$PATH
+```
Relevance

⭐⭐⭐ High

Team accepts doc fixes to match actual runner/bootstrap behavior; emphasis on runnable examples (PR
#1087, #372).

PR-#1087
PR-#372

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The runner only creates /sandbox/workspace/bin and /sandbox/workspace/.env.d during bootstrap,
and UploadFile does not create parent directories. Additionally, PATH is already initialized with
/sandbox/workspace/bin first, making /tmp/bin unnecessary for the “new executable” case.

internal/cli/run.go[1198-1205]
internal/cli/run.go[1421-1427]
internal/sandbox/sandbox.go[454-506]
docs/guides/user/customizing-agents.md[301-334]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The doc example copies an executable to `/tmp/bin`, but the runner does not create `/tmp/bin` before `host_files` upload, so the copy can fail and the example is non-functional.

## Issue Context
The runner creates `/sandbox/workspace/bin` and also prepends it to `PATH` during bootstrap.

## Fix Focus Areas
- docs/guides/user/customizing-agents.md[301-334]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Overbroad env.d sourcing claim 🐞 Bug ⚙ Maintainability
Description
The docs say /sandbox/workspace/.env “sources all the files under /sandbox/workspace/.env.d/”,
but bootstrap only sources files matching *.env. Users who follow the prose and use a different
extension will be silently ignored.
Code

docs/guides/user/customizing-agents.md[R329-331]

+The agent execution sources the special file  `/sandbox/workspace/.env` which
+sources all the files under `/sandbox/workspace/.env.d/`, including your
+`path-modification.env` that includes `/tmp/bin/` into the `PATH`.
Relevance

⭐⭐⭐ High

Bootstrap sources only .env.d/*.env; team often corrects docs to match code paths (PR #2582).

PR-#2582

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The bootstrap shell loop sources only .env.d/*.env, not arbitrary files in .env.d/, so the
documentation should reflect the filename requirement.

internal/cli/run.go[1470-1472]
docs/guides/user/customizing-agents.md[329-331]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The documentation implies all files in `.env.d/` are sourced, but the implementation only sources `*.env` files.

## Issue Context
Bootstrap uses a glob over `.env.d/*.env`.

## Fix Focus Areas
- docs/guides/user/customizing-agents.md[329-331]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment on lines +303 to +334
To modify the agent's `PATH` so it gains access to new executables,
use the harness' `host_files` key:

```yaml
host_files:
- src: scripts/my-tool.sh
dest: /tmp/bin/my-tool.sh
- src: env/path-modification.env
dest: /sandbox/workspace/.env.d/path-modification.env
expand: false # expand works outside the runner, so we set it to false
```

The `scripts/my-tool.sh` file:

```bash
#!/bin/bash

echo "Hello from $0"
```

And the `env/path-modification.env`:

```bash
PATH=/tmp/bin:$PATH
```

The agent execution sources the special file `/sandbox/workspace/.env` which
sources all the files under `/sandbox/workspace/.env.d/`, including your
`path-modification.env` that includes `/tmp/bin/` into the `PATH`.

**Note**: the harness' `env.sandbox` does not work to modify the `PATH` as it
rejects numerous special variables to avoid the malfunction of the agent.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. path procedure lacks numbered steps 📜 Skill insight ✧ Quality

The new ### Modifying the PATH section describes a procedure using prose and code blocks, but it
does not present the procedure as a numbered (ordered) list of steps. This makes the procedure
harder to follow and violates the guide requirement to express procedures as numbered steps.
Agent Prompt
## Issue description
The `### Modifying the PATH` section is procedural but written as prose paragraphs instead of a numbered step list.

## Issue Context
This file is a documentation guide under `docs/guides/`, and procedural content in guides must be written as numbered (ordered) steps.

## Fix Focus Areas
- docs/guides/user/customizing-agents.md[303-334]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +306 to +327
```yaml
host_files:
- src: scripts/my-tool.sh
dest: /tmp/bin/my-tool.sh
- src: env/path-modification.env
dest: /sandbox/workspace/.env.d/path-modification.env
expand: false # expand works outside the runner, so we set it to false
```

The `scripts/my-tool.sh` file:

```bash
#!/bin/bash

echo "Hello from $0"
```

And the `env/path-modification.env`:

```bash
PATH=/tmp/bin:$PATH
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Upload to /tmp/bin fails 🐞 Bug ≡ Correctness

The new example copies scripts/my-tool.sh to /tmp/bin/my-tool.sh, but the runner only
pre-creates /sandbox/workspace/bin (not /tmp/bin) before copying host_files, so the upload can
fail and the recipe won’t work. The runner already prepends /sandbox/workspace/bin to PATH, so
using that location avoids both the directory-creation and PATH-modification pitfalls.
Agent Prompt
## Issue description
The doc example copies an executable to `/tmp/bin`, but the runner does not create `/tmp/bin` before `host_files` upload, so the copy can fail and the example is non-functional.

## Issue Context
The runner creates `/sandbox/workspace/bin` and also prepends it to `PATH` during bootstrap.

## Fix Focus Areas
- docs/guides/user/customizing-agents.md[301-334]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +329 to +331
The agent execution sources the special file `/sandbox/workspace/.env` which
sources all the files under `/sandbox/workspace/.env.d/`, including your
`path-modification.env` that includes `/tmp/bin/` into the `PATH`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

3. Overbroad env.d sourcing claim 🐞 Bug ⚙ Maintainability

The docs say /sandbox/workspace/.env “sources all the files under /sandbox/workspace/.env.d/”,
but bootstrap only sources files matching *.env. Users who follow the prose and use a different
extension will be silently ignored.
Agent Prompt
## Issue description
The documentation implies all files in `.env.d/` are sourced, but the implementation only sources `*.env` files.

## Issue Context
Bootstrap uses a glob over `.env.d/*.env`.

## Fix Focus Areas
- docs/guides/user/customizing-agents.md[329-331]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Medium

  • [technical-accuracy] docs/guides/user/customizing-agents.md:333 — The note states the harness' env.sandbox "rejects numerous special variables to avoid the malfunction of the agent." Per internal/cli/run.go:1395-1397, reserved keys (including PATH) are skipped with a stderr warning (WARNING: env.sandbox key %q is reserved for runner infrastructure; skipping). The word "rejects" is reasonable shorthand, but "numerous special variables" is vague — the actual behavior is a specific reserved-keys list, and the skip emits a visible warning.
    Remediation: Revise to: "Note: the harness' env.sandbox cannot modify the PATH because PATH is a reserved infrastructure variable. Attempts to set PATH via env.sandbox are skipped with a stderr warning."

Labels: Docs-only PR documenting harness host_files and env.sandbox behavior for PATH customization.

@fullsend-ai-review fullsend-ai-review Bot added requires-manual-review Review requires human judgment component/docs User-facing documentation component/harness Agent harness, config, and skills loading labels Jul 2, 2026
@rh-hemartin rh-hemartin self-assigned this Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/docs User-facing documentation component/harness Agent harness, config, and skills loading requires-manual-review Review requires human judgment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a section explaining how to modify the PATH

1 participant