-
Notifications
You must be signed in to change notification settings - Fork 322
feat: Expose MCP gateway keepalive_interval in workflow config schema #24219
Description
Summary
gh-aw-mcpg#3079 adds a keepalive_interval setting to the MCP gateway config that sends periodic pings to HTTP MCP backends, preventing session expiry during long-running agent tasks. This fixes the safeoutputs session timeout bug (gh-aw#23153).
However, there is currently no way for workflow authors to control this setting — it is a gateway-level config (GatewayConfig.keepalive_interval) that gh-aw passes via stdin JSON when launching the gateway. Workflow frontmatter has no corresponding field.
What needs to change
-
Add
keepalive-intervalto the gateway config schema that gh-aw generates when launching the MCP gateway, so it can be set per-repo or per-workflow -
Expose it in the appropriate config layer — either:
- A repo-level setting (e.g., in
.github/aw/config.ymlor similar) — most likely, since this is an infrastructure concern not a per-workflow concern - Or a workflow frontmatter field (e.g., under
gateway:ormcp:) — if per-workflow control is desired
- A repo-level setting (e.g., in
-
Pass it through to the stdin JSON config that gh-aw sends to the gateway on startup:
{ "gateway": { "keepaliveInterval": 1500 } }
Accepted values (from gh-aw-mcpg#3079)
| Value | Behavior |
|---|---|
unset / 0 |
Default: 1500 seconds (25 minutes) |
> 0 |
Custom keepalive interval in seconds |
-1 |
Disable keepalive pings entirely |
Note: 0 is treated as "unset" and silently defaulted to 1500 due to Go zero-value semantics in the gateway. A comment has been left on gh-aw-mcpg#3079 suggesting pointer semantics to make 0 mean "disabled" instead of requiring the -1 sentinel.
Use cases
- Long-running autoloop workflows (ML training, large builds): default 25-min keepalive is correct, no change needed
- Short-lived workflows with external session management: may want to disable keepalive (
-1) - Custom backends with different idle timeouts: may need shorter intervals (e.g., 300 seconds for a 10-min timeout)
References
- MCP gateway PR: fix: prevent safeoutputs session expiry during long-running agent tasks gh-aw-mcpg#3079
- Session expiry bug: MCP gateway drops out in long running jobs: Streamable HTTP error: Error POSTing to endpoint: session not found #23153
- Detailed reproduction: MCP gateway drops out in long running jobs: Streamable HTTP error: Error POSTing to endpoint: session not found #23153 (comment by @insop)