Skip to content

[train] Gateway anthropic adapter#70

Draft
zackcxb wants to merge 13 commits into
verl-project:mainfrom
zackcxb:pr25-anthropic-adapter
Draft

[train] Gateway anthropic adapter#70
zackcxb wants to merge 13 commits into
verl-project:mainfrom
zackcxb:pr25-anthropic-adapter

Conversation

@zackcxb

@zackcxb zackcxb commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Normalize gateway adapter/session plumbing for OpenAI and Anthropic providers.
  • Split adapter-side wire types from session/internal types, remove stale request/protocol shims, and tighten prefix canonicalization around tool call IDs.
  • Add a standalone examples/gateway/debug_launcher.py plus docs and tests for local gateway debugging and trajectory collection.

Testing

  • pytest -q tests/uni_agent/gateway/test_debug_launcher.py tests/uni_agent/gateway/adapters/test_openai_adapter.py tests/uni_agent/gateway/adapters/test_anthropic_adapter.py tests/uni_agent/gateway/test_gateway_actor_on_cpu.py

@zackcxb zackcxb changed the title Pr25 anthropic adapter [train] Gateway anthropic adapter Jun 25, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces provider adapters for Anthropic and OpenAI to translate wire protocol requests into a canonical internal format (InternalGenerationRequest), decoupling wire translation from the session and codec logic. It also adds a standalone gateway debug launcher (debug_launcher.py) with extensive documentation and comprehensive unit tests. Feedback on the debug launcher suggests simplifying the redundant type checking and decoding logic for TimeoutExpired exceptions since subprocess.run is invoked with text=True.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +450 to +463
stdout = exc.stdout if exc.stdout is not None else exc.output
stderr = exc.stderr
if isinstance(stdout, bytes):
stdout = stdout.decode(errors="replace")
elif stdout is None:
stdout = ""
else:
stdout = str(stdout)
if isinstance(stderr, bytes):
stderr = stderr.decode(errors="replace")
elif stderr is None:
stderr = ""
else:
stderr = str(stderr)

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.

medium

The subprocess.run call uses text=True, so exc.stdout and exc.stderr from a TimeoutExpired exception will be strings or None. The complex type checking and decoding logic for these attributes can be simplified.

Additionally, exc.output is an alias for exc.stdout, making the conditional assignment on line 450 redundant.

Suggested change
stdout = exc.stdout if exc.stdout is not None else exc.output
stderr = exc.stderr
if isinstance(stdout, bytes):
stdout = stdout.decode(errors="replace")
elif stdout is None:
stdout = ""
else:
stdout = str(stdout)
if isinstance(stderr, bytes):
stderr = stderr.decode(errors="replace")
elif stderr is None:
stderr = ""
else:
stderr = str(stderr)
stdout = exc.stdout or ""
stderr = exc.stderr or ""

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.

1 participant