Repository navigation
fix(#8577): run pi hook scripts with the python3 pinned before .env - #8589
Conversation
|
🤖 Finished Review · ✅ Success · Started 9:35 PM UTC · Completed 9:44 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.55 |
Site previewPreview: https://00dc6a6a-site.fullsend-ai.workers.dev Commit: |
|
<!-- fullsend:risk-assessment --> DetailsCompact 6-file security hardening PR by a bot with 50% test coverage and aligned issue scope, evaluated at moderate risk due to active runtime churn and modifying existing behavior without a feature flag. Previous run<!-- fullsend:risk-assessment --> DetailsCompact 6-file security hardening PR by a bot with 50% test coverage and aligned issue scope, evaluated at moderate risk due to active runtime churn and modifying existing behavior without a feature flag. Previous run (2)<!-- fullsend:risk-assessment --> DetailsCompact 6-file security hardening PR by a bot with 50% test coverage and aligned issue scope, evaluated at moderate risk due to active runtime churn and modifying existing behavior without a feature flag. Previous run (3)<!-- fullsend:risk-assessment --> DetailsCompact 6-file security hardening PR by a bot with 50% test coverage and clear issue alignment, yielding moderate risk due to active runtime history and modifying existing behavior without a feature flag. |
|
Looks good to me Previous run<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJhcHByb3ZlIiwiZmluZGluZ3MiOlt7InNldmVyaXR5IjoibG93IiwiY2F0ZWdvcnkiOiJkb2Mtc3R5bGUiLCJmaWxlIjoiaW50ZXJuYWwvcnVudGltZS9waV9ydW5fdGVzdC5nbyIsImlkIjoiZl9lNjQwZTcxM2ZiMDZjMWY2IiwibGluZSI6MzY3LCJhY3Rpb25hYmxlIjp0cnVlfSx7InNldmVyaXR5IjoibG93IiwiY2F0ZWdvcnkiOiJkb2Mtc3R5bGUiLCJmaWxlIjoiaW50ZXJuYWwvcnVudGltZS9waV9ydW5fdGVzdC5nbyIsImlkIjoiZl81MjljMmFlZmI1NDU1YWMwIiwibGluZSI6Mzg2LCJhY3Rpb25hYmxlIjpmYWxzZX1dLCJkaXNwb3NpdGlvbnMiOlt7ImlkIjoiZl9lNjQwZTcxM2ZiMDZjMWY2Iiwic3RhdHVzIjoicmVzb2x2ZWRfYnlfY2hhbmdlIn0seyJpZCI6ImZfNTI5YzJhZWZiNTQ1NWFjMCIsInN0YXR1cyI6InJlc29sdmVkX2J5X2NoYW5nZSJ9XX0= --> Looks good to me Previous run (2)<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJhcHByb3ZlIiwiZmluZGluZ3MiOlt7InNldmVyaXR5IjoibG93IiwiY2F0ZWdvcnkiOiJkb2Mtc3R5bGUiLCJmaWxlIjoiaW50ZXJuYWwvcnVudGltZS9waV9ydW5fdGVzdC5nbyIsImlkIjoiZl9lNjQwZTcxM2ZiMDZjMWY2IiwibGluZSI6MzY3LCJhY3Rpb25hYmxlIjp0cnVlfSx7InNldmVyaXR5IjoibG93IiwiY2F0ZWdvcnkiOiJkb2Mtc3R5bGUiLCJmaWxlIjoiaW50ZXJuYWwvcnVudGltZS9waV9ydW5fdGVzdC5nbyIsImlkIjoiZl81MjljMmFlZmI1NDU1YWMwIiwibGluZSI6Mzg2LCJhY3Rpb25hYmxlIjpmYWxzZX1dLCJkaXNwb3NpdGlvbnMiOlt7ImlkIjoiZl9lNjQwZTcxM2ZiMDZjMWY2Iiwic3RhdHVzIjoicmVzb2x2ZWRfYnlfY2hhbmdlIn0seyJpZCI6ImZfNTI5YzJhZWZiNTQ1NWFjMCIsInN0YXR1cyI6InJlc29sdmVkX2J5X2NoYW5nZSJ9XX0= --> Looks good to me Earlier findings
Previous run (3)<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJsb3ciLCJjYXRlZ29yeSI6ImRvYy1zdHlsZSIsImZpbGUiOiJpbnRlcm5hbC9ydW50aW1lL3BpX3J1bl90ZXN0LmdvIiwiaWQiOiJmX2U2NDBlNzEzZmIwNmMxZjYiLCJsaW5lIjozNjcsImFjdGlvbmFibGUiOnRydWV9LHsic2V2ZXJpdHkiOiJsb3ciLCJjYXRlZ29yeSI6ImRvYy1zdHlsZSIsImZpbGUiOiJpbnRlcm5hbC9ydW50aW1lL3BpX3J1bl90ZXN0LmdvIiwiaWQiOiJmXzUyOWMyYWVmYjU0NTVhYzAiLCJsaW5lIjozODYsImFjdGlvbmFibGUiOmZhbHNlfV19 --> ReviewFindingsLow
Next steps:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
🤖 Finished Fix · ✅ Success · Started 9:46 PM UTC · Completed 9:52 PM UTC Commit: Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.32 |
Move the TestBuildPiRunCommand_ManifestGuard doc comment back above its function, and give TestBuildPiRunCommand_HookPythonPinned and TestPiHookPythonExport_IgnoresEnv doc comments that start with their names. Note: pre-commit could not fetch hook repositories (TLS verification failure in the sandbox); gofmt and go vet were run directly instead. go test ./internal/runtime fails only TestBuildRunCommand_ClaudeMissingExits127, which also fails without this change (a claude binary exists on the sandbox PATH). Addresses #8589 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
🔧 Fix agent — iteration 1 (bot-triggered)Addressed both low-severity doc-comment findings in pi_run_test.go (comment-only change). pre-commit could not fetch hooks in the sandbox (TLS error), so gofmt and go vet were run directly. go test for internal/runtime passes except TestBuildRunCommand_ClaudeMissingExits127, which fails identically without this change because a claude binary is on the sandbox PATH. Fixed (2):
Tests: passed CI inspections (7):
Conflict update: skipped; strategy
|
|
🤖 Finished Review · ✅ Success · Started 9:54 PM UTC · Completed 9:58 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.92 |
Superseded by updated review
|
/fs-fix-stop |
|
Fix agent disabled for this PR. Remove the |
Move the TestBuildPiRunCommand_ManifestGuard doc comment back above its function, and give TestBuildPiRunCommand_HookPythonPinned and TestPiHookPythonExport_IgnoresEnv doc comments that start with their names. Note: pre-commit could not fetch hook repositories (TLS verification failure in the sandbox); gofmt and go vet were run directly instead. go test ./internal/runtime fails only TestBuildRunCommand_ClaudeMissingExits127, which also fails without this change (a claude binary exists on the sandbox PATH). Addresses #8589 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
47c18f0 to
61d4229
Compare
|
🤖 Finished Review · ✅ Success · Started 9:46 AM UTC · Completed 9:57 AM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.84 |
Superseded by updated review
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20), extended by fullsend-ai#8589 (pi) and fullsend-ai#8633 (CLI binary pinning). Hook scripts resolve their interpreter and PATH only from directories the agent cannot write. Restructured per review feedback: Decision states the rules a safe hook setup must follow (trusted location, hooks see only trusted locations, one resolver, protected to the point of use, no hook no tool call, every runtime, no untrusted fallback, nothing protectable means fail closed), with a per-runtime conformance table. Factual corrections: the shared resolver is hookPreflightInterpreter, the Claude PATH is baked into hooks.json at Bootstrap (not exported at launch), Codex hook children use FULLSEND_TRUSTED_PATH (not FULLSEND_CODEX_PATH), and pi is included (same treatment in fullsend-ai#8589, pinned python3 not Node). Signed-off-by: James Tanner <jtanner@redhat.com>
Renumber the ADR 0150 -> 0152 (0146-0151 are claimed by open PRs fullsend-ai#8679, fullsend-ai#8694, fullsend-ai#8698, fullsend-ai#8702; fullsend-ai#8702 was filed first for 0150). Per waynesun09's reviews (first round 14:56, second round 18:29): - restructure the Decision as rules 1-10 with the conformance table separated out (moved to docs/contributing/runtime-implementation.md so it can track the implementation as the code changes, linked from Consequences) - add the Options section back per the ADR template (fail-open with warning, per-runtime resolvers, version-floor acceptance, hash-verification as primary mechanism — each rejected) - add rules 9 (executables, not just directories) and 10 (scope: settings sources fullsend-ai#8637, hooks.json integrity fullsend-ai#8261, plugin trust ADR 0094) - gaps against the rules are tracked in issues, not the ADR: fullsend-ai#8763 (per-file trust for every executable a hook runs) and fullsend-ai#8764 (paths that let a tool call through without a hook verdict), both filed by the reviewer; rule 8's root-launch exception stays as a one-sentence stated limit - fix the pre-fullsend-ai#8605 Codex wording: the PATH was restored for itself and its hook adapter's children - fix the architecture.md sentence to state the decision for all runtimes, not Codex only - factual corrections from the first round: the shared resolver is hookPreflightInterpreter; the boundary value is FULLSEND_TRUSTED_PATH; the pre-fullsend-ai#8605 gap was image-PATH agent-writable dirs; pi included (same treatment in fullsend-ai#8589, pinned python3 not Node) Per the dual-model review round (GLM 5.3 + DeepSeek V4.1 Flash): - breaking change names the runtimes (pi has no version preflight) - forge scope before Consequences, full forge list Signed-off-by: James Tanner <jtanner@redhat.com>
Renumber the ADR 0150 -> 0152 (0146-0151 are claimed by open PRs fullsend-ai#8679, fullsend-ai#8694, fullsend-ai#8698, fullsend-ai#8702; fullsend-ai#8702 was filed first for 0150). Per waynesun09's reviews (first round 14:56, second round 18:29): - restructure the Decision as rules 1-10 with the conformance table separated out (moved to docs/contributing/runtime-implementation.md so it can track the implementation as the code changes, linked from Consequences) - add the Options section back per the ADR template - add rules 9 (executables, not just directories) and 10 (scope) - gaps tracked in issues only: fullsend-ai#8763 and fullsend-ai#8764 linked bare, no implementation-state prose in the ADR - fold the root-launch case into rule 8 as an explicit scope precondition (accurate wording: the PATH still drops relative, empty, and missing entries as root; it cannot exclude agent-writable directories) instead of a contradictory Consequences 'limit' - cite the pre-fullsend-ai#8605 Codex behavior at the correct SHA (bbe0ab2^1 = 191d723), not unqualified line numbers - state the OpenCode exclusion in rule 6 and the conformance table (no ADR 0090 hook wiring until unbound-force#515) - fix the fullsend-ai#8589 chronology (merged earlier the same day as fullsend-ai#8605, not an extension after it) - fix the Options wording on hash verification (detects a substitution only at the next check; the ADR 0094 preflight detects at check time, not 'after the fact') - reference PR fullsend-ai#8261 explicitly as a PR - fix the architecture.md sentence to state the decision for all runtimes, not Codex only - factual corrections from the first round: the shared resolver is hookPreflightInterpreter; the boundary value is FULLSEND_TRUSTED_PATH; the pre-fullsend-ai#8605 gap was image-PATH agent-writable dirs; pi included (same treatment in fullsend-ai#8589, pinned python3 not Node) - update the conformance table Codex row to the post-fullsend-ai#8633 mechanism (envDataTrustedPin within codexBinaryPin) with the bbe0ab2 state noted Per the dual-model review round (GLM 5.3 + DeepSeek V4.1 Flash): - breaking change names the runtimes (pi has no version preflight) - forge scope before Consequences, full forge list Signed-off-by: James Tanner <jtanner@redhat.com>
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20, merge commit bbe0ab2), with PR fullsend-ai#8589 (pi, merged earlier the same day) and extended by PR fullsend-ai#8633 (CLI binary pinning, issue fullsend-ai#8626): hook interpreters and hook PATH resolve only from directories the agent cannot write; hook settings are runner-held; startup is fail-closed on all runtimes carrying sandbox tool hooks. Decision stated as rules 1-10 with a per-runtime conformance table in docs/contributing/runtime-implementation.md (linked from Consequences so it tracks the implementation as code changes). Gaps against the rules are tracked in issues fullsend-ai#8763 and fullsend-ai#8764, both filed by the reviewer. The root-launch case is folded into rule 8 as an explicit scope precondition. OpenCode is excluded (no ADR 0090 hook wiring until unbound-force#515). Cross-references updated in the same PR per docs/contributing/adrs.md: ADR 0090 and ADR 0100 implementation notes, architecture.md runtime contract bullet, and the tool-call risk assessment problem doc (which previously stated pi hooks stay writable between iterations). Signed-off-by: James Tanner <jtanner@redhat.com>
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20, merge commit bbe0ab2), with PR fullsend-ai#8589 (pi, merged earlier the same day) and extended by PR fullsend-ai#8633 (CLI binary pinning, issue fullsend-ai#8626): hook interpreters and hook PATH resolve only from directories the agent cannot write; hook settings are runner-held; startup is fail-closed on all runtimes carrying sandbox tool hooks. Decision stated as rules 1-10 with a per-runtime conformance table in docs/contributing/runtime-implementation.md (linked from Consequences so it tracks the implementation as code changes). Gaps against the rules are tracked in issues fullsend-ai#8763 and fullsend-ai#8764, both filed by the reviewer. The root-launch case is folded into rule 8 as an explicit scope precondition. OpenCode is excluded (no ADR 0090 hook wiring until unbound-force#515). Cross-references updated in the same PR per docs/contributing/adrs.md: ADR 0090 and ADR 0100 implementation notes, architecture.md runtime contract bullet, and the tool-call risk assessment problem doc (which previously stated pi hooks stay writable between iterations). Signed-off-by: James Tanner <jtanner@redhat.com>
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20, merge commit bbe0ab2), with PR fullsend-ai#8589 (pi, merged earlier the same day) and extended by PR fullsend-ai#8633 (CLI binary pinning, issue fullsend-ai#8626): hook interpreters and hook PATH resolve only from directories the agent cannot write; hook settings are runner-held; startup is fail-closed on all runtimes carrying sandbox tool hooks. Decision stated as rules 1-10 with a per-runtime conformance table in docs/contributing/runtime-implementation.md (linked from Consequences so it tracks the implementation as code changes). Gaps against the rules are tracked in issues fullsend-ai#8763 and fullsend-ai#8764, both filed by the reviewer. The root-launch case is folded into rule 8 as an explicit scope precondition. OpenCode is excluded (no ADR 0090 hook wiring until unbound-force#515). Cross-references updated in the same PR per docs/contributing/adrs.md: ADR 0090 and ADR 0100 implementation notes, architecture.md runtime contract bullet, and the tool-call risk assessment problem doc (which previously stated pi hooks stay writable between iterations). Signed-off-by: James Tanner <jtanner@redhat.com>
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20, merge commit bbe0ab2), with PR fullsend-ai#8589 (pi, merged earlier the same day) and extended by PR fullsend-ai#8633 (CLI binary pinning, issue fullsend-ai#8626): hook interpreters and hook PATH resolve only from directories the agent cannot write; hook settings are runner-held; startup is fail-closed on all runtimes carrying sandbox tool hooks. Decision stated as rules 1-10 with a per-runtime conformance table in docs/contributing/runtime-implementation.md (linked from Consequences so it tracks the implementation as code changes). Gaps against the rules are tracked in issues fullsend-ai#8763 and fullsend-ai#8764, both filed by the reviewer. The root-launch case is folded into rule 8 as an explicit scope precondition. OpenCode is excluded (no ADR 0090 hook wiring until unbound-force#515). Cross-references updated in the same PR per docs/contributing/adrs.md: ADR 0090 and ADR 0100 implementation notes, architecture.md runtime contract bullet, and the tool-call risk assessment problem doc (which previously stated pi hooks stay writable between iterations). Signed-off-by: James Tanner <tanner.jc@gmail.com>
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20, merge commit bbe0ab2), with PR fullsend-ai#8589 (pi, merged earlier the same day) and extended by PR fullsend-ai#8633 (CLI binary pinning, issue fullsend-ai#8626): hook interpreters and hook PATH resolve only from directories the agent cannot write; hook settings are runner-held; startup is fail-closed on all runtimes carrying sandbox tool hooks. Decision stated as rules 1-10 with a per-runtime conformance table in docs/contributing/runtime-implementation.md (linked from Consequences so it tracks the implementation as code changes). Gaps against the rules are tracked in issues fullsend-ai#8763 and fullsend-ai#8764, both filed by the reviewer. The root-launch case is folded into rule 8 as an explicit scope precondition. OpenCode is excluded (no ADR 0090 hook wiring until unbound-force#515). Cross-references updated in the same PR per docs/contributing/adrs.md: ADR 0090 and ADR 0100 implementation notes, architecture.md runtime contract bullet, and the tool-call risk assessment problem doc (which previously stated pi hooks stay writable between iterations). Signed-off-by: James Tanner <tanner.jc@gmail.com>
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20, merge commit bbe0ab2), with PR fullsend-ai#8589 (pi, merged earlier the same day) and extended by PR fullsend-ai#8633 (CLI binary pinning, issue fullsend-ai#8626): hook interpreters and hook PATH resolve only from directories the agent cannot write; hook settings are runner-held; startup is fail-closed on all runtimes carrying sandbox tool hooks. Decision stated as rules 1-10 with a per-runtime conformance table in docs/contributing/runtime-implementation.md (linked from Consequences so it tracks the implementation as code changes). Gaps against the rules are tracked in issues fullsend-ai#8763 and fullsend-ai#8764, both filed by the reviewer. The root-launch case is folded into rule 8 as an explicit scope precondition. OpenCode is excluded (no ADR 0090 hook wiring until unbound-force#515). Cross-references updated in the same PR per docs/contributing/adrs.md: ADR 0090 and ADR 0100 implementation notes, architecture.md runtime contract bullet, and the tool-call risk assessment problem doc (which previously stated pi hooks stay writable between iterations). Signed-off-by: James Tanner <tanner.jc@gmail.com>
Retroactive record of the decision implemented in PR fullsend-ai#8605 (merged 2026-10-20, merge commit bbe0ab2), with PR fullsend-ai#8589 (pi, merged earlier the same day) and extended by PR fullsend-ai#8633 (CLI binary pinning, issue fullsend-ai#8626): hook interpreters and hook PATH resolve only from directories the agent cannot write; hook settings are runner-held; startup is fail-closed on all runtimes carrying sandbox tool hooks. Decision stated as rules 1-10 with a per-runtime conformance table in docs/contributing/runtime-implementation.md (linked from Consequences so it tracks the implementation as code changes). Gaps against the rules are tracked in issues fullsend-ai#8763 and fullsend-ai#8764, both filed by the reviewer. The root-launch case is folded into rule 8 as an explicit scope precondition. OpenCode is excluded (no ADR 0090 hook wiring until unbound-force#515). Cross-references updated in the same PR per docs/contributing/adrs.md: ADR 0090 and ADR 0100 implementation notes, architecture.md runtime contract bullet, and the tool-call risk assessment problem doc (which previously stated pi hooks stay writable between iterations). Signed-off-by: James Tanner <tanner.jc@gmail.com>
Summary
pi's hook adapter (
fullsend-hooks.js,runScript) started each hook script with a barepython3, looked up on the PATH left after the agent-writable.envwas loaded. Apython3stub that exits 0 placed earlier on that PATH made every hook read as allowed without its script running. The adapter now runs the absolutepython3the launch pins before.envis read, and blocks the call if that pin is missing.Related Issue
#8577 (follow-up to #8498 / #8565)
Changes
internal/runtime/pi_run.go: afterenvDataLoad, export the loader's pre-.envpin asFULLSEND_PI_HOOK_PYTHON="$FULLSEND_ENV_PYTHON", and addFULLSEND_PI_HOOK_PYTHONto the loader's drop list for the pi launch, so.envcan neither set nor clear it. Sub-agents inherit it through the env the Agent extension passes to children (childEnv). Plugin env cannot set it either, becauseFULLSEND_*is a reserved prefix.internal/runtime/pi_extension/fullsend-hooks.js:runScriptspawns the interpreter fromFULLSEND_PI_HOOK_PYTHON. If the value is missing, empty or not absolute, the call is blocked and nothing is spawned (fail closed).envis injectable throughrunScript/createHooksfor tests..env(fix(#8575)!: harden and tidy the .env-as-data launch loader #8591) asFULLSEND_PI_HOOK_PATH(dropped from.envlike the interpreter pin), andrunScriptruns each hook aspython3 -E -s -B <script>with that PATH. A missing, empty or non-absolute value blocks the call without spawning.docs/contributing/runtime-implementation.md: the pi hook adapter contract now describes the pinned interpreter.hooks.jsonnames an absolute interpreter resolved at Bootstrap (codexPreflightPython), the wiring digest covers it, and the launch restores the pre-.envPATH before codex starts.Testing
node --test internal/runtime/pi_extension/fullsend-hooks.test.mjs: new tests cover:python3stub first on PATH is never spawned, and a blocking hook's verdict is honouredpython3andbin/python3values block without spawningtool_callandtool_resultboth fail closed without a pingo test ./internal/runtime/:TestBuildPiRunCommand_HookPythonPinnedchecks the name is dropped by the loader and exported after the.envload, before pi starts.TestPiHookPythonExport_IgnoresEnvruns the real loader with a.envthat sets the name and prepends apython3stub to PATH. The exported value stays the pre-.envinterpreter.go test ./internal/runtime/... ./internal/security/... ./internal/cli/...pass as a non-root user on Linux (dash/bin/sh);node --teston the pi extension: 140 pass, 4 skipped.piHookPythonExportandbuildPiRunCommandare at 100%.pre-commititself could not fetch hook repositories in the sandbox (TLS failure), so the applicable hooks were run directly and all passed: pre-commit-hooks 6.0.0 file checks, gofmt, go vet, scan-secrets, lint-broken-symlinks, lint-docs-links and lychee.mainin this sandbox and are unrelated to this change:TestBuildRunCommand_ClaudeMissingExits127(a realclaudebinary is on PATH) and onefullsend-agent.test.mjsprocess-group kill test.Checklist
!for breaking changes)🤖 Generated with Claude Code
Closes #8577
Post-script verification
agent/8577-pin-pi-hook-python)5fc4c47a1d40c2ab0a748e3bd2f7b9f8a697ca50..HEAD)