Repository navigation
refactor(runtime): register opencode as a stub runtime #6035
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
waynesun09
merged 4 commits into
fullsend-ai:main
from
sonupreetam:feat/opencode-runtime
Aug 12, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4d647c7
refactor(runtime): register opencode as a stub runtime
sonupreetam 3d0b4d5
refactor(runtime): address review feedback on opencode stub
sonupreetam 7f9d99a
refactor(runtime): address round-2 review feedback
sonupreetam 202e0a8
test(runtime): close test gaps from review
sonupreetam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| package runtime | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "io" | ||
| "time" | ||
|
|
||
| "github.com/fullsend-ai/fullsend/internal/sandbox" | ||
| "github.com/fullsend-ai/fullsend/internal/ui" | ||
| ) | ||
|
|
||
| // OpenCodeRuntime is a stub implementation of the Runtime and TranscriptHandler | ||
| // interfaces for the OpenCode agent runtime. All methods are no-ops or return | ||
| // not-implemented errors. Subsequent PRs will fill in stream parsing, bootstrap, | ||
| // run execution, and transcript extraction. | ||
| type OpenCodeRuntime struct{} | ||
|
|
||
| func (OpenCodeRuntime) Name() string { return "opencode" } | ||
|
|
||
| // System returns the OTEL GenAI gen_ai.system value. OpenCode is multi-provider | ||
| // (Anthropic, OpenAI, Google, etc.), so the system is the runtime itself rather | ||
| // than a single model vendor. The actual model vendor may be capturable from | ||
| // opencode's stream/export events in a future PR once the event schema is | ||
| // confirmed (see #1935). | ||
| func (OpenCodeRuntime) System() string { return "opencode" } | ||
|
|
||
| // ConfigDir returns the opencode config directory inside the sandbox. | ||
| // Provisional — verify opencode's config discovery before implementing | ||
| // Bootstrap (#1260). Consider placing config outside the agent-writable | ||
| // workspace (like Claude's /sandbox/claude-config) to prevent the agent | ||
| // from rewriting its own runtime config. | ||
| func (OpenCodeRuntime) ConfigDir() string { return sandbox.SandboxWorkspace + "/.opencode" } | ||
|
|
||
| func (OpenCodeRuntime) WorkspaceDir() string { return sandbox.SandboxWorkspace } | ||
|
|
||
| func (OpenCodeRuntime) EnvExports() []string { return nil } | ||
|
|
||
| func (OpenCodeRuntime) Bootstrap(_ BootstrapInput) error { | ||
| return fmt.Errorf("opencode runtime is not yet implemented") | ||
| } | ||
|
|
||
| func (OpenCodeRuntime) Run(_ context.Context, _ RunParams, _ *ui.Printer, _ time.Time, _ *RunMetrics) (int, error) { | ||
| return -1, fmt.Errorf("opencode runtime is not yet implemented") | ||
| } | ||
|
|
||
| func (OpenCodeRuntime) ClearIterationArtifacts(_ string) error { return nil } | ||
|
|
||
| // TranscriptHandler stub methods — return not-implemented errors for extract | ||
| // methods (to avoid silent success claims in CI logs) and no-ops for parse | ||
| // methods (which correctly indicate "nothing found"). See #1935. | ||
|
|
||
| func (OpenCodeRuntime) ExtractTranscripts(_, _, _ string) error { | ||
| return fmt.Errorf("opencode transcript extraction not implemented (see #1935)") | ||
| } | ||
|
|
||
| func (OpenCodeRuntime) ExtractDebugLog(_, _, _ string) error { | ||
| return fmt.Errorf("opencode debug log extraction not implemented (see #1935)") | ||
| } | ||
|
|
||
| func (OpenCodeRuntime) ParseTranscriptErrors(_ string) []TranscriptError { return nil } | ||
|
|
||
| func (OpenCodeRuntime) ParseTranscriptFile(_ string) (TranscriptError, bool) { | ||
| return TranscriptError{}, false | ||
| } | ||
|
|
||
| func (OpenCodeRuntime) EmitTranscriptErrors(w io.Writer, summaries []TranscriptError) { | ||
| emitTranscriptErrors(w, summaries) | ||
| } | ||
|
|
||
| // Compile-time interface assertions. | ||
| var ( | ||
| _ Runtime = OpenCodeRuntime{} | ||
| _ TranscriptHandler = OpenCodeRuntime{} | ||
| ) | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| package runtime | ||
|
|
||
| import ( | ||
| "bytes" | ||
| "context" | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/fullsend-ai/fullsend/internal/sandbox" | ||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestOpenCodeRuntimeMetadata(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| rt := OpenCodeRuntime{} | ||
| assert.Equal(t, "opencode", rt.Name()) | ||
| assert.Equal(t, "opencode", rt.System()) | ||
| assert.Equal(t, sandbox.SandboxWorkspace+"/.opencode", rt.ConfigDir()) // provisional — see ConfigDir() comment | ||
| assert.Equal(t, sandbox.SandboxWorkspace, rt.WorkspaceDir()) | ||
| assert.Nil(t, rt.EnvExports()) | ||
| } | ||
|
|
||
| func TestOpenCodeRuntimeRun_NotImplemented(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| rt := OpenCodeRuntime{} | ||
| exit, err := rt.Run(context.Background(), RunParams{}, nil, time.Now(), nil) | ||
| assert.Equal(t, -1, exit) | ||
| require.Error(t, err) | ||
| assert.Contains(t, err.Error(), "not yet implemented") | ||
| } | ||
|
|
||
| func TestOpenCodeRuntimeBootstrap_NotImplemented(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| rt := OpenCodeRuntime{} | ||
| err := rt.Bootstrap(nil) | ||
| require.Error(t, err) | ||
| assert.Contains(t, err.Error(), "not yet implemented") | ||
| } | ||
|
|
||
| func TestOpenCodeRuntimeExtractStubs_NotImplemented(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| rt := OpenCodeRuntime{} | ||
| err := rt.ExtractTranscripts("", "", "") | ||
| require.Error(t, err) | ||
| assert.Contains(t, err.Error(), "#1935") | ||
|
|
||
| err = rt.ExtractDebugLog("", "", "") | ||
| require.Error(t, err) | ||
| assert.Contains(t, err.Error(), "#1935") | ||
| } | ||
|
|
||
| func TestOpenCodeRuntimeNoopMethods(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| rt := OpenCodeRuntime{} | ||
| assert.Nil(t, rt.ParseTranscriptErrors("")) | ||
| assert.NoError(t, rt.ClearIterationArtifacts("")) | ||
|
|
||
| te, ok := rt.ParseTranscriptFile("") | ||
| assert.False(t, ok) | ||
| assert.Equal(t, TranscriptError{}, te) | ||
|
|
||
| var buf bytes.Buffer | ||
| rt.EmitTranscriptErrors(&buf, nil) | ||
| } |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.