feat(#839): inject pre-script outputs into sandbox environment - #870
feat(#839): inject pre-script outputs into sandbox environment#870fullsend-ai-coder[bot] wants to merge 2 commits into
Conversation
Add prescript.SandboxEnv() to extract non-reserved key=value outputs from pre-script results (excluding protocol keys skipped/reason). In runAgent, merge these outputs into h.Env.Sandbox after the skip check and before sandbox creation, so buildSandboxEnvLines picks them up naturally. Pre-script outputs override static env.sandbox entries on key collision — runtime-computed values take precedence over static config. Update normative prescript-output/v1 doc with sandbox injection semantics and ADR 0055 with a cross-reference. Note: pre-commit could not run in sandbox (network error fetching hook repos). The post-script runs pre-commit authoritatively. Closes #839
|
🤖 Finished Review · ✅ Success · Started 9:45 AM UTC · Completed 10:01 AM UTC |
ReviewFindingsHigh
Medium
Low
Next steps:
Previous runReviewFindingsMedium
Low
Labels: PR modifies sandbox environment injection in internal/cli and internal/prescript |
|
/fs-fix |
|
🤖 Finished Fix · ✅ Success · Started 10:32 AM UTC · Completed 10:42 AM UTC |
- Update ADR 0055 Precedence section to document three-way sandbox env hierarchy: pre-script outputs > static env.sandbox > host_files .env - Add defense-in-depth filtering of reservedSandboxKeys in the pre-script sandbox injection path, preventing reserved keys from reaching h.Env.Sandbox even if future code bypasses buildSandboxEnvLines - Change StepDone message from "injected" to "merged" to accurately reflect that some outputs (hyphenated, reserved) may be filtered downstream - Rename step comment "4-post" to "4a" and existing "4a" to "4b" to align with the established numbering convention in runAgent Addresses review feedback on #870
🔧 Fix agent — iteration 1 (human-triggered)Addressed all 4 review findings: updated ADR 0055 Precedence section for three-way hierarchy, changed misleading log message wording, added defense-in-depth filtering of reserved sandbox keys at the call site, and fixed step comment numbering convention. Fixed (4):
Tests: passedNext steps:
|
|
🤖 Finished Review · ✅ Success · Started 10:44 AM UTC · Completed 11:01 AM UTC |
| executing pre/post scripts and the validation loop — identical to current | ||
| `runner_env` behavior. | ||
|
|
||
| Pre-script outputs (non-reserved keys written to `$FULLSEND_PRESCRIPT_OUTPUT`) |
There was a problem hiding this comment.
[medium] adr-immutability-violation
ADR 0055 has status Accepted on main. This PR replaces the Precedence subsection — changing a two-source model to a three-source model. Per docs/contributing/adrs.md, substantial rewrites to Context, Decision, or Consequences of Accepted ADRs are not permitted.
Suggested fix: Write a new ADR that amends 0055 to introduce the pre-script output precedence tier. ADR 0055 may receive a cross-reference annotation.
|
This pull request has been automatically marked as stale because it has not had any activity in the last month. It will be closed in 2 weeks if no further activity occurs. Remove the |
Summary
Adds pre-script to sandbox data flow: non-reserved key=value outputs written to
$FULLSEND_PRESCRIPT_OUTPUTare now injected as sandbox environment variables before the agent starts. This enables pre-scripts to pass computed values (resolved URLs, API tokens, feature flags) into the sandbox without requiring the harness to declare them statically inenv.sandbox.Related Issue
Closes #839
Changes
prescript.SandboxEnv()function that filters pre-script outputs, excluding reserved protocol keys (skipped,reason)runAgent(step 4-post), merge pre-script sandbox outputs intoh.Env.Sandboxafter the skip check and before sandbox creation —buildSandboxEnvLinesinbootstrapEnvpicks them up naturallyenv.sandboxentries on key collision (runtime-computed values take precedence over static config)buildSandboxEnvLinessince they are not valid POSIX env var namesprescript-output/v1doc to describe sandbox injection semanticsTesting
SandboxEnv(nil/empty/reserved-only/mixed outputs/hyphenated keys)runPreScript→SandboxEnv→buildSandboxEnvLinesenv.sandboxentriesSandboxEnvbut filtered bybuildSandboxEnvLinesrunAgentproving outputs reach sandbox creationgo test ./internal/prescript/... -racepassesgo test ./internal/cli/... -racepasses (targeted tests)go build ./...succeedsgo vetcleanChecklist
!for breaking changes)Closes #839
Post-script verification
agent/839-prescript-sandbox-flow)c887fc47c59d8b87b5282ca44044d2933d30df41..HEAD)