Skip to content

Weekly agent sandbox: compiled CLI can't traverse TLS-intercepting proxy — curl fallback shipped, CLI/MCP follow-ups #2163

Description

@zachdunn

Context

The weekly scheduled maintenance routine (a sandboxed cloud agent) runs behind a TLS-intercepting egress proxy. The compiled releases CLI (a bun build --compile binary) cannot complete API requests there:

  • Environment verified: CLI 0.73.0 (bun 1.3.13, linux-x64); proxy CA readable at /root/.ccr/ca-bundle.crt.
  • Setting NODE_EXTRA_CA_CERTS / SSL_CERT_FILE / NODE_USE_SYSTEM_CA=1 does not fix it. The error is socket connection was closed unexpectedly, not a cert-verification code — so Bun's native HTTP client is failing before the CA env vars are consulted, and the CLI's cert-error hint never fires.
  • curl works in the same sandbox (uses the system CA store / honors the proxy), and the agent runtime's own HTTP stack works (which is why MCP works there).
  • The npm launcher (npm/releases/bin/releases) is a clean env pass-through (execFileSync(bin, args, { stdio: "inherit" }), no env: override), so env-var inheritance is not the cause — the failure is inside Bun's linux-x64 compiled fetch.

Shipped (unblocks the weekly routine now)

A curl-to-REST fallback was added to the maintenance skills, since every CLI command is a thin wrapper over an existing admin REST route:

  • regenerating-overviews → new "Running without the CLI (curl fallback)" section: overview inputs (GET /v1/orgs/:slug/overview/inputs), generate, overview update (POST /v1/orgs/:slug/overview), plus the plan manifest (GET /v1/admin/overviews?format=plan). Handles the --max-content-chars client-side-clipping nuance via a file + jq.
  • maintaining-orgs → pointer to the fallback; documents that admin source fetch has no curl equivalent yet.

Remaining

  • Diagnose A vs B (in the scheduled agent's sandbox): run env | grep -iE 'proxy|ccr|cert|ssl' and curl -v https://api.releases.sh/v1/health. If an HTTP(S)_PROXY var / CONNECT tunnel is present → it's a proxy-routing issue; otherwise a TLS-handshake issue with the intercept cert.
  • CLI Bun fix (repo: buildinternet/releases-cli): depending on A/B — bump the release-CI Bun pin (1.3.13 in release.yml/test.yml) and rebuild, and/or have apiFetch explicitly read HTTPS_PROXY/HTTP_PROXY and pass Bun's { proxy } option to fetch (Bun's fetch supports both the option and the env vars). Low-risk belt-and-suspenders regardless of A/B.
  • MCP admin-surface decision — the remote MCP server is a read-only public catalog and does not expose overview plan/inputs/update as tools. Deciding whether to add write-scoped MCP tools for orchestrator maintenance (running into USER_API_KEY_MAX_SCOPE = read — needs a relk_/root principal, not a relu_ user key) is a deliberate product call, not a reflexive fix. Track the yes/no here before building.
  • admin source fetch curl fallback for maintaining-orgs — it dispatches a managed update run and polls (--wait), not a single REST call, so the sandbox currently skips the fetch and regenerates from indexed data. Document the fetch-trigger REST path (workflow dispatch + status poll) so the sandbox can pre-fetch too.
  • Confirm the scheduled agent's principal — the overview write needs write scope under any path (CLI-fixed or MCP). Verify the sandbox holds the root RELEASES_API_KEY or a relk_ write/admin token.

Decision recorded

For the weekly routine, MCP + curl-to-REST is the correct channel given the sandbox constraint (the agent runtime trusts the intercept CA; the standalone Bun binary doesn't). The CLI Bun fix is the durable improvement; the MCP admin tools are an optional, separate expansion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcli

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions