Skip to content

SANDBOX-1812: add openspec for agent HTTP client - #15

Merged
fbm3307 merged 2 commits into
masterfrom
SANDBOX-1812-agent-http-client-openspec
Jul 10, 2026
Merged

SANDBOX-1812: add openspec for agent HTTP client #15
fbm3307 merged 2 commits into
masterfrom
SANDBOX-1812-agent-http-client-openspec

Conversation

@fbm3307

@fbm3307 fbm3307 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator
  • Typed HTTP client for sandbox agent API (/exec, /assign, /health)
  • Structured error hierarchy: NetworkError, StatusError, DecodeError
  • Functional options pattern for configuration (timeout, port, HTTP client)

Assisted By: Cursor

Summary by CodeRabbit

  • Documentation
    • Added design and proposal materials for a centralized, typed HTTP agent client to standardize CLI-to-sandbox communication.
    • Introduced a formal specification for request/response behavior, timeouts, and in-cluster plain-HTTP expectations.
    • Defined a structured typed error model (network, status, and decode/size issues) with truncation rules.
    • Included a full implementation task plan and test matrix for the client methods (Execute, Assign, HealthCheck).

- Add proposal, design, spec, and tasks for AgentClient
- Typed HTTP client for sandbox agent API (/exec, /assign, /health)
- Structured error hierarchy: NetworkError, StatusError, DecodeError
- Functional options pattern for configuration (timeout, port, HTTP client)

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Feny Mehta <fbm3307@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 8ee05880-abbf-4a5e-a4f5-32fe837f53af

📥 Commits

Reviewing files that changed from the base of the PR and between 3af6e1b and a8f7374.

📒 Files selected for processing (3)
  • openspec/changes/2026-07-08-agent-http-client/design.md
  • openspec/changes/2026-07-08-agent-http-client/specs/agent-client/spec.md
  • openspec/changes/2026-07-08-agent-http-client/tasks.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • codeready-toolchain/mcp-common (manual)
  • codeready-toolchain/mcp-server-devsandbox (manual)
  • codeready-toolchain/api (manual)
  • codeready-toolchain/toolchain-common (manual)
  • codeready-toolchain/host-operator (manual)
  • codeready-toolchain/toolchain-e2e (manual)
✅ Files skipped from review due to trivial changes (2)
  • openspec/changes/2026-07-08-agent-http-client/tasks.md
  • openspec/changes/2026-07-08-agent-http-client/design.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • openspec/changes/2026-07-08-agent-http-client/specs/agent-client/spec.md
📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: build-test-coverage
🧰 Additional context used
🔀 Multi-repo context codeready-toolchain/mcp-server-devsandbox, codeready-toolchain/host-operator, codeready-toolchain/toolchain-e2e, codeready-toolchain/mcp-common, codeready-toolchain/toolchain-common, codeready-toolchain/api

Linked repositories findings

codeready-toolchain/mcp-server-devsandbox [::codeready-toolchain/mcp-server-devsandbox::]

  • pkg/mcpinit/init.go:213-225 already serves GET /health and returns JSON health status with non-200 on failure. This matches the new HealthCheck contract being unauthenticated and health-only.
  • deploy/README.md:236 states all requests require Authorization: Bearer <token> for kube-rbac-proxy auth, which aligns with the spec’s bearer-token requirement for authenticated agent calls while reinforcing that HealthCheck must remain the exception.

codeready-toolchain/host-operator [::codeready-toolchain/host-operator::]

  • controllers/toolchainstatus/toolchainstatus_controller.go:49 and controllers/toolchainstatus/toolchainstatus_controller_test.go:573 reference http://registration-service/api/v1/health, not the sandbox agent contract. No direct overlap with AgentClient//exec//assign.

codeready-toolchain/toolchain-e2e [::codeready-toolchain/toolchain-e2e::]

  • test/e2e/parallel/registration_service_test.go:101 checks GET /api/v1/health on registration-service, not the sandbox agent API. No direct overlap with AgentClient//exec//assign.

codeready-toolchain/mcp-common [::codeready-toolchain/mcp-common::]

  • No matches for AgentClient, ExecRequest, ExecResponse, AssignRequest, /exec, /assign, or /health. No directly relevant shared contract found.

codeready-toolchain/toolchain-common [::codeready-toolchain/toolchain-common::]

  • Search hits were unrelated cluster/operator health checks (/healthz) and config fields. No direct agent-client consumers or shared types found.

codeready-toolchain/api [::codeready-toolchain/api::]

  • Only HealthCheckPeriod / HealthCheckTimeout config fields appeared; no agent HTTP contract references were found.

Walkthrough

This PR adds an OpenSpec change set for a new typed AgentClient HTTP API for sandbox agent communication, covering proposal, design, spec, and implementation tasks. It defines client methods, error types, configuration, concurrency, and response handling rules.

Changes

Agent HTTP Client OpenSpec

Layer / File(s) Summary
Proposal and metadata
openspec/changes/2026-07-08-agent-http-client/.openspec.yaml, openspec/changes/2026-07-08-agent-http-client/proposal.md
Adds the change-set metadata and proposal describing the new pkg/agent client, error types, capabilities, and impact.
Design decisions
openspec/changes/2026-07-08-agent-http-client/design.md
Defines the client location, options, typed error hierarchy, request/response handling, no-retry behavior, and trust-boundary assumptions.
Client API specification
openspec/changes/2026-07-08-agent-http-client/specs/agent-client/spec.md
Specifies Execute, Assign, and HealthCheck, along with configuration defaults, typed error behavior, concurrency safety, body lifecycle rules, and HTTP-only addressing.
Implementation task plan
openspec/changes/2026-07-08-agent-http-client/tasks.md
Lists the work items for typed errors, core client structure, methods, helpers, and unit tests.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: proposal

Suggested reviewers: alexeykazakov, rajivnathan

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding an openspec for the agent HTTP client.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch SANDBOX-1812-agent-http-client-openspec

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the proposal label Jul 8, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@openspec/changes/2026-07-08-agent-http-client/design.md`:
- Around line 135-140: Update the Decision 7 guidance in the AgentClient design
to reflect that successful Execute response bodies should be size-bounded before
JSON decoding, not left unlimited. In the AgentClient/ExecuteResponse handling
description, add a documented cap or streamed/limited decode strategy for large
ExecResponse.Stdout and ExecResponse.Stderr payloads, and make sure the text
clearly distinguishes this from the existing truncation behavior for StatusError
and DecodeError bodies.

In `@openspec/changes/2026-07-08-agent-http-client/tasks.md`:
- Around line 20-43: The AgentClient methods still leak response bodies on
successful requests. Update Execute, Assign, and HealthCheck to explicitly close
resp.Body on 200-paths, not just on error handling, and drain if needed before
closing to preserve connection reuse. Use the existing Execute, Assign, and
HealthCheck implementations in the agent HTTP client tasks as the place to add
the success-path cleanup alongside the current status/decoding logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: d0db0109-bc8f-4412-a6f9-48b3c4d51165

📥 Commits

Reviewing files that changed from the base of the PR and between 47d3f65 and 3af6e1b.

📒 Files selected for processing (5)
  • openspec/changes/2026-07-08-agent-http-client/.openspec.yaml
  • openspec/changes/2026-07-08-agent-http-client/design.md
  • openspec/changes/2026-07-08-agent-http-client/proposal.md
  • openspec/changes/2026-07-08-agent-http-client/specs/agent-client/spec.md
  • openspec/changes/2026-07-08-agent-http-client/tasks.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • codeready-toolchain/mcp-common (manual)
  • codeready-toolchain/mcp-server-devsandbox (manual)
  • codeready-toolchain/api (manual)
  • codeready-toolchain/toolchain-common (manual)
  • codeready-toolchain/host-operator (manual)
  • codeready-toolchain/toolchain-e2e (manual)
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: build-test-coverage
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • openspec/changes/2026-07-08-agent-http-client/proposal.md
  • openspec/changes/2026-07-08-agent-http-client/specs/agent-client/spec.md
  • openspec/changes/2026-07-08-agent-http-client/tasks.md
  • openspec/changes/2026-07-08-agent-http-client/design.md
🪛 LanguageTool
openspec/changes/2026-07-08-agent-http-client/design.md

[locale-violation] ~107-~107: The phrase ‘in future’ is British English. Did you mean: “in the future”?
Context: ...xternal-network communication is needed in future, upgrading to TLS/mTLS is a localized c...

(IN_FUTURE)

🔀 Multi-repo context codeready-toolchain/mcp-server-devsandbox, codeready-toolchain/mcp-common, codeready-toolchain/toolchain-common, codeready-toolchain/host-operator, codeready-toolchain/toolchain-e2e

Linked repositories findings

codeready-toolchain/mcp-server-devsandbox

  • pkg/mcpinit/init.go:213-225 already exposes GET /health and returns JSON {"status":"healthy"} or {"status":"unhealthy", ...} with a 503 on failure. This aligns with the new AgentClient.HealthCheck contract, so the spec’s unauthenticated health check is consistent with an existing endpoint. [::codeready-toolchain/mcp-server-devsandbox::]
  • Same file, pkg/mcpinit/init.go:205-225, shows the server’s HTTP mode is already behind a kube-rbac-proxy setup and the repo docs expect Authorization: Bearer <token> on requests. That matches the new spec’s bearer-token requirement for Execute, but it also highlights that HealthCheck must remain unauthenticated as documented. [::codeready-toolchain/mcp-server-devsandbox::]

codeready-toolchain/mcp-common

  • No matches for ExecRequest, ExecResponse, AssignRequest, AgentClient, /exec, /assign, or /health were found. I didn’t observe any consumer or shared type here that would be directly affected by the new client spec. [::codeready-toolchain/mcp-common::]

codeready-toolchain/toolchain-common

  • No matches for the agent client types/endpoints were found. The hits were unrelated health-check configuration in operator code, not the sandbox agent contract. [::codeready-toolchain/toolchain-common::]

codeready-toolchain/host-operator

  • No matches for the agent client types/endpoints were found. The only nearby hits were unrelated /api/v1/health checks and Kubernetes StatusError usage. [::codeready-toolchain/host-operator::]

codeready-toolchain/toolchain-e2e

  • No matches for the agent client types/endpoints were found. The hits were unrelated test/deploy health checks and pods/exec RBAC references. [::codeready-toolchain/toolchain-e2e::]
🔇 Additional comments (3)
openspec/changes/2026-07-08-agent-http-client/.openspec.yaml (1)

1-2: LGTM!

openspec/changes/2026-07-08-agent-http-client/proposal.md (1)

1-44: LGTM!

openspec/changes/2026-07-08-agent-http-client/specs/agent-client/spec.md (1)

1-168: LGTM!

Comment thread openspec/changes/2026-07-08-agent-http-client/design.md
Comment thread openspec/changes/2026-07-08-agent-http-client/tasks.md Outdated
- Add response body size limit for successful Execute responses in design
- Document resp.Body.Close() on all paths including success in tasks

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Feny Mehta <fbm3307@gmail.com>
@fbm3307
fbm3307 merged commit db6b095 into master Jul 10, 2026
3 of 4 checks passed
@fbm3307
fbm3307 deleted the SANDBOX-1812-agent-http-client-openspec branch July 10, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants