Skip to content

refactor(runtime): replace TargetGOOS with shell descriptor#145

Merged
zpzjzj merged 1 commit into
mainfrom
refactor/runtime-shell
Jul 14, 2026
Merged

refactor(runtime): replace TargetGOOS with shell descriptor#145
zpzjzj merged 1 commit into
mainfrom
refactor/runtime-shell

Conversation

@zpzjzj

@zpzjzj zpzjzj commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • replace Runtime.TargetGOOS() with a validated Runtime.Shell() target descriptor
  • separate the pure target shell grammar from the host process launcher so remote/container runtimes never consult platform.Host()
  • route agent bash requirements and script-judge quoting/interpreter selection through the runtime target shell
  • add deterministic coverage for Linux POSIX, Windows cmd, Windows Git Bash, and host/target shell separation

Design note

Issue #44 proposed returning platform.HostShell from runtimes. This PR keeps the same single-channel architecture but refines the boundary: Runtime.Shell() returns pure target data (GOOS, shell family, optional BashPath), while HostShell retains the host-only exec.Cmd launcher and environment. Docker and OpenSandbox therefore describe their Linux/POSIX guest without carrying meaningless host process callbacks.

OpenSandbox Windows guest provisioning remains out of scope and blocked on its SDK platform field. Once available, #45 can return the requested Windows target descriptor from OpenSandboxRuntime.Shell().

Verification

  • make verify
  • make test
  • GOOS=windows go build ./...
  • go test -tags e2e -run 'Test(Pipeline_ScriptJudge|Contract_Judge_Script_ExitCode0_Pass)$' ./e2e
  • confirmed no TargetGOOS references remain

Closes #44.
Refs #45.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors how skill-up models the target execution environment by replacing Runtime.TargetGOOS() with a validated Runtime.Shell() descriptor (platform.Shell). This consolidates target OS + shell semantics into a single channel so planners/judges/agents don’t accidentally consult the host shell when the runtime target differs (e.g., container/remote runtimes).

Changes:

  • Replace Runtime.TargetGOOS() with Runtime.Shell() platform.Shell and validate shell descriptors during runtime construction.
  • Route script-judge planning (interpreter/quoting/cleanup) through the runtime’s target shell descriptor instead of platform.Host().
  • Update agent Windows bash requirements and add deterministic tests across Linux POSIX, Windows cmd, and Windows Git Bash scenarios.

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/runtime/runtime.go Replace TargetGOOS with Shell() on the Runtime interface and validate Shell() in NewRuntime.
internal/runtime/opensandbox.go Implement Shell() for OpenSandbox as Linux/POSIX.
internal/runtime/opensandbox_test.go Add test asserting OpenSandbox runtime shell is Linux/POSIX.
internal/runtime/none.go Implement Shell() for NoneRuntime via platform.Host().Target.
internal/runtime/none_test.go Add test asserting NoneRuntime shell matches host target shell.
internal/runtime/docker.go Implement Shell() for DockerRuntime as Linux/POSIX.
internal/runtime/docker_test.go Add test asserting Docker runtime shell is Linux/POSIX.
internal/platform/shell_windows.go Refactor Windows host shell descriptor to expose Target Shell (GOOS/family/bash path).
internal/platform/shell_other.go Refactor POSIX host shell descriptor to expose Target Shell and remove HostShell quoting fields.
internal/platform/platform.go Introduce Shell, ShellFamily, validation, and target-based quoter selection.
internal/platform/platform_test.go Add validation and deterministic tests for Shell.Validate() and Shell.Quoter().
internal/judge/script.go Switch script judge planning to use rt.Shell() (target descriptor) rather than TargetGOOS.
internal/judge/script_test.go Update mock runtime to provide Shell() instead of TargetGOOS().
internal/judge/interpreter.go Refactor script planning to accept platform.Shell, validate it, and use target shell quoting.
internal/judge/interpreter_test.go Make interpreter planning tests deterministic by injecting explicit target shells.
internal/judge/helpers_test.go Update mock runtime to implement Shell().
internal/evaluator/evaluator_test.go Update evaluator mock runtime to implement Shell().
internal/agent/qwen_code.go Switch agent preflight from requireBashOnWindowsHost to requireBashTargetShell.
internal/agent/qwen_code_test.go Update test runtime to implement Shell().
internal/agent/qodercli.go Switch agent preflight from requireBashOnWindowsHost to requireBashTargetShell.
internal/agent/qodercli_test.go Update test runtime to implement Shell().
internal/agent/prompt_delivery_test.go Update test runtime to implement Shell().
internal/agent/node_install_test.go Update test runtime to implement Shell().
internal/agent/codex.go Switch agent preflight from requireBashOnWindowsHost to requireBashTargetShell.
internal/agent/codex_test.go Update test runtime to implement Shell().
internal/agent/cli.go Update agent checks to use rt.Shell().GOOS and requireBashTargetShell.
internal/agent/claude_code.go Switch agent preflight from requireBashOnWindowsHost to requireBashTargetShell.
internal/agent/claude_code_test.go Update test runtime to implement Shell().
internal/agent/agent.go Replace host-derived bash requirement with target-shell validation (requireBashTargetShell).
internal/agent/agent_test.go Add tests covering requireBashTargetShell across Linux POSIX / Windows cmd / Windows bash descriptors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/agent/agent.go
Comment thread internal/judge/interpreter.go
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: dfaa69f683

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@roark47 roark47 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zpzjzj zpzjzj added this pull request to the merge queue Jul 14, 2026
Merged via the queue into main with commit 90c7f9e Jul 14, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in skill-up project Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Architecture: fold TargetGOOS into a Runtime.Shell() abstraction

3 participants