Skip to content

Custom Engine: define internal transport interface seam before HTTP lands #51

@zpzjzj

Description

@zpzjzj

Background

engine.custom.transport: http is fully declared in the schema (internal/config/schema.go CustomHTTPConfig) and rejected at runtime with a clear "not yet implemented" error (internal/agent/custom.go::Run). The local-transport implementation, however, is currently a pile of runLocal / buildLocalExec / finishLocal / readRawResult private methods on CustomAgent, with assumptions baked in (output file on disk, stdout fallback, artifact paths in workspace).

When HTTP lands, those assumptions don't translate:

  • Result format negotiation: HTTP body vs file read.
  • Artifact handling: HTTP file downloads with retry vs local filesystem reads.
  • Streaming responses.
  • Retry / circuit-breaker policies.

Proposal

Introduce an internal transport interface inside the agent package:

type customTransport interface {
    Run(ctx context.Context, opts ExecOptions, vars map[string]string, sess *SessionInput) (rawResult string, execErr error, artifactSources []artifactSource)
}

Move the existing runLocal body behind a localTransport struct that satisfies this. CustomAgent.Run dispatches to the right transport without further branching.

Outcome: HTTP gains a parallel httpTransport that drops in without rewriting finishLocal.

Why this is a follow-up, not a blocker

Doing it now would be premature — we don't yet know HTTP's real shape. Doing it just before HTTP implementation begins is the sweet spot.

Origin

Raised during the self code-review of feat/custom-engine-local (architecture finding #3).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions