ZhuLinsen/daily_stock_analysis · error · CodexAppServerError

capability_unsupported

capability_unsupported

Error message

Codex App Server Agent is not supported on native Windows in this phase

What it means

resolve_command() refuses to build the App Server argv on native Windows: is_native_windows() is true. The transport relies on POSIX facilities (process groups via setsid, os.set_blocking, select on pipes, signal semantics) that are not available on native Windows 'in this phase', so it fails fast with code 'capability_unsupported'.

Source

Thrown at src/agent/codex_app_server_transport.py:1057

                if process.poll() is None:
                    try:
                        process.wait(timeout=max(0.0, kill_deadline - time.monotonic()))
                    except subprocess.TimeoutExpired:
                        pass
                while _process_group_alive(process_group_id) and time.monotonic() < kill_deadline:
                    time.sleep(0.02)

            if process.poll() is None or _process_group_alive(process_group_id):
                raise CodexAppServerError(
                    "resource_cleanup_failed",
                    "Codex App Server process group could not be reclaimed",
                )


def resolve_command(executable: str = "codex") -> list[str]:
    """Resolve the fixed App Server argv and least-privilege overrides."""
    if is_native_windows():
        raise CodexAppServerError(
            "capability_unsupported",
            "Codex App Server Agent is not supported on native Windows in this phase",
        )
    resolved = shutil.which(executable)
    if resolved is None:
        raise CodexAppServerError("command_not_found", "Codex executable was not found")
    command = [resolved, "app-server", "--stdio"]
    for override in _BASE_CONFIG_OVERRIDES:
        command.extend(["-c", override])
    return command


def harden_command_against_configured_mcp(
    command: Sequence[str],
    *,
    timeout: float,
    deadline: Optional[float] = None,
    cancel_event: Optional[threading.Event] = None,

View on GitHub (pinned to 5159bd72e8)

Solutions

  1. Select a different agent backend on Windows (factory/backend selection should branch on platform)
  2. Run under WSL2 where the POSIX assumptions hold, and point the executable at the Linux codex binary
  3. Gate the feature: expose backend availability so UI/config can hide it on Windows rather than crashing
  4. Track the repo's roadmap for native Windows support instead of bypassing the check

Example fix

// before: unconditional backend
transport = CodexAppServerTransport(resolve_command())

// after: platform gate
if is_native_windows():
    transport = make_default_agent_backend()  # non-codex backend
else:
    transport = CodexAppServerTransport(resolve_command())
Defensive patterns

Strategy: type-guard

Validate before calling

from src.agent.platform import is_native_windows

if is_native_windows():
    raise RuntimeError("codex app-server backend requires POSIX; use WSL")

Type guard

def codex_backend_available() -> bool:
    return not is_native_windows() and shutil.which("codex") is not None

Prevention

When it happens

Trigger: Calling resolve_command(), build_hardened_command(), or constructing CodexAppServerTransport on a Windows host (not WSL). The check happens before shutil.which, so it fires regardless of whether codex.exe exists.

Common situations: Developers on Windows machines trying the Codex App Server agent backend; CI on windows-latest runners; accidental platform drift when a config selects the codex backend unconditionally.

Related errors


AI-assisted analysis of ZhuLinsen/daily_stock_analysis@5159bd72e8 (2026-08-15). Data as JSON: /api/errors/c6e0efee3418c81b. Report an issue: GitHub.