Skip to content

fix: preserve Responses-API built-ins through the trim - #26

Merged
danipl merged 2 commits into
mainfrom
fix/12-preserve-builtins-on-trim
Oct 5, 2026
Merged

danipl merged 2 commits into
mainfrom
fix/12-preserve-builtins-on-trim

Conversation

@danipl

@danipl danipl commented Oct 5, 2026

Copy link
Copy Markdown
Owner

What

Implements the design verdict recorded in #12.

Q1 — built-ins survive the trim. Jev is never offered Responses-API built-in tools (type !== "function"), yet a confident trim removed them from the payload. An actor must not silently delete options it was forbidden to consider. The filter in routePayload now passes built-ins through untouched; the predicate is unified into one isBuiltIn() shared by candidate selection and the kept-count. Corollary: a lone function candidate + built-ins can only reproduce the payload, so that Jev round-trip is skipped — subsuming the old [web_search, shell] special case. The apply: log gains a (+ N built-ins kept) suffix.

Q2 — README Privacy section (option A). States exactly what conversation content is POSTed to apiUrl (first user message + last 4 turns, 2 KB/turn, 8 KB cap, ≤254 tool names, default host api.typesafe.ai) and the zero-egress paths (unconfigured = invisible; self-hosted endpoint via apiUrl/JEV_API_URL). Option B (stateMode) deferred as YAGNI per the issue.

Tests

  • Test 7 flipped: [web_search, shell, read] → shell@0.95 ships [web_search, shell]; asserts the new log suffix.
  • Test 7b added (passthrough path for the new gate): lone function tool beside built-ins → untouched, no fetch.
  • Test 8 (built-ins only) unchanged.
  • Invariant-4 text synced in AGENTS.md / DEVELOPMENT.md / README Safety.

Gates

npm run typecheck ✓ · npm test 26/26 ✓ · npm run build ✓

Note: squash-only repo, so the Q2 docs ride the single fix: commit — patch bump comes from the behavior change, the privacy note adds nothing release-wise on its own.

Fixes #12

danipl added 2 commits October 5, 2026 06:44
askJev silently dropped every tool past the 254th from the criteria,
so a 260-tool request offered 254 to routing with zero operator signal.
Behavior stays safe (a pick among kept tools still trims); the note is
awareness only. The JEV_MODEL env-only doc claim from the same issue was
already fixed by #24.

- askJev: one "note:" line before the round-trip when names.length > 254
- DEVELOPMENT.md: table row for the note: line (can precede apply: too)
- Test 23: 260-tool payload — stub criteria = 254 tools + respond_to_user,
  note logged, trim still applies
Jev is never shown built-in tools (invariant 4), yet a confident trim
removed them from the payload — an actor must not silently delete
options it was forbidden to consider. The trim filter now passes
type !== "function" entries untouched; the predicate lives in one
isBuiltIn() used by candidate selection and the kept-count alike.
Corollary: a lone function candidate now reproduces the payload under
trim, so that round-trip is skipped — subsuming the old
[web_search, shell] special case. apply: log gains a
"(+ N built-ins kept)" suffix. Test 7 flipped, test 7b added,
invariant-4 text synced (AGENTS/DEVELOPMENT/README), and the Q2-A
README privacy note ships alongside.
@danipl
danipl merged commit 56b944c into main Oct 5, 2026
2 checks passed
@danipl
danipl deleted the fix/12-preserve-builtins-on-trim branch October 5, 2026 05:12
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.

Design questions: built-in tools stripped on trim, and conversation content sent to third party

1 participant