Skip to content

fix(supervisor): reject at startup an --envoy-arg that repeats a flag the supervisor sets (#1375, #1376) - #1399

Merged
bpalermo merged 3 commits into
mainfrom
fix/supervisor-reserved-envoy-args
Oct 8, 2026
Merged

bpalermo merged 3 commits into
mainfrom
fix/supervisor-reserved-envoy-args

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Closes #1375
Closes #1376

The problem

The supervisor passes some Envoy flags itself on every fork. The pinned Envoy refuses a flag given twice (PARSE ERROR: Argument: (--base-id) Argument already set!). So an --envoy-arg that repeated one of them passed the startup check and then failed every fork. Only --admin-address-path was refused at startup.

What changed

  • One list. agent/internal/proxy/hotrestart/envoyargs.go holds the flags the supervisor passes, as constants, and a table reservedEnvoyFlags with what owns each one. buildEnvoyCmd and the --mode validate run now build their command lines from the same constants.
  • hotrestart.CheckExtraArgs refuses each reserved flag in --envoy-arg, in the --flag value and the --flag=value spellings. The error names the flag and the supervisor option or chart value to change instead. supervisorcmd.checkEnvoyArgs calls it at startup, as before.
  • Reserved flags: -c / --config-path, --base-id, --restart-epoch, --drain-time-s, --parent-shutdown-time-s, --admin-address-path, and --mode. --mode is on the list because the supervisor passes --mode validate when it checks a changed bootstrap.
  • --concurrency stays allowed once. The chart passes it for proxy.concurrency. A second --concurrency is refused at startup with an error that names proxy.concurrency.
  • supervisor: a comment says Envoy keeps the last --concurrency; the pinned Envoy refuses a repeated flag #1375. concurrencyArg used to return the last of several --concurrency values, and its comment said Envoy's parser keeps the last. It does not. concurrencyArg now returns an error for a repeat (errRepeatedConcurrency) and the comment says what Envoy does. One existing test case (--concurrency 2 --concurrency=3 gives 3) changed to expect that error.
  • Docs: docs/configuration.md lists the reserved flags; docs/runbook.md points to it; the --envoy-arg help text says the same.

Nothing under charts/ changed. No dependency was added.

The drift guard

TestEveryFlagTheSupervisorPassesIsReserved reads the flags off the command lines the supervisor really builds and requires CheckExtraArgs to refuse each one. TestReservedFlagsAreAllPassedOrAliases checks the other direction. I removed the --restart-epoch entry from the table as a temporary mutation: both tests failed, then passed again with the entry back.

Measured

  • Pinned Envoy parser (the binary //agent/test/envoybin:envoy_bin extracts, run with --mode validate): each of --concurrency, --base-id, -c, -c plus --config-path, --mode, --restart-epoch, --drain-time-s, --parent-shutdown-time-s, --admin-address-path given twice answers Argument already set!.
  • Red, then green. The new tests in agent/internal/supervisorcmd/flags_test.go ran first against the unchanged check: 21 of the 24 flag/spelling subtests failed (the 3 for --admin-address-path already passed), all 8 duplicate---concurrency subtests failed, and the chart test failed on its control. All pass with the change.
  • Chart. TestChartEnvoyArgsPassTheCheck (new, committed) takes every --envoy-arg item in the DaemonSet template, all conditional branches at once, through the check. By hand, I also rendered charts/aether with helm template twice and ran the proxy container's --envoy-arg list through checkEnvoyArgs in a temporary test (not committed):
    • default values: -l info --service-cluster aether-proxy --service-node $(NODE_NAME) --service-zone $(ZONE) --drain-strategy gradual — accepted;
    • proxy.concurrency=2, proxy.hotRestart.{baseId=3,drainTime=20s,parentShutdownTime=30s,skipParentStats=true,hotRestartOnConcurrencyChange=true}, proxy.logLevel=debug, otel.endpoint set: the same plus --concurrency 2 --skip-hot-restart-parent-stats — accepted.
  • bazel test //agent/internal/supervisorcmd:all //agent/internal/proxy/hotrestart:all //agent/cmd/proxy-supervisor:all passes, including deps_test. scripts/check-proxy-supervisor-deps.sh passes. The two touched go_test targets pass under --config=race. The lint build with fail_on_violation and make format-check pass.

Limits, and what I did not verify

  • The check compares every argument, because it does not know which Envoy flags take a value. A flag's value spelled exactly like a reserved flag (a --service-node named -c) is refused too. I judged that acceptable; it is documented on CheckExtraArgs.
  • The pinned Envoy does not accept the --flag=value spelling at all: --concurrency=2 and --base-id=3 answer Couldn't find match for argument (measured). The check refuses that spelling for reserved flags as asked. It does not refuse --concurrency=N, which concurrencyArg still parses although Envoy would reject it. I left that alone as a separate finding.
  • Not run on a cluster: no kind or talos-main run. The talos-like values above are my reading of the task, not the live release's values.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

… the supervisor sets (#1375, #1376)

The pinned Envoy refuses a flag given twice ("Argument already set!"), so an
--envoy-arg that repeated a flag the supervisor passes itself failed every
fork. Only --admin-address-path was refused at startup.

The flags now live in one table next to the code that builds the Envoy
command line (hotrestart/envoyargs.go). CheckExtraArgs refuses each of them
in ExtraArgs, in the "--flag value" and "--flag=value" spellings, with an
error naming the flag and the supervisor option or chart value that owns it:
-c/--config-path, --base-id, --restart-epoch, --drain-time-s,
--parent-shutdown-time-s, --admin-address-path, and --mode (set by the
bootstrap validation run). A test reads the flags off the command lines the
supervisor builds and fails when one is not reserved.

--concurrency stays allowed (the chart passes it for proxy.concurrency), but
a second one is refused the same way. concurrencyArg no longer returns the
last of several values: Envoy never keeps the last, so it now returns an
error, and the comment that said otherwise is corrected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Copilot AI balanced review requested due to automatic review settings October 8, 2026 11:01

Copilot AI 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.

🟡 Changes recommended

Adjacent repeated --concurrency arguments can still bypass startup validation and cause every Envoy fork to fail.

1 open finding
What changed in this PR

Adds supervisor startup checks for conflicting Envoy arguments, addressing #1375 and #1376 before failures reach proxy launches.

Changes:

  • Centralizes supervisor-owned Envoy flags and rejects conflicting extra arguments.
  • Rejects repeated --concurrency settings.
  • Adds regression tests, drift guards, and operator documentation.
File Description
docs/​runbook.md Links to reserved-flag documentation.
docs/​configuration.md Documents startup argument restrictions.
agent/​internal/​supervisorcmd/​supervisor.go Delegates validation and updates flag help.
agent/​internal/​supervisorcmd/​flags_test.go Tests startup checks and chart arguments.
agent/​internal/​proxy/​hotrestart/​supervisor.go Shares flag constants across command construction.
agent/​internal/​proxy/​hotrestart/​envoyargs.go Defines reserved flags and validation.
agent/​internal/​proxy/​hotrestart/​envoyargs_test.go Adds validation tests and drift guards.
agent/​internal/​proxy/​hotrestart/​concurrencychange.go Detects repeated concurrency settings.
agent/​internal/​proxy/​hotrestart/​concurrencychange_test.go Updates concurrency parsing coverage.
agent/​internal/​proxy/​hotrestart/​BUILD.bazel Registers new source and test files.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

…be as a repeat

concurrencyArg skipped the argument after "--concurrency" as its value, so
"--concurrency --concurrency 2" and "--concurrency --concurrency=4" were a bad
value, not a repeat, and the startup check let them through. The value is now
read without being skipped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Copilot AI 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.

🟢 Approval recommended

The focused changes address the reported failures with regression coverage and no unresolved blocking findings.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 11:12

Copilot AI 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.

🟢 Approval recommended

The focused duplicate-flag changes preserve command construction and have targeted regression coverage, with no identified new blocking defect.

0 open findings

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@bpalermo
bpalermo merged commit 4401b6c into main Oct 8, 2026
31 checks passed
@bpalermo
bpalermo deleted the fix/supervisor-reserved-envoy-args branch October 8, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants