Skip to content

feat(runtime)!: select exact vetted Pi extension tools - #9265

Open
eshulman2 wants to merge 9 commits into
fullsend-ai:mainfrom
eshulman2:docs/adr-0166-pi-tools
Open

eshulman2 wants to merge 9 commits into
fullsend-ai:mainfrom
eshulman2:docs/adr-0166-pi-tools

Conversation

@eshulman2

@eshulman2 eshulman2 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An agent can load a vetted Pi extension but lose its native tool names during translation. This implements exact native selection so tools: [inspect_record] exposes that tool while excluding sibling tools and built-in shell/edit tools. Missing, hidden, ambiguous or non-vetted native selections fail before inference. Explicit empty selections exclude extension tools too.

This replaces the ADR-only proposal with runtime code, tests and migration documentation. Adapted from the existing fork implementation, limited to Pi tool selection; journal and tracker changes are excluded. The original ADR additions and their links are removed from the final PR diff.

Closes #9254.

Implementation

  • Preserve built-in translations and fix(runtime): preserve MCP tools and permissions in pi agents #9179's MCP selectors, asynchronous registration and callable/active distinction.
  • Resolve exact native names against vetted extension source paths with a runner-owned selector. Restore the effective active set at session, agent and turn boundaries, and block calls outside the declared selection.
  • Apply the same selector to children using the dispatcher's concrete parent/persona permission intersection and verified extension code. Explicit persona declarations support mapped tools and MCP selectors. Exact native extension names are supported in the parent agent declaration.
  • Check selector integrity before and after environment loading and before child dispatch. Selector failures stop inference before model fallback. An explicit tool list or a configured child selector requires the manifest digest recorded by Bootstrap in the same runner process. Selector and gateway integrity failures have distinct exit codes.
  • Keep repository extension discovery disabled. Tool selection grants no additional sandbox, shell, network or publication capability.

The implementation is forge-neutral and applies on GitHub, GitLab and Forgejo.

Breaking change and migration

BREAKING CHANGE: previously ignored unknown Pi tool names now request exact native extension tools, and invalid native patterns fail setup. Remove stale Claude-only names or declare a vetted extension that supplies each exact requested name. An explicit empty selection now excludes extension tools as well as built-ins. The existing runner behavior of adding read for skills remains documented.

Validation

  • Runtime package tests pass with FULLSEND_TEST_PI_BIN set to pinned Pi 1.6.0, including all three direct MCP parent and child integration cases and the missing-digest regression for default-mode Agent parents. Package statement coverage is 94.5%.
  • Approximate Go patch coverage is 56 of 57 changed instrumented lines (98.2%), including both lines changed in the latest review follow-up.
  • All 181 extension tests pass with pinned Pi 1.6.0 and node --test --test-concurrency=1 internal/runtime/pi_extension/*.test.mjs. The default Node suite also checks that a missing tool fails at session startup before tools are activated.
  • make lint and git diff --check pass.

Prepared with coding-agent assistance. Human-directed commits carry DCO sign-off.

Signed-off-by: eshulman2 <ellashulman1@gmail.com>
@eshulman2
eshulman2 requested a review from a team as a code owner November 10, 2026 10:08
@github-actions

Copy link
Copy Markdown

E2E tests did not run

E2E tests run automatically for pull requests authored by users with write access or higher.

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

Reason: unauthorized

See E2E testing guide for details.

@qodo-code-review

qodo-code-review Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Gateway tampering is misreported as a tool-selection failure ✓ Resolved Bug Observability

Resolving commit: 7fbec6a

Resolution reason
The tool selector exit code was moved from 92 to 99 in both Go and the JS extension, so it no longer
collides with the gateway config tamper exit (92). Tests were updated accordingly, and a new test
checks that a gateway-config failure on a run with explicit tools reports the gateway diagnostic.
Description
piToolSelectionExit and piGatewayConfigTamperedExit both equal 92, and piExecModel checks the
tool-selection branch first when m.Tools != nil. If a gateway run declares tools:, a rewritten
inference-gateway.json or local overlay reaches that branch and produces a selector diagnosis
rather than the gateway-specific diagnostic, directing the operator to the wrong file.

2. Pi runtime guide still says empty tool lists use the old flag ✓ Resolved Rule violation Maintainability

Resolving commit: 7fbec6a

Resolution reason
The commit rewrites the stale paragraph in docs/runtimes/pi.md: "Parents whose tools map to an empty
list use --tools '', which filters out both built-in and extension tools, including Agent and
Task." This replaces the old --no-builtin-tools statement, so the Pi runtime guide now matches
the launch branch and the updated runtime-implementation.md wording. The fix differs from the
suggested prompt only in that it adds Agent/Task wording rather than the exact sentence proposed,
but the substance (correct flag, excludes built-in and extension tools) is the same.
Description
docs/runtimes/pi.md still says buildPiRunCommand uses --no-builtin-tools for parents whose
tools map to an empty list, although the launch branch now emits --tools ''. When debugging an
explicit empty selection, readers would look for the wrong flag and expect extension tools to load,
contradicting the updated guidance in docs/contributing/runtime-implementation.md.

3. Personas silently lose tools no extension provides ✓ Resolved Bug Correctness

Resolving commit: b3834d6

Resolution reason
Persona tool filtering now treats exact native extension names as unsupported and excludes them from
the registered persona tool set (piPersonaTools appends native names to unsupported), so such
personas are refused at registration instead of silently losing tools at dispatch. Docs updated to
say exact extension names in persona declarations prevent registration.
Description
piToolsFor now treats exact native names such as WebFetch as supported without verifying that a
vetted extension supplies them, so piPersonaTools and piPersonaRegistrable register personas
they previously refused. When such a persona dispatches, child selection intersects its requested
names with the parent’s callable tools and checks only the result, silently dropping a missing name
or launching with --tools '' if none remain, while the troubleshooting row in
docs/runtimes/pi.md still says missing selections fail.

View medium (2)
4. Missing-tool failure is only tested behind an env-gated Pi binary ✓ Resolved Requirement gap Maintainability

Resolving commit: b3834d6

Resolution reason
The commit adds a non-gated JS test "session startup fails before activating a missing native tool"
in fullsend-tools.test.mjs, which calls initializeSelector with a registry lacking the native tool
and asserts session_start throws "missing or ambiguous tool: inspect_record" and that tool_call is
blocked. This runs under normal node test without FULLSEND_TEST_PI_BIN, covering the missing-name
path before inference. It does not cover the duplicate-registration case explicitly, nor add a
Go-level test, so it is a different implementation than the suggested fix.
Description
The Go tests (TestPiExactNativeTools, TestPiToolSelectorBootstrap) only check name syntax and
manifest contents, so nothing in a normal go test run shows that a missing or ambiguous native
name stops the run before inference. That behaviour lives in the JS selector selectTools, which
throws when registry has zero or two matches, and it is exercised only by `real Pi refuses
missing, ambiguous and non-vetted selections before inference. That test is wrapped in { skip:
!realPi }, so it is skipped unless FULLSEND_TEST_PI_BIN` is set. The same gating applies to the
real-Pi tests for the selected-tool, hook-denial and empty-selection boundaries.

5. Runs that declare tools fail without a recorded manifest digest ✓ Resolved Bug Reliability

Resolving commit: 7fbec6a

Resolution reason
Run now fails early with a clear error when a manifest declares tools but no digest was recorded in
the same process, and the docs state Bootstrap and Run must share a process for explicit tool
selection. The selector's silent exit-92 path for this case is replaced by a descriptive guardErr.
Description
The selector exits 92 whenever FULLSEND_PI_MANIFEST_SHA256 is unset, but buildPiRunCommand
exports that variable only when manifestSum is non-empty, i.e. only when Bootstrap ran in the same
process. Any caller that bootstraps in one process and runs in another now fails every pi run with a
declared tools: list before inference. The existing seam was designed to allow that case: its
comment says failing closed there would break such callers.

Grey Divider

Context sources
✅ Linked PRs:
  🌐 PR #9179
❌ Tickets: failed to load — Ticket collection could not establish complete evidence
✅ Compliance rules (platform): 96 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/agents (sha: b11d1b1c) — View relationship
  Explored: repo: fullsend-ai/mlflow-assessments (sha: e0fbd4e2) — View relationship
  Explored: repo: fullsend-ai/test-creator (sha: a5082d20) — View relationship
  Explored: repo: fullsend-ai/pi-anthropic-vertex (sha: e9fa7206) — View relationship
  Explored: repo: fullsend-ai/pi-xai-vertex (sha: d18d87ba) — View relationship
  Explored: repo: fullsend-ai/metrics (sha: b5e856d5) — View relationship
✅ Context preparation
  Past issues: summarized; full text retained for this review
Review mode: Auto: 🧠 Deep: Security-sensitive runtime changes span selection, integrity, hooks, and child dispatch.

Grey Divider

Tip of the day
💡 Did you know, you can pick a display mode instead of tweaking every Display option by hand

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Select exact vetted Pi extension tools for parent and child runs

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

Grey Divider

AI Description

• Resolve exact native Pi tool names from vetted extensions instead of silently dropping them.
Merge Risk 🟡 Medium

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • Bootstrap validation, plugin-argument validation, manifest construction, selector enforcement, and child dispatch jointly determine which configured Pi actions can execute.
  • They form one bounded Pi runtime capability rather than separate capabilities per implementation layer.
  • Lifecycle activation, call-time blocking, and child permission intersections all control the same Pi runtime outcome: which configured actions the agent can perform.
Sources

internal/pluginformat/pi.go[41-43]

var piReservedOptions = map[string]bool{
	"--fullsend-child-active-tools": true,
	"--fullsend-selected-tools":     true,
Behavioral complexity 🔴 High 🧩 Multiple interactions

  • Before: child active-tool restoration and explicit selection were handled through separate paths.
  • After: the runner-owned selector, manifest identity, extension load order, lifecycle reactivation, MCP late registration, active-versus-callable separation, and child intersections must agree.
  • New correctness conditions are that activeTools stays a subset of child tools, lifecycle reactivation cannot widen the set, call-time authorization matches activation, and late MCP registration preserves the intended callable/active distinction.
Potential damage 🟡 Medium 🩹 Temporary loss

  • A false rejection prevents a Pi run or child from performing its configured work.
  • Reverting or correcting the selection restores future runs; no persistent state repair is shown.
  • Correct the exact tool declaration, extension registration, plugin argument, or selector deployment and rerun; the selector creates no persistent state requiring repair.
Sources

internal/pluginformat/pi.go[41-43]

var piReservedOptions = map[string]bool{
	"--fullsend-child-active-tools": true,
	"--fullsend-selected-tools":     true,
Assessed commit c28e446
Diagram

graph TD
  A["Agent tools"] --> B["Pi bootstrap"] --> C["Pinned manifest"] --> D["Launch guard"] --> E["Pi tool registry"] --> F["Exact selector"]
  C --> G["Child dispatch"] --> F
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Rely on Pi's --tools allowlist
  • ➕ Less runner-owned code and fewer integrity checks.
  • ➖ Cannot establish that a native name came from a vetted extension or enforce the child active/callable distinction.
2. Change or fork Pi's tool loader
  • ➕ Could enforce selection directly in the runtime registry.
  • ➖ Creates an upstream dependency or a maintained fork for a runner-specific permission policy.

Recommendation: Use the runner-owned selector: it verifies tool origin and child permissions without widening the sandbox or changing Pi. Review its interaction with Pi registration and lifecycle events closely, since those are the policy boundary.

Files changed (19) +557 / -32

Enhancement (6) +186 / -12
pi_agent.goPreserve exact native Pi tool names +31/-5

Preserve exact native Pi tool names

• Passes valid unknown names through tool translation, rejects invalid native patterns, and identifies native selections for verification.

internal/runtime/pi_agent.go

pi_bootstrap.goInstall and manifest the tool selector +14/-3

Install and manifest the tool selector

• Uploads the runner-owned selector and records strict, native, and child selector settings, including its digest.

internal/runtime/pi_bootstrap.go

fullsend-agent.jsPass resolved child permissions to the selector +3/-1

Pass resolved child permissions to the selector

• Loads the selector for children and passes their concrete callable and active tool sets through a runner-owned flag.

internal/runtime/pi_extension/fullsend-agent.js

fullsend-tools.jsEnforce strict tool selection inside Pi +101/-0

Enforce strict tool selection inside Pi

• Verifies selected native registrations against vetted extension paths, restores active tools at lifecycle boundaries, and blocks unselected calls. Preserves supported MCP pattern behavior and exits on selection or manifest-integrity failures.

internal/runtime/pi_extension/fullsend-tools.js

pi_run.goGuard and load the Pi selector on run +14/-3

Guard and load the Pi selector on run

• Checks selector integrity around environment loading, loads it after declared extensions, and uses an empty allowlist that excludes extension tools. Treats selector failure as fatal rather than a model-fallback condition.

internal/runtime/pi_run.go

pi_tool_selection.goEmbed and hash the Pi selector +23/-0

Embed and hash the Pi selector

• Adds the embedded extension, digest calculation, shell integrity guard, and dedicated failure exit code.

internal/runtime/pi_tool_selection.go

Tests (8) +308 / -13
openai_seeder_test.goKeep unsupported-tool fixture invalid +1/-1

Keep unsupported-tool fixture invalid

• Changes a persona fixture to an unsupported wildcard now that an exact unknown name can denote a native tool.

internal/runtime/openai_seeder_test.go

pi_agent_test.goTest exact native-name translation +8/-2

Test exact native-name translation

• Updates expectations for formerly unsupported names and tests deduplication and invalid-pattern rejection.

internal/runtime/pi_agent_test.go

pi_bootstrap_test.goAccount for the child selector digest +3/-3

Account for the child selector digest

• Updates manifest assertions to include the selector in child extension integrity coverage.

internal/runtime/pi_bootstrap_test.go

pi_edit_repair_test.goExpect an explicit empty Pi allowlist +1/-1

Expect an explicit empty Pi allowlist

• Checks that an empty selection uses '--tools ''' rather than disabling only built-ins.

internal/runtime/pi_edit_repair_test.go

fullsend-tools.test.mjsTest selector policy and pinned-Pi behavior +182/-0

Test selector policy and pinned-Pi behavior

• Covers origin checks, activation, MCP behavior, child intersections, empty selections, hook denial, and manifest failures. Includes offline real-Pi acceptance cases when the pinned binary is supplied.

internal/runtime/pi_extension/fullsend-tools.test.mjs

pi_personas_test.goRetain an invalid persona-tool fixture +3/-3

Retain an invalid persona-tool fixture

• Uses an unsupported wildcard so the persona rejection test remains valid under exact native-name selection.

internal/runtime/pi_personas_test.go

pi_run_test.goUpdate launch-command assertions +3/-3

Update launch-command assertions

• Checks the selector guard's command prefix and the new explicit empty tool argument.

internal/runtime/pi_run_test.go

pi_tool_selection_test.goTest selector bootstrap and fail-closed launch +107/-0

Test selector bootstrap and fail-closed launch

• Covers translation, uploaded selector contents, digest enforcement, load order, and fatal handling of a tampered selector.

internal/runtime/pi_tool_selection_test.go

Documentation (5) +63 / -7
architecture.mdRecord exact Pi extension-tool selection +4/-0

Record exact Pi extension-tool selection

• Adds the implemented selection rule, failure behavior, and child permission intersection to the architecture overview.

docs/architecture.md

run.mdDocument Pi run migration +7/-0

Document Pi run migration

• Explains exact native names, rejection of unknown selections, and explicit empty tool lists.

docs/cli/run.md

runtime-implementation.mdDescribe selector implementation and acceptance tests +22/-1

Describe selector implementation and acceptance tests

• Updates child tool-selection behavior and documents selector installation, integrity checks, lifecycle enforcement, and pinned-Pi validation.

docs/contributing/runtime-implementation.md

bring-your-own-agent.mdExplain native tools in agent frontmatter +8/-0

Explain native tools in agent frontmatter

• Shows how to select a vetted extension tool and migrate previously ignored names.

docs/guides/user/bring-your-own-agent.md

pi.mdDocument strict Pi tool-selection semantics +22/-6

Document strict Pi tool-selection semantics

• Replaces the extension-tool exclusion guidance with exact native selection, empty-list behavior, failure cases, and migration advice.

docs/runtimes/pi.md

@ascerra ascerra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm for this. I hit the same limit with a small extension (code): once tools: names a built-in, Pi hides the extension tools, so I had to leave tools: off entirely (note).

One thing that may help now: with tools: left off, extension tools already run on fullsend. I ran them in a GitLab pipeline on v0.55.0 (results). So the CVE extension may not need to wait for this to run, only to be locked down. I haven't tried that extension itself.

Two questions inline.

Resolve native extension tools without widening parent or child permissions.
Preserve MCP registration and exposure semantics, fail closed before inference,
and guard the selector on launch and dispatch. Add pinned-Pi acceptance tests
and document migration from silently ignored tool names.

BREAKING CHANGE: Unknown Pi tool names now require a vetted extension that
registers the exact requested name. Remove stale names or load their extension.
Explicit empty selections now exclude extension tools as well as built-ins.

Signed-off-by: eshulman2 <ellashulman1@gmail.com>
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
@eshulman2 eshulman2 changed the title docs(adr): define exact Pi extension tool selection feat(runtime)!: select exact vetted Pi extension tools Nov 23, 2026
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
@eshulman2
eshulman2 marked this pull request as ready for review November 23, 2026 08:56
@eshulman2
eshulman2 requested a review from ascerra November 23, 2026 08:56
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Site preview

Preview: https://3ff9fb72-site.fullsend-ai.workers.dev

Commit: c28e446bf6e4e4002b319703edc09db1e84e2cfb

Comment thread internal/runtime/pi_agent.go Resolved
Comment thread internal/runtime/pi_tool_selection.go Resolved
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit cc928ba

@waynesun09 waynesun09 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

HIGH: Required test check fails: the real-Pi MCP launch test does not stage the new tool selector (internal/runtime/pi_frontmatter_mcp_test.go around line 56; the file is not in this diff, so this note is here instead of inline)

The required test check fails at head cc928ba (run 45142513710, job 137583718330). All three subtests of TestPiBootstrap_DirectMCPRealPi fail (pattern, bare-parent, bare-persona). The errors are Error: Unknown option: --fullsend-selected-tools and Failed to load extension "/sandbox/pi-config/fullsend-tools.js": Extension path does not exist.

Bootstrap now always writes toolSelector into the child manifest, and both buildPiRunCommand and childArgs add -e /sandbox/pi-config/fullsend-tools.js. This PR does not change pi_frontmatter_mcp_test.go or testdata/pi-direct-mcp.mjs, and neither mentions fullsend-tools.js or FULLSEND_PI_MANIFEST_SHA256. So the child cannot load the selector, and pi rejects the unregistered flag. The local go test ./internal/runtime run in the PR body skipped this test because FULLSEND_TEST_PI_BIN was unset. CI sets that variable.

Suggestion: In testPiDirectMCP and testdata/pi-direct-mcp.mjs, stage fullsend-tools.js the same way as the other runner-owned extensions, or rewrite the toolSelector path. Export FULLSEND_PI_MANIFEST and FULLSEND_PI_MANIFEST_SHA256 for the child. Rerun with FULLSEND_TEST_PI_BIN set to pinned pi 1.6.0, and correct the Validation section of the PR body.

Verified: required check fails: test (TestPiBootstrap_DirectMCPRealPi, log grep); test files unchanged in diff at cc928ba; raised by: Claude

Comment thread internal/runtime/pi_bootstrap.go Resolved
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
@codecov

codecov Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/runtime/pi_bootstrap.go 84.61% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@jflowers jflowers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Council review: REQUEST CHANGES

7 reviewers ran (adversary, architect, curator, fullsend, gaze-testing, guard, testing); 13 findings total: 1 HIGH, 7 MEDIUM, 5 LOW. Dispatch artifact: correlation b9e0db4f-4b28-4c7e-9980-0311aa32556c (.uf/artifacts/dispatch/).

Summary

The exact-selection design is sound, and the head commit visibly addresses earlier review feedback (selector exit 99 distinct from gateway 92, the same-process digest requirement, direct-MCP test staging, manifest field docs). CI is green. From what I can tell, one gap remains before this lands: the acceptance-critical real-Pi tests are env-gated, so the boundary's defining behaviors have no CI-enforced regression coverage. The MEDIUM items are test-quality hardening; the LOW items are optional.

Findings not anchored to this diff

  • MEDIUM (guard): The breaking change lacks a CHANGELOG entry. Bootstrap now fails on previously-ignored tool names, and empty selections exclude extension tools; docs/runtimes/pi.md, docs/cli/run.md, and runtime-implementation.md describe the migration, but CHANGELOG.md carries no entry linking #9254 with BREAKING CHANGE treatment, which the issue explicitly requires. Could a changelog entry land in this PR?

Inline comments carry the remaining findings (1 HIGH, 5 MEDIUM, 5 LOW).

This review was generated by /uf.review-pr (AI-assisted).

Comment thread internal/runtime/pi_bootstrap_test.go Resolved
Comment thread internal/runtime/pi_run_test.go Resolved
Comment thread internal/runtime/pi_agent_test.go Resolved
@@ -321,3 +324,26 @@ func piToolsFor(claudeTools []string) (tools, unsupported []string) {
}
return tools, unsupported
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LOW (architect): The native versus MCP classification now lives in two places: this regex plus piMCPResourcePattern in Go, and mcpSelector in fullsend-tools.js (startsWith('mcp__') or /^(list|read)_mcp_/). The JS predicate accepts any list_mcp_* and mcp__ with an empty suffix; Go checks the closed resource list. Bootstrap fails closed early, so the divergence is masked today. Would a shared fixture or cross-check keep the two selectors from drifting when the syntax evolves?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

b3834d667 adds Go-side rejection coverage for bare mcp__ and an unknown list_mcp_ name. The proposed shared Go/JS fixture is still open.

Comment thread docs/runtimes/pi.md Resolved
Comment thread internal/runtime/openai_seeder_test.go Resolved
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
@eshulman2

Copy link
Copy Markdown
Contributor Author

The top-level review finding about the direct MCP integration fixture was fixed in 7fbec6a0c. The fixture stages the Bootstrap-uploaded selector and passes the original manifest and digest to the pinned Pi child. All three integration cases passed locally, and the required test check passed on b3834d667.

@waynesun09 waynesun09 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

MEDIUM: Docs still describe the replaced child loadout-guard path and pending unregistered names (docs/runtimes/pi.md lines 448-454; outside this diff's hunks, so the note is here instead of inline)

pi.md:448-454 says a child-only loadout guard restores the inherited active subset and that inherited names not yet registered may remain pending. runtime-implementation.md (around lines 1115-1120 and the extensions manifest row) says the same, and says childArgs adds fullsend-agent.js in child-only mode.

At head, every Agent manifest has toolSelector set. So the --fullsend-child-active-tools branch (fullsend-agent.js:536-537) is unreachable, and children go through fullsend-tools.js. That selector exits 99 on any unregistered non-MCP name instead of leaving it pending. The docs also never mention exit 99 or the selector's failure message, though pi.md and runtime-implementation.md list the other guard exit codes (97/94/95/93).

Suggestion: Rewrite the child-mechanism paragraphs in pi.md and runtime-implementation.md to describe the selector path (-e fullsend-tools.js --fullsend-selected-tools) and its fail-on-unregistered behavior. Add exit 99 and its message to the guard list and the troubleshooting table.

Verified: read docs at head; grep finds no exit 99 in pi.md or runtime-implementation.md at b3834d6; raised by: DeepSeek

Comment thread internal/runtime/pi_run.go Resolved
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
@eshulman2

Copy link
Copy Markdown
Contributor Author

The latest review’s documentation finding is addressed in d0c473bcb. Both guides now describe the strict child selector, late MCP registration, and exit 99. The full runtime suite passed locally with pinned Pi 1.6.0.

@waynesun09 waynesun09 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Four MEDIUM findings from a review-only pass at d0c473b, inline below.

Comment thread internal/runtime/pi_agent.go Resolved
Signed-off-by: eshulman2 <ellashulman1@gmail.com>
Signed-off-by: eshulman2 <ellashulman1@gmail.com>

@waynesun09 waynesun09 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

MEDIUM: The canonical pi Run command line and guard list in runtime-implementation.md still describe the launch from before the selector (docs/contributing/runtime-implementation.md around lines 824 and 840; both are outside this diff's hunks, so this note is here instead of inline)

When m.Tools != nil, buildPiRunCommand now does three new things (pi_run.go:485-487, 643-645, 722-724, 727-729):

  1. It adds a piToolSelectionGuard before .env is sourced.
  2. After .env, it runs unset -f test [ command sha256sum cut and adds a second guard.
  3. It appends -e /sandbox/pi-config/fullsend-tools.js after the declared extensions. For an empty selection it emits --tools '' instead of --no-builtin-tools.

Two places in the doc still show the old behaviour:

  • The "Hardening levers in use" bullet at about line 824 lists the old -e set. It has no fullsend-tools.js and no exit-99 guard.
  • The edit-repair bullet at about line 840 still justifies the parent's edit gate with "under --no-builtin-tools with no --tools, pi does not filter extension tools". The parent no longer emits that flag.

The earlier docs review covered pi.md:448-454 and runtime-implementation.md:1115-1120, not these lines.

Suggestion:

  • Add [-e /sandbox/pi-config/fullsend-tools.js] to the canonical command at line 824. It is emitted when tools: is declared, after the declared extensions.
  • Add a bullet to the guard list for the selector's guards before and after .env, and exit 99. Or link to the section at about line 1155.
  • Reword the edit-repair rationale at about line 840 to say that an explicit --tools list, including --tools '', already filters extension tools.

Verified: read code (pi_run.go diff, runtime-implementation.md:820-841, diff hunks) at c28e446; raised by: DeepSeek

@ascerra ascerra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The docs now answer my two questions from the first round (here). An agent file that names an extension tool is Pi-only and other runtimes get a definition of their own (here), and the change for agents that list a Claude-only name is in the migration note (here). What's left from those is that an agent that depends on an extension still runs on a runtime that skips it. I don't think that belongs in this PR, so I filed it as #9964.

I'm still for this. I tried the head on a local build with main merged in. The agent I used declares only cve in tools:, and the CVE assessment extension it loads registers that tool and one more.

  • The session record lists cve as the only tool the model was given, and the run finished with 22 calls to it.
  • With the name changed to one that no extension registers, the run stopped before the model was called.
[fullsend-tools] missing or ambiguous tool: cve_missing
...
Error: running agent (iteration 1): pi strict tool selection failed or selector changed; refusing inference

I said in the first round that our own agents are fine. I checked that again. Every tool name the agents on main in fullsend-ai/agents declare is either in the Pi runtime's map of built-in tool names or Skill, which it handles without a tool (here, example).

The branch conflicts with main today. Main now passes hooksEnabled to piBinaryPin (here), and this branch adds the selection guard right under that line (here). For my build it was enough to keep main's call with the guard under it, in pi_run.go and in TestBuildPiRunCommand_Basic, which checks how the launch command starts.

Main has also moved the pinned Pi from 1.6.0 (here) to 1.7.0 (here). On the merged tree the extension tests and the real-Pi launch test pass for me against 1.7.0. My runs of the agent still used an image with 1.6.0, so I haven't seen a whole run on 1.7.0.

Verified: local build of c28e446 with main ad41a65 merged in (two conflict hunks resolved by hand), sandbox runs of that build on the Pi runtime, and the extension tests plus TestPiBootstrap_DirectMCPRealPi on that tree against Pi 1.7.0; raised by: Claude

This branch was successfully deployed

1 active deployment
site-preview — c28e446b Deployed Dec 1, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Support exact native Pi extension tool selections

4 participants