feat: Switchyard OpenCode integration#2080
Open
drifold wants to merge 3 commits into
Open
Conversation
Adds opencode_source='opencode': runs upstream opencode headless with an opencode.json provider pointed at Switchyard (no fork), captures the session tree via opencode's native correlation headers (X-Session-Id / x-parent-session-id), and reconstructs root and subagent rollouts from the retrieved sessions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: drifold <drifold@nvidia.com>
…mparison OpenCode re-serializes tool-call arguments differently across turns (compact vs. pretty-printed JSON), which failed the message-history extension check even though the tokens were contiguous. Canonicalize arguments for the comparison only; reconstructed training items keep the model's original arguments. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: drifold <drifold@nvidia.com>
…system-prompt instructions Signed-off-by: drifold <drifold@nvidia.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.
Stacked on #2026 (base:
feature/switchyard-openhands-integration). Adds upstream opencode as a second harness for the Switchyard token-capture integration — same zero-fork principle as the OpenHands path.What
opencode run) with anopencode.jsonprovider pointed at Switchyard — no fork, no harness modification.X-Session-Idper (sub)agent session,x-parent-session-idlinking subagents to the root.subagent_trajectories.Zero-fork architecture
opencode.jsonprovider id is deliberately notopencode-prefixed — opencode only emits its native correlation headers for non-opencodeproviders; those headers are the whole capture contract.GET /v1/sessions(no harness logs read).Activation and safety
opencode_sourceabsent /nv-opencodemask_sample: true,switchyard_trace_errorsetChanges
responses_api_agents/swe_agents/app.py—opencode_sourceconfig,_opencode_switchyard_config(provider JSON), the opencode run command,_list_switchyard_sessions/_reconstruct_switchyard_sessions, title-gen filtering, task_id steering via system-prompt instructions (works around an opencodetask-tool crash on model-inventedtask_ids; upstream fix being filed).nemo_gym/switchyard_trace.py— canonicalize tool-call arguments for the history-extension comparison only (opencode re-serializes compact vs. pretty-printed JSON across turns); reconstructed items keep the model's original arguments.test_app.pyandtest_switchyard_trace.py.Dependencies
Requires the Switchyard side on NVIDIA-NeMo/Switchyard#63:
7b33c2c(native X-Session-Id capture),be0b2c5(parent session id +GET /v1/sessions).Testing
swe_agentsandswitchyard_tracesuites.🤖 Generated with Claude Code