Skip to content

[DRAFT] feat/entrypoint harness - #8202

Closed
jctanner wants to merge 3 commits into
fullsend-ai:mainfrom
jctanner:feat/entrypoint-harness
Closed

jctanner wants to merge 3 commits into
fullsend-ai:mainfrom
jctanner:feat/entrypoint-harness

Conversation

@jctanner

@jctanner jctanner commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Related Issue

Changes

Testing

  • make lint passes (stage changes first, then run)
  • Tests added/updated for new or modified logic

Checklist

  • PR title follows Conventional Commits (correct type, ! for breaking changes)
  • Commits are signed off (DCO) — human and human-directed agent sessions only
  • I wrote this contribution myself and can explain all changes in it

@jctanner
jctanner requested a review from a team October 8, 2026 16:55
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

E2E tests did not run

E2E tests run automatically for org/repo members and collaborators on pull requests.

For other contributors, a maintainer with write access must add the ok-to-test label after the latest push.

See E2E testing guide for details.

@jctanner jctanner changed the title Feat/entrypoint harness [DRAFT] feat/entrypoint harness Oct 8, 2026
@jctanner
jctanner marked this pull request as draft October 8, 2026 16:55
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

feat: add script-led harness entrypoints with Claude integrity checks

✨ Enhancement 🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Add script-led harnesses with validated executable paths, argument expansion, and optional Claude
 stream parsing.
• Bootstrap Claude only when selected, with a child-call helper and runner-held integrity checks.
• Preserve bounded diagnostics on failure and forward unparsed script stdout to callers.
Diagram

graph TD
  A["Harness configuration"] --> B["CLI runner"] --> C{"Runtime selected?"}
  C -->|"No"| D["Sandbox entrypoint"] --> E["Integrity gates"] --> F["Results and diagnostics"]
  C -->|"Claude"| G["Claude bootstrap"] --> D
  D -.->|"Optional child"| G
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Reuse the agent runtime launch path
  • ➕ Less separate run orchestration.
  • ➖ Would conflate script stdout and argv semantics with agent prompts and implicitly provision inference credentials.
2. Use a read-only mount for trusted Claude files
  • ➕ Could prevent some edits rather than detecting them at checkpoints.
  • ➖ Requires a stronger sandbox isolation boundary; a write grant on the parent sandbox path can defeat nested read-only paths.

Recommendation: Keep a distinct script execution path while sharing existing sandbox, scanning, and Claude bootstrap facilities. Runner-held digests are appropriate checkpoint detection, but should not be represented as protection against modifications restored between checks.

Files changed (31) +1762 / -104

Enhancement (10) +913 / -93
bootstrap_input.goMark entrypoint bootstraps as agentless +6/-0

Mark entrypoint bootstraps as agentless

• Passes entrypoint mode to runtimes and clears agent identity when launching a script.

internal/cli/bootstrap_input.go

bootstrap_scan.goScan entrypoint scripts as runtime content +39/-0

Scan entrypoint scripts as runtime content

• Applies the existing injection pipeline to script bytes and shares skill and plugin scanning between launch modes.

internal/cli/bootstrap_scan.go

entrypoint_setup.goStage entrypoint and trusted Claude artifacts +104/-0

Stage entrypoint and trusted Claude artifacts

• Adds sandbox file installation, normalized-event delivery, and runner-derived helper and integrity expectations.

internal/cli/entrypoint_setup.go

run.goOrchestrate script entrypoints and failure recovery +263/-33

Orchestrate script entrypoints and failure recovery

• Selects optional Claude provisioning, resolves and uploads scripts, checks integrity around execution, and preserves bounded diagnostics on failure. Routes script stdout and optional Claude events through iteration artifacts.

internal/cli/run.go

compose.goCompose agent and entrypoint as one launch choice +10/-1

Compose agent and entrypoint as one launch choice

• Makes a child's explicit agent or entrypoint replace the inherited alternative while retaining inheritance when neither is set.

internal/harness/compose.go

harness.goValidate and resolve entrypoint configuration +169/-37

Validate and resolve entrypoint configuration

• Adds strict entrypoint mapping validation, mutually exclusive launch choices, argv environment substitution, and local executable containment checks.

internal/harness/harness.go

claude.goSupport agentless Claude bootstrap and bounded transcripts +41/-17

Support agentless Claude bootstrap and bounded transcripts

• Allows explicit entrypoint-mode bootstrap without an agent definition and adds deadline-aware, file-limited transcript extraction for diagnostics.

internal/runtime/claude.go

entrypoint.goExecute scripts and provide a Claude child helper +107/-0

Execute scripts and provide a Claude child helper

