Skip to content

Emit a default-Copilot-configuration signal in lock file metadata #49990

Description

@salmanmkc

Summary

The compiled lock file metadata (# gh-aw-metadata:) captures agent_id, schema_version, strict, agent_model, etc., but does not capture whether the Copilot engine is using the default GitHub configuration versus a custom provider / base URL / API target (BYOK).

Consumers of the compiled workflow (telemetry, dashboards, reporting) that want to classify "default Copilot config" runs versus custom-routed runs currently have to infer this from the compiled step env:, which is fragile:

  • A custom engine.api-target is not visible in the step env at all — the host is embedded in the AWF config JSON inside the execution step's run: script, so env-based inference misses it entirely.
  • GITHUB_COPILOT_BASE_URL also appears as a passthrough on the DIFC integrity-proxy step (via writeProxyUpstreamEnv) even for otherwise-default configurations, so naive "scan every step's env" inference produces false positives.
  • Any env-based inference is coupled to the compiled step structure (step ids, which keys land where) and can silently drift when the compiler changes.

gh-aw already computes the authoritative answer at compile time, so it would be much more robust to surface it directly in the metadata.

Proposal

Add a boolean field to LockMetadata (e.g. engine_base_url_customized / copilot_default_config) populated from a shared predicate combining the signals the compiler already derives:

  • isBYOKModeCOPILOT_PROVIDER_BASE_URL present in engine.env, or a non-GitHub engine.model-provider gateway.
  • A non-empty GetCopilotAPITarget(...) — covers engine.api-target and a literal GITHUB_COPILOT_BASE_URL override.

Emit it in generateWorkflowHeader alongside the existing agent metadata.

Implementation pointers

  • pkg/workflow/lock_schema.goLockMetadata, AgentMetadataInfo, GenerateLockMetadata (add the field; bump schema version if desired — the field is additive/omitempty so older consumers ignore it).
  • pkg/workflow/compiler_yaml_header.gogenerateWorkflowHeader (populate the field; it already holds data / WorkflowData).
  • pkg/workflow/copilot_engine_execution.goisBYOKMode is currently inline; consider extracting a shared isCopilotBYOK/isCopilotDefaultConfig helper so the metadata value can't drift from the actual routing logic.
  • pkg/workflow/engine_api_targets.goGetCopilotAPITarget.
  • Tests: pkg/workflow/lock_schema_test.go (TestGenerateLockMetadata*, TestLockMetadataToJSON), plus BYOK/api-target cases modeled on existing copilot_engine_test.go / engine_api_targets tests.

Benefit

Gives downstream consumers a single authoritative, drift-free signal that covers BYOK (model-provider + explicit engine.env) and engine.api-target, instead of fragile per-step env inference that cannot see api-target and is coupled to compiled output structure.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions