-
Notifications
You must be signed in to change notification settings - Fork 430
Expose AWF platform.type via sandbox.agent.platform frontmatter
#40877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9eed06b
22a45e0
192ea8b
ca59d4e
caf390d
18f2d82
c723081
3d1c815
ce9c361
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,6 +162,9 @@ type AWFConfigFile struct { | |
| // Network contains network egress control configuration. | ||
| Network *AWFNetworkConfig `json:"network,omitempty"` | ||
|
|
||
| // Platform contains GitHub deployment metadata used by AWF auth handling. | ||
| Platform *AWFPlatformConfig `json:"platform,omitempty"` | ||
|
|
||
| // APIProxy contains API proxy (LLM gateway) configuration. | ||
| APIProxy *AWFAPIProxyConfig `json:"apiProxy,omitempty"` | ||
|
|
||
|
|
@@ -186,6 +189,12 @@ type AWFNetworkConfig struct { | |
| BlockDomains []string `json:"blockDomains,omitempty"` | ||
| } | ||
|
|
||
| // AWFPlatformConfig is the "platform" section of the AWF config file. | ||
| type AWFPlatformConfig struct { | ||
| // Type is the GitHub deployment type consumed by AWF for auth behavior. | ||
| Type string `json:"type,omitempty"` | ||
| } | ||
|
|
||
| // AWFAPIProxyConfig is the "apiProxy" section of the AWF config file. | ||
| // It maps to the --enable-api-proxy and --*-api-target CLI flags. | ||
| type AWFAPIProxyConfig struct { | ||
|
|
@@ -352,6 +361,11 @@ func BuildAWFConfigJSON(config AWFCommandConfig) (string, error) { | |
| } | ||
| } | ||
|
|
||
| if platformType := extractPlatformType(config.WorkflowData); platformType != "" { | ||
| awfConfig.Platform = &AWFPlatformConfig{Type: platformType} | ||
| awfConfigLog.Printf("Platform section: type=%s", platformType) | ||
| } | ||
|
|
||
| // ── API proxy section ───────────────────────────────────────────────────── | ||
| // maxAICredits is taken from frontmatter/imports only; when unset (0) the | ||
| // runtime value is resolved from vars.GH_AW_DEFAULT_MAX_AI_CREDITS via a | ||
|
|
@@ -517,6 +531,21 @@ func extractModelMultipliers(workflowData *WorkflowData) map[string]float64 { | |
| return workflowData.EngineConfig.TokenWeights.Multipliers | ||
| } | ||
|
|
||
| // extractPlatformType returns sandbox.agent.platform only for enabled AWF sandbox | ||
| // agents, or an empty string to let AWF fall back to its default platform logic. | ||
| func extractPlatformType(workflowData *WorkflowData) string { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice helper. Consider adding a short doc comment on |
||
| if workflowData == nil || workflowData.SandboxConfig == nil || workflowData.SandboxConfig.Agent == nil { | ||
| return "" | ||
| } | ||
| if workflowData.SandboxConfig.Agent.Disabled { | ||
| return "" | ||
| } | ||
| if !isSupportedSandboxType(getAgentType(workflowData.SandboxConfig.Agent)) { | ||
| return "" | ||
| } | ||
| return workflowData.SandboxConfig.Agent.Platform | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The 💡 Details and suggested test
Add a subtest in t.Run("platform config is omitted when sandbox agent is disabled", func(t *testing.T) {
config := AWFCommandConfig{
EngineName: "copilot",
AllowedDomains: "github.com",
WorkflowData: &WorkflowData{
EngineConfig: &EngineConfig{ID: "copilot"},
NetworkPermissions: &NetworkPermissions{
Firewall: &FirewallConfig{Enabled: true},
},
SandboxConfig: &SandboxConfig{
Agent: &AgentSandboxConfig{
Type: SandboxTypeAWF,
Platform: "ghes",
Disabled: true,
},
},
},
}
jsonStr, err := BuildAWFConfigJSON(config)
require.NoError(t, err)
assert.NotContains(t, jsonStr, `"platform":`, "platform should be absent when sandbox agent is disabled")
}) |
||
| } | ||
|
Copilot marked this conversation as resolved.
|
||
|
|
||
| // extractModelFallback returns an AWFModelFallbackConfig if the workflow has configured | ||
| // sandbox.agent.model-fallback, or nil if the field is absent (letting AWF use its default). | ||
| func extractModelFallback(workflowData *WorkflowData) *AWFModelFallbackConfig { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.