• Launches quoted argv in the sandbox, captures or forwards stdout, optionally parses Claude stream events, and generates a helper with selected model, hooks, and plugins.

internal/runtime/entrypoint.go

entrypoint_integrity.goVerify runner-owned Claude entrypoint files +142/-0

Verify runner-owned Claude entrypoint files

• Records SHA-256 expectations outside the sandbox, checks trusted files and directory contents, and pins effective security environment values for child calls.

internal/runtime/entrypoint_integrity.go

sandbox.goAdd deadline-aware bounded artifact extraction +32/-5

Add deadline-aware bounded artifact extraction

• Adds context-aware download and extraction variants with diagnostic file limits while preserving existing unlimited success-path wrappers.

internal/sandbox/sandbox.go

Bug fix (1) +2 / -2
hooks.goKeep hook wiring with scripts and suppress bytecode +2/-2

Keep hook wiring with scripts and suppress bytecode

• Moves Claude hook settings into the guarded hooks directory and invokes Python hooks with bytecode generation disabled.

internal/security/hooks.go

Tests (16) +769 / -3
bootstrap_input_test.goTest agentless entrypoint bootstrap input +11/-0

Test agentless entrypoint bootstrap input

• Confirms entrypoint bootstrap inputs have no agent name or path and expose entrypoint mode.

internal/cli/bootstrap_input_test.go

bootstrap_scan_test.goCover entrypoint scan outcomes +38/-0

Cover entrypoint scan outcomes

• Tests critical findings, missing paths, read failures, fail-open behavior, and clean scripts.

internal/cli/bootstrap_scan_test.go

entrypoint_run_test.goTest integrity-gated execution and diagnostics +103/-0

Test integrity-gated execution and diagnostics

• Covers pre- and post-check failures, non-replay of nonzero exits, cancellation, and preservation of output and transcripts.

internal/cli/entrypoint_run_test.go

entrypoint_setup_test.goTest entrypoint artifact preparation +94/-0

Test entrypoint artifact preparation

• Verifies helper and hook expectations, installation failures, and event-file configuration.

internal/cli/entrypoint_setup_test.go

lock_all_test.goIsolate lock tests from GitHub token lookup +30/-0

Isolate lock tests from GitHub token lookup

• Neutralizes ambient GitHub authentication and agent-repository fallback in affected lock tests.

internal/cli/lock_all_test.go

lock_test.goStabilize lock command tests +19/-0

Stabilize lock command tests

• Disables ambient GitHub token lookup in lock fixtures that should not depend on local credentials.

internal/cli/lock_test.go

mint_test.goIsolate mint tests from GitHub credentials +9/-0

Isolate mint tests from GitHub credentials

• Neutralizes token lookup in Cloudflare and PEM-related test fixtures.

internal/cli/mint_test.go

prescript_run_test.goMake pre-script fixture credential-independent +1/-0

Make pre-script fixture credential-independent

• Disables GitHub token lookup before exercising the agent-skip run fixture.

internal/cli/prescript_run_test.go

run_openai_test.goStabilize provider-gating test setup +5/-1

Stabilize provider-gating test setup

• Disables ambient token lookup and supplies a small executable fixture to avoid packaging the large test binary.

internal/cli/run_openai_test.go

run_test.goTest entrypoint runtime selection +51/-0

Test entrypoint runtime selection

• Covers explicit runtime configuration, default runtime-free execution, Claude selection, and unsupported runtime rejection.

internal/cli/run_test.go

compose_test.goTest launch-choice replacement and inheritance +19/-0

Test launch-choice replacement and inheritance

• Checks both replacement directions and inheritance from a base harness.

internal/harness/compose_test.go

harness_test.goTest entrypoint schema and file safety +86/-1

Test entrypoint schema and file safety

• Covers invalid launch combinations and parsers, argument substitution, unknown fields, local-path restrictions, symlink escape, and regular-file validation.

internal/harness/harness_test.go

entrypoint_integrity_test.goTest integrity detection and security defaults +150/-0

Test integrity detection and security defaults

• Checks trusted and tampered files, fail-closed runner verification, and helper re-export of effective security settings.

internal/runtime/entrypoint_integrity_test.go

entrypoint_test.goTest script execution and Claude event handling +130/-0

Test script execution and Claude event handling

• Verifies argv boundaries, stdout forwarding and capture, launch failures, helper flags, and Claude stream metrics.

internal/runtime/entrypoint_test.go

sandbox_hooks_bootstrap_test.goExpect relocated Claude hook settings +1/-1

Expect relocated Claude hook settings

• Updates the bootstrap assertion for hooks.json inside the hooks directory.

internal/runtime/sandbox_hooks_bootstrap_test.go

sandbox_test.goTest diagnostic output file limit +22/-0

Test diagnostic output file limit

• Verifies bounded extraction copies the permitted file and reports when the limit is exceeded.

internal/sandbox/sandbox_test.go

Documentation (4) +78 / -6
harness-composition.mdDocument launch-choice inheritance +7/-0

Document launch-choice inheritance

• Explains how agent and entrypoint replace one another across base layers and why forge overlays cannot change the launch choice.

docs/contributing/harness-composition.md

harness-fields.mdClassify entrypoint fields and merge behavior +4/-2

Classify entrypoint fields and merge behavior

• Documents the executable as a local runtime path, arguments as scalar values, and the paired launch-choice merge rules.

docs/contributing/harness-fields.md

runtime-implementation.mdCorrect Claude hook settings location +2/-2

Correct Claude hook settings location

• Updates the documented settings path to its new location inside the hooks directory.

docs/contributing/runtime-implementation.md

harness-reference.mdDescribe script-led harness configuration +65/-2

Describe script-led harness configuration

• Adds entrypoint syntax, inputs, environment expansion, output handling, optional Claude support, integrity limits, and retry behavior.

docs/reference/harness-reference.md

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (6) 📘 Rule violations (2) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Some scripts silently lose their runtime 🐞 Bug ≡ Correctness
Description
runtimeConfigured compares agent names case-sensitively, although backend selection uses a
case-insensitive lookup. When a configured agent name differs only in case from the name used to
launch an entrypoint, the selected runtime is not provisioned; even an otherwise unsupported
configured runtime can pass the entrypoint runtime check.
Code

internal/cli/run.go[R422-423]

