feat(adapters): request-rewriting interceptors - #1651
Closed
Glorf wants to merge 1 commit into
Closed
Conversation
Contributor
|
🌿 Preview your docs: https://nvidia-preview-feat-adapter-rewrites.docs.buildwithfern.com/nemo/gym Here are the markdown pages you've updated: |
Glorf
force-pushed
the
feat/adapter-rewrites
branch
2 times, most recently
from
June 23, 2026 10:57
42204e5 to
1963f57
Compare
Glorf
force-pushed
the
feat/adapter-rewrites
branch
from
June 23, 2026 11:54
1963f57 to
0bdc72e
Compare
Glorf
force-pushed
the
feat/adapter-rewrites
branch
from
June 23, 2026 12:30
0bdc72e to
9ce8c25
Compare
PR 4 of 4 — request-rewriting family. Built on feat/adapter-base
(independent of the observability and caching PRs).
Adds 6 interceptors that mutate the outbound request body before it
reaches the upstream:
- drop_params remove named parameters from outbound body
- payload_modifier add / remove / rename body fields
- system_message inject a system message (prepend / append /
replace)
- consolidate_system merge displaced system messages into one at
position 0 (Qwen3 requires this; other models
tolerate it)
- modify_tools strip or add properties on
tools[].function.parameters
- turn_counter per-session turn budget; raises GracefulError
(-> 429) on exhaustion; injects warn/urgent
system messages at 80%/95% of budget
All six are registered as builtins in InterceptorRegistry._BUILTIN.
Tests
test_adapter_interceptors.py drop_params, modify_tools,
system_message (prepend / replace),
payload_modifier (add / remove),
turn_counter (basic + session
isolation)
test_adapter_consolidate_system.py displaced-system-message merging
edge cases
test_adapter_parity_replay.py 6 captured-fixture scenarios
81 tests pass (42 from feat/adapter-base + 39 added).
Docs
fern/.../model-server/adapters.mdx appends Request-Rewriting section
with per-interceptor YAML config
snippets.
Signed-off-by: Michal Bien <mbien@nvidia.com>
Glorf
force-pushed
the
feat/adapter-rewrites
branch
from
June 23, 2026 12:38
9ce8c25 to
f2121b8
Compare
Glorf
added a commit
that referenced
this pull request
Jul 8, 2026
ECS Fargate `SandboxProvider` on top of the sandbox API (#1377, now merged to `main`). Auto-mirrors public images to ECR on demand; SSH reverse-tunnel for exec / file-transfer / model egress. Rebased onto `main` now that the sandbox base (#1377) has landed — this PR stands on its own and is ready for review. **Sandbox-bound agents line of work:** **ECS Fargate (this PR)** → adapter middleware base (#1646) → sandbox-bound CLI agents + capture (#1647). Interceptor follow-ups on the adapter base: #1649 (caching), #1650 (observability), #1651 (rewrites). 3 commits, +5974: ECS provider + engine, on-demand ECR mirroring + conda activation fix, and 233 unit tests (engine.py to 99%). `uv.lock` reconciled with main's security upgrades (#1657). --------- Signed-off-by: Michal Bien <mbien@nvidia.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adapter interceptor follow-up on
feat/adapter-base. Adds 6 interceptors that mutate the outbound request body:drop_params— remove named parameterspayload_modifier— add / remove / rename body fieldssystem_message— inject a system message (prepend / append / replace)consolidate_system— merge displaced system messages to position 0 (required by Qwen3)modify_tools— strip / addtools[].function.parameterspropertiesturn_counter— per-session turn budget; raisesGracefulError(→429) on exhaustion; warn/urgent system messages at 80%/95%All registered as builtins. Tests: per-interceptor behavior, consolidate-system edge cases, parity replay (6 scenarios) — 39 added.
Supersedes Glorf#4 (fork discontinued; rebased clean onto upstream
feat/adapter-base).