+			if entry.DerivedName() == agentName && entry.Runtime != "" {
+				return true
Relevance

●●● Strong

Recent CLI precedents accept runtime-selection mismatches that silently ignore configured runtime
behavior.

PR-#7985
PR-#5428

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new exact-case comparisons disagree with the lookup used to select the backend. Runtime planning
relies on those comparisons to decide whether to provision that backend and whether to reject
unsupported entrypoint runtimes.

internal/cli/run.go[416-440]
internal/config/config.go[72-81]
internal/cli/run.go[274-281]
internal/cli/run.go[473-479]

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

## Issue description
Entrypoint runtime planning can miss a per-agent runtime when the launch name differs in case from the configured name.
## Fix Focus Areas
- internal/cli/run.go[416-444]
## Recommended Fix
Use the same case-insensitive effective-agent lookup as backend selection for both per-repo and organization configuration, and test mixed-case launch names.

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

Dismiss ↗ | View ↗



Remediation recommended

2. Script runs have stale command docs 📘 Rule violation ⚙ Maintainability
Description
runAgent now prints Runtime: none (script entrypoint) when an entrypoint runs without runtime
provisioning, but docs/cli/run.md still describes every run as executing an agent with a selected
runtime. A user following that command reference encounters a plan output and runtime-selection
behavior that its examples do not explain.
Code

internal/cli/run.go[R1311-1312]

+	if entrypointWithoutRuntime {
+		printer.KeyValue("Runtime", "none (script entrypoint)")
Relevance

●●● Strong

Recent documentation precedents accept updating CLI references when behavior or configuration
semantics change.

PR-#7636
PR-#7445
PR-#7510

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires the CLI reference named in the documentation touchpoints to reflect changed
command behavior. The new plan output contradicts the unchanged run reference's universal runtime
description.

Rule 2806787: Update CLI-related docs according to docs/contributing/documentation.md when changing CLI surface
internal/cli/run.go[1311-1315]
docs/contributing/documentation.md[89-96]
docs/cli/run.md[27-53]

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 run command reference does not describe script-led entrypoints or their no-runtime plan output.

## Fix Focus Areas
- docs/cli/run.md[6-53]
- internal/cli/run.go[1311-1315]

## Recommended Fix
Update the command description, runtime-selection explanation, and plan example to cover entrypoints that run without a provisioned runtime.

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

Dismiss ↗ | View ↗


3. Entrypoint runs lack end-to-end checks 📘 Rule violation ▣ Testability
Description
runAgent adds an entrypoint execution path under internal/cli, but the available CI workflow
does not run the required make e2e-test check. The PR description and commit messages also provide
no statement that the check passed locally, leaving this critical-module change without the required
execution evidence.
Code

internal/cli/run.go[R1059-1064]

+	runtimePlan, err := resolveEntrypointRuntimePlan(h.Entrypoint != nil, overrides.runtime, runtimeBackend.Runtime.Name(), agentName, runCfg)
+	if err != nil {
+		return err
+	}
+	runtimeProvisioning := runtimePlan.ProvisionRuntime
+	entrypointWithoutRuntime := runtimePlan.WithoutRuntime
Relevance

●●● Strong

The team recently accepts missing automated coverage or validation evidence for changed critical CLI
paths.

PR-#5615
PR-#7445

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist applies to changes under internal/cli and requires a passing end-to-end check or,
without CI metadata, a documented local pass. The diff changes that path, while the inspected CI
test job runs unit and script tests rather than make e2e-test; the supplied PR text contains no
local-pass statement.

Rule 1062051: Run end-to-end tests for critical internal modules before merge
internal/cli/run.go[1059-1064]
.github/workflows/lint.yml[14-67]

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

## Issue description
Changes under internal/cli require evidence that make e2e-test passed, but the PR provides none.

## Fix Focus Areas
- internal/cli/run.go[1059-1064]
- .github/workflows/lint.yml[14-67]

## Recommended Fix
Run the required end-to-end check and record its passing result for this PR, or add a required CI job that runs it.

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

Dismiss ↗ | View ↗


4. Script runs report the wrong runtime 🐞 Bug ◔ Observability
Description
resolveEntrypointRuntimePlan can disable runtime provisioning, but runAgent continues to
populate metrics and provider identity from the resolved default backend. For an entrypoint with no
selected runtime, its metrics and spans therefore identify a runtime and model provider that did not
execute the script.
Code

internal/cli/run.go[475]

+	plan := entrypointRuntimePlan{ProvisionRuntime: provision, WithoutRuntime: isEntrypoint && !provision}
Relevance

●●● Strong

Telemetry precedent accepts correcting provider identity when runtime and effective execution
provider diverge.

PR-#2752
PR-#7985

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new plan disables provisioning without removing the default backend. Later metrics assignment
and provider derivation still use that backend, despite the entrypoint taking the separate execution
path.

internal/cli/run.go[395-413]
internal/cli/run.go[473-479]
internal/cli/run.go[2091-2108]
internal/cli/run.go[2507-2514]
internal/cli/run.go[2598-2607]

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

## Issue description
Entrypoints without runtime provisioning inherit the default backend's runtime and provider attribution in metrics and spans.
## Fix Focus Areas
- internal/cli/run.go[473-479]
- internal/cli/run.go[2091-2108]
- internal/cli/run.go[2507-2514]
## Recommended Fix
When WithoutRuntime is true, record a script-only runtime identity and omit model-provider attribution rather than using the backend selected for configuration fallback.

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

Dismiss ↗ | View ↗


View medium (4)
5. Timed-out scripts keep running after the run fails 🐞 Bug ☼ Reliability
Description
runEntrypointChecked turns every non-zero exit, including timeout exit 124, into a returned error.
runAgent then takes its runErr != nil branch and returns before iterationTimedOut /
TerminateStrayProcesses run. Because OpenShell has no per-exec kill, a timed-out entrypoint (and
any child Claude calls it started) keeps running and spending inference during the 45s diagnostic
copy and afterwards, and the failure is reported as a generic exit status instead of the timeout
error.
Code

internal/cli/run.go[R3009-3011]

+	if exitCode != 0 {
+		return exitCode, fmt.Errorf("entrypoint exited with status %d", exitCode)
+	}
Relevance

●●● Strong

The finding identifies a concrete timeout cleanup path that bypasses established stray-process
termination behavior.

PR-#5961
PR-#6753

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The agent path treats a non-zero exit as a warning and reaches the timeout branch, which calls
agentruntime.TerminateStrayProcesses because the exec ends at the budget while the processes do not
(#7042). For entrypoints, a non-zero exit becomes runErr, so the if runErr != nil { ... return }
block exits first. preserveEntrypointDiagnostics then copies files while the processes are still
alive.

internal/cli/run.go[2655-2681]
internal/cli/run.go[2718-2735]
internal/cli/run.go[2993-3013]

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

## Issue description
An entrypoint timeout (exit 124) is converted into an error and returned before runAgent terminates stray sandbox processes, so the script and its child Claude calls keep running.

## Fix Focus Areas
- internal/cli/run.go[2993-3013]
- internal/cli/run.go[2655-2681]

## Recommended Fix
In the entrypoint branch, before preserveEntrypointDiagnostics and before returning on runErr, check iterationTimedOut(exitCode, elapsed, timeout) (or ctx cancellation). If it is true, call agentruntime.TerminateStrayProcesses under withSandboxLock, then return the timeout error (the runTerminalError timeout message) instead of the generic "exited with status" message.

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

Dismiss ↗ | View ↗


6. Script output reaches logs unfiltered 🐞 Bug ⛨ Security
Description
RunEntrypoint copies stream_format: none stdout directly to os.Stdout while also saving it as
an artifact. If a script prints a secret or terminal or workflow-control sequence, those bytes reach
the caller before the later output security scan can inspect the artifact.
Code

internal/runtime/entrypoint.go[R94-96]

+	} else if _, err = io.Copy(io.MultiWriter(out, os.Stdout), stdout); err != nil {
+		cancel()
+		return -1, fmt.Errorf("reading entrypoint output: %w", err)
Relevance

●● Moderate

Output sanitization is a recognized security priority, but raw none-format forwarding may be
intentional documented behavior.

PR-#3186
PR-#764

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new writer emits raw script bytes immediately. The output scan runs only after execution, while
the existing renderer sanitizes text before printing it; scanning the saved file cannot retract
bytes already emitted.

internal/runtime/entrypoint.go[68-96]
internal/cli/run.go[2921-2930]
internal/runtime/sanitize.go[8-45]
internal/runtime/renderer.go[35-59]

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

## Issue description
Script stdout is forwarded before Fullsend's output scanning and without the control-sequence sanitization used for rendered agent output.
## Fix Focus Areas
- internal/runtime/entrypoint.go[84-96]
- internal/cli/run.go[2921-2930]
## Recommended Fix
Route console output through appropriate control-sequence sanitization and secret protection before emission, while retaining the required output artifact.

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

Dismiss ↗ | View ↗


7. Remote harness entrypoints run a local script 🐞 Bug ≡ Correctness
Description
ResolveRelativeTo resolves entrypoint.command[0] against the local .fullsend directory. No
URL-composition resolver (resolveBaseScripts, resolveBaseResources) handles the entrypoint the
way it handles pre_script, post_script and agent. When a harness or base layer is fetched from
a URL, its relative entrypoint is therefore either missing locally (the run fails) or silently runs
whatever local file shares that relative path, not the script the remote harness author shipped.
Code

internal/harness/harness.go[R756-766]

+	if h.Entrypoint != nil && len(h.Entrypoint.Command) > 0 {
+		path := h.Entrypoint.Command[0]
+		if filepath.IsAbs(path) || IsURL(path) || strings.Contains(path, "${") {
+			return fmt.Errorf("entrypoint.command[0] must be a literal relative local path")
+		}
+		resolved, resolveErr := resolve("entrypoint.command[0]", path)
+		if resolveErr != nil {
+			return resolveErr
+		}
+		h.Entrypoint.Command[0] = resolved
+		h.entrypointRoot = filepath.Clean(baseDir)
Relevance

●● Moderate

The repository accepts path-resolution defects, but entrypoints are explicitly documented as
local-only and remote semantics are uncertain.

PR-#7061
PR-#2807

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
For URL-sourced harnesses and bases, LoadWithBase calls resolveBaseScripts and resolveBaseResources
so that relative pre/post scripts and the agent are fetched from the source URL. resolveBaseScripts
lists only pre_script and post_script, and compose.go never references Entrypoint except in
mergeBaseIntoChild. run.go later calls ResolveRelativeTo(absFullsendDir), which joins the
still-relative command[0] onto the local directory. Even if a resolver did fetch the script, the new
code rejects absolute (cache) paths, so the entrypoint can never point at the fetched copy.

internal/harness/compose.go[875-895]
internal/harness/compose.go[226-270]
internal/harness/compose.go[680-691]
internal/cli/run.go[799-800]

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

## Issue description
When a harness or base is loaded from a URL (ComposeOpts.SourceURL or a URL base), entrypoint.command[0] is never resolved against the source URL. It is later resolved against the local .fullsend directory, so a different local script runs, or the run fails.

## Fix Focus Areas
- internal/harness/harness.go[756-766]
- internal/harness/compose.go[226-270]
- internal/harness/compose.go[875-895]

## Recommended Fix
Track where the entrypoint came from. If the harness or any base that supplies the entrypoint was URL-sourced, return an explicit error during LoadWithBase (e.g. "entrypoint is not supported in URL-sourced harnesses"). Alternatively, fetch the script through the same pinned/allowlisted path used for pre_script, and allow a fullsend cache path in ResolveRelativeTo and ValidateFilesExist. Add a test for both a URL child and a URL base.

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

Dismiss ↗ | View ↗


8. A planted binary can disable child Claude hooks undetected 🐞 Bug ⛨ Security
Description
The fullsend-claude helper ends with exec claude ..., and the hooks run as python3 -B ....
Both commands are looked up on the PATH inherited from the sourced workspace .env, and that
PATH puts the agent-writable /sandbox/workspace/bin first. The integrity set only pins exact
files plus the .fullsend-entrypoint and hooks directories. So a claude or python3 shim that a
child Claude run drops into /sandbox/workspace/bin stays in place, and every later child launch
runs without hooks or settings while every pre-launch and runner checkpoint still passes.
Code

internal/runtime/entrypoint.go[R47-51]

+	for _, key := range securityKeys {
+		lines = append(lines, "export "+key+"="+shellQuote(securityEnv[key]))
+	}
+	lines = append(lines, "exec claude "+strings.Join(quoted, " ")+" \"$@\"")
+	return []byte(strings.Join(lines, "\n") + "\n")
Relevance

●● Moderate

Security hardening findings are often accepted, but this requires architectural agreement on PATH
pinning and checkpoint guarantees.

PR-#1780
PR-#7819

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
bootstrapEnv writes export PATH=/sandbox/workspace/bin:...:$PATH into .env. RunEntrypoint sources
.env before exec'ing the script. The helper is installed at /sandbox/workspace/bin/fullsend-claude,
and that directory is not in exactDirs (only .fullsend-entrypoint and the hooks dir are). The
helper resolves claude through PATH. GenerateHooksConfig emits python3 -B <hook>, which is also
resolved through PATH. The codex runtime pins its binary before sourcing .env for exactly this
reason (codexBinaryPin). The docs claim the checks catch tampering that is present at a check, but
this kind persists without being detected.

internal/cli/run.go[3519-3524]
internal/runtime/entrypoint.go[68-69]
internal/cli/entrypoint_setup.go[13-14]
internal/cli/entrypoint_setup.go[75-92]
internal/security/hooks.go[194-199]
internal/runtime/codex_run.go[289-305]

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 Claude entrypoint helper execs `claude` through an attacker-influenced PATH whose first entry is the writable /sandbox/workspace/bin. Hook commands invoke `python3` the same way. A shim planted there survives every integrity checkpoint.

## Fix Focus Areas
- internal/runtime/entrypoint.go[19-52]
- internal/cli/entrypoint_setup.go[70-104]
- internal/cli/run.go[2226-2249]

## Recommended Fix
Resolve the absolute claude binary path on the runner side, before the entrypoint runs (the way codexBinaryPin does), and embed it in the helper as `exec '/abs/path/claude' ...`. In the helper, also re-export a fixed PATH that does not start with /sandbox/workspace/bin (e.g. `export PATH=/usr/local/bin:/usr/bin:/bin`) before exec, so hooks resolve the system python3. Alternatively, add /sandbox/workspace/bin to the exact-directory set with its expected entries, so new shims fail the check.

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

Dismiss ↗ | View ↗


Grey Divider

Context sources
✅ Compliance rules (platform): 89 rules
✅ Skills: 5 invoked
  writing-user-docs
  writing-adrs
  check-patch-coverage
  cutting-releases
  adr-corner
✅ Cross-repo context — repo relationships
  Explored: repo: fullsend-ai/.fullsend (sha: 7c163cad) — View relationship
  Explored: repo: fullsend-ai/agents (sha: f3dd8897) — View relationship
  Explored: repo: fullsend-ai/mlflow-assessments (sha: 2fdb0120) — View relationship
Review mode: Auto: 🧠 Deep: Broad security-sensitive feature spans many independent runtime, CLI, sandbox, and configuration paths.

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Findings visible per group, which tucks the rest behind a View link

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread internal/cli/run.go
Comment on lines +1311 to +1312
if entrypointWithoutRuntime {
printer.KeyValue("Runtime", "none (script entrypoint)")

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

2. Script runs have stale command docs 📘 Rule violation ⚙ Maintainability

runAgent now prints Runtime: none (script entrypoint) when an entrypoint runs without runtime
provisioning, but docs/cli/run.md still describes every run as executing an agent with a selected
runtime. A user following that command reference encounters a plan output and runtime-selection
behavior that its examples do not explain.
Agent Prompt
## Issue description
The run command reference does not describe script-led entrypoints or their no-runtime plan output.

## Fix Focus Areas
- docs/cli/run.md[6-53]
- internal/cli/run.go[1311-1315]

## Recommended Fix
Update the command description, runtime-selection explanation, and plan example to cover entrypoints that run without a provisioned runtime.

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

Dismiss ↗ | View ↗

Comment thread internal/cli/run.go
Comment on lines +1059 to +1064
runtimePlan, err := resolveEntrypointRuntimePlan(h.Entrypoint != nil, overrides.runtime, runtimeBackend.Runtime.Name(), agentName, runCfg)
if err != nil {
return err
}
runtimeProvisioning := runtimePlan.ProvisionRuntime
entrypointWithoutRuntime := runtimePlan.WithoutRuntime

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. Entrypoint runs lack end-to-end checks 📘 Rule violation ▣ Testability

runAgent adds an entrypoint execution path under internal/cli, but the available CI workflow
does not run the required make e2e-test check. The PR description and commit messages also provide
no statement that the check passed locally, leaving this critical-module change without the required
execution evidence.
Agent Prompt
## Issue description
Changes under internal/cli require evidence that make e2e-test passed, but the PR provides none.

## Fix Focus Areas
- internal/cli/run.go[1059-1064]
- .github/workflows/lint.yml[14-67]

## Recommended Fix
Run the required end-to-end check and record its passing result for this PR, or add a required CI job that runs it.

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

Dismiss ↗ | View ↗

Comment thread internal/cli/run.go
Comment on lines +422 to +423
if entry.DerivedName() == agentName && entry.Runtime != "" {
return true

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. Some scripts silently lose their runtime 🐞 Bug ≡ Correctness

runtimeConfigured compares agent names case-sensitively, although backend selection uses a
case-insensitive lookup. When a configured agent name differs only in case from the name used to
launch an entrypoint, the selected runtime is not provisioned; even an otherwise unsupported
configured runtime can pass the entrypoint runtime check.
Agent Prompt
## Issue description
Entrypoint runtime planning can miss a per-agent runtime when the launch name differs in case from the configured name.
## Fix Focus Areas
- internal/cli/run.go[416-444]
## Recommended Fix
Use the same case-insensitive effective-agent lookup as backend selection for both per-repo and organization configuration, and test mixed-case launch names.

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

Dismiss ↗ | View ↗

Comment on lines +94 to +96
} else if _, err = io.Copy(io.MultiWriter(out, os.Stdout), stdout); err != nil {
cancel()
return -1, fmt.Errorf("reading entrypoint output: %w", err)

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

6. Script output reaches logs unfiltered 🐞 Bug ⛨ Security

RunEntrypoint copies stream_format: none stdout directly to os.Stdout while also saving it as
an artifact. If a script prints a secret or terminal or workflow-control sequence, those bytes reach
the caller before the later output security scan can inspect the artifact.
Agent Prompt
## Issue description
Script stdout is forwarded before Fullsend's output scanning and without the control-sequence sanitization used for rendered agent output.
## Fix Focus Areas
- internal/runtime/entrypoint.go[84-96]
- internal/cli/run.go[2921-2930]
## Recommended Fix
Route console output through appropriate control-sequence sanitization and secret protection before emission, while retaining the required output artifact.

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

Dismiss ↗ | View ↗

Comment thread internal/cli/run.go

func resolveEntrypointRuntimePlan(isEntrypoint bool, runtimeOverride, runtimeName, agentName string, cfg runConfig) (entrypointRuntimePlan, error) {
provision := !isEntrypoint || runtimeOverride != "" || cfg.runtimeConfigured(agentName)
plan := entrypointRuntimePlan{ProvisionRuntime: provision, WithoutRuntime: isEntrypoint && !provision}

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

4. Script runs report the wrong runtime 🐞 Bug ◔ Observability

resolveEntrypointRuntimePlan can disable runtime provisioning, but runAgent continues to
populate metrics and provider identity from the resolved default backend. For an entrypoint with no
selected runtime, its metrics and spans therefore identify a runtime and model provider that did not
execute the script.
Agent Prompt
## Issue description
Entrypoints without runtime provisioning inherit the default backend's runtime and provider attribution in metrics and spans.
## Fix Focus Areas
- internal/cli/run.go[473-479]
- internal/cli/run.go[2091-2108]
- internal/cli/run.go[2507-2514]
## Recommended Fix
When WithoutRuntime is true, record a script-only runtime identity and omit model-provider attribution rather than using the backend selected for configuration fallback.

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

Dismiss ↗ | View ↗

Comment on lines +756 to +766
if h.Entrypoint != nil && len(h.Entrypoint.Command) > 0 {
path := h.Entrypoint.Command[0]
if filepath.IsAbs(path) || IsURL(path) || strings.Contains(path, "${") {
return fmt.Errorf("entrypoint.command[0] must be a literal relative local path")
}
resolved, resolveErr := resolve("entrypoint.command[0]", path)
if resolveErr != nil {
return resolveErr
}
h.Entrypoint.Command[0] = resolved
h.entrypointRoot = filepath.Clean(baseDir)

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

7. Remote harness entrypoints run a local script 🐞 Bug ≡ Correctness

ResolveRelativeTo resolves entrypoint.command[0] against the local .fullsend directory. No
URL-composition resolver (resolveBaseScripts, resolveBaseResources) handles the entrypoint the
way it handles pre_script, post_script and agent. When a harness or base layer is fetched from
a URL, its relative entrypoint is therefore either missing locally (the run fails) or silently runs
whatever local file shares that relative path, not the script the remote harness author shipped.
Agent Prompt
## Issue description
When a harness or base is loaded from a URL (ComposeOpts.SourceURL or a URL base), entrypoint.command[0] is never resolved against the source URL. It is later resolved against the local .fullsend directory, so a different local script runs, or the run fails.

## Fix Focus Areas
- internal/harness/harness.go[756-766]
- internal/harness/compose.go[226-270]
- internal/harness/compose.go[875-895]

## Recommended Fix
Track where the entrypoint came from. If the harness or any base that supplies the entrypoint was URL-sourced, return an explicit error during LoadWithBase (e.g. "entrypoint is not supported in URL-sourced harnesses"). Alternatively, fetch the script through the same pinned/allowlisted path used for pre_script, and allow a fullsend cache path in ResolveRelativeTo and ValidateFilesExist. Add a test for both a URL child and a URL base.

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

Dismiss ↗ | View ↗

Comment on lines +47 to +51
for _, key := range securityKeys {
lines = append(lines, "export "+key+"="+shellQuote(securityEnv[key]))
}
lines = append(lines, "exec claude "+strings.Join(quoted, " ")+" \"$@\"")
return []byte(strings.Join(lines, "\n") + "\n")

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

8. A planted binary can disable child claude hooks undetected 🐞 Bug ⛨ Security

The fullsend-claude helper ends with exec claude ..., and the hooks run as python3 -B ....
Both commands are looked up on the PATH inherited from the sourced workspace .env, and that
PATH puts the agent-writable /sandbox/workspace/bin first. The integrity set only pins exact
files plus the .fullsend-entrypoint and hooks directories. So a claude or python3 shim that a
child Claude run drops into /sandbox/workspace/bin stays in place, and every later child launch
runs without hooks or settings while every pre-launch and runner checkpoint still passes.
Agent Prompt
## Issue description
The Claude entrypoint helper execs `claude` through an attacker-influenced PATH whose first entry is the writable /sandbox/workspace/bin. Hook commands invoke `python3` the same way. A shim planted there survives every integrity checkpoint.

## Fix Focus Areas
- internal/runtime/entrypoint.go[19-52]
- internal/cli/entrypoint_setup.go[70-104]
- internal/cli/run.go[2226-2249]

## Recommended Fix
Resolve the absolute claude binary path on the runner side, before the entrypoint runs (the way codexBinaryPin does), and embed it in the helper as `exec '/abs/path/claude' ...`. In the helper, also re-export a fixed PATH that does not start with /sandbox/workspace/bin (e.g. `export PATH=/usr/local/bin:/usr/bin:/bin`) before exec, so hooks resolve the system python3. Alternatively, add /sandbox/workspace/bin to the exact-directory set with its expected entries, so new shims fail the check.

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

Dismiss ↗ | View ↗

Comment thread internal/cli/run.go
Comment on lines +3009 to +3011
if exitCode != 0 {
return exitCode, fmt.Errorf("entrypoint exited with status %d", exitCode)
}

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

5. Timed-out scripts keep running after the run fails 🐞 Bug ☼ Reliability

runEntrypointChecked turns every non-zero exit, including timeout exit 124, into a returned error.
runAgent then takes its runErr != nil branch and returns before iterationTimedOut /
TerminateStrayProcesses run. Because OpenShell has no per-exec kill, a timed-out entrypoint (and
any child Claude calls it started) keeps running and spending inference during the 45s diagnostic
copy and afterwards, and the failure is reported as a generic exit status instead of the timeout
error.
Agent Prompt
## Issue description
An entrypoint timeout (exit 124) is converted into an error and returned before runAgent terminates stray sandbox processes, so the script and its child Claude calls keep running.

## Fix Focus Areas
- internal/cli/run.go[2993-3013]
- internal/cli/run.go[2655-2681]

## Recommended Fix
In the entrypoint branch, before preserveEntrypointDiagnostics and before returning on runErr, check iterationTimedOut(exitCode, elapsed, timeout) (or ctx cancellation). If it is true, call agentruntime.TerminateStrayProcesses under withSandboxLock, then return the timeout error (the runTerminalError timeout message) instead of the generic "exited with status" message.

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

Dismiss ↗ | View ↗

@jctanner

jctanner commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Closing this stale draft — it has been untouched since early October and the work has been overtaken by events. I'll reopen a fresh PR with a proper description if/when the entrypoint-harness work resumes.

@jctanner jctanner closed this Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant