Repository navigation
fix(email): reject --base-url instead of checking one server and using another - #4334
Conversation
…g another `gaia email --base-url <url>` health-checked the given server, then ran the query on whatever Lemonade the daemon's email sidecar was already using. The query contract has no server field, so the flag can't reach the agent; it now exits 2 and tells the user to restart the daemon with LEMONADE_BASE_URL set, which the email agent already honours. Fixes amd#4312
|
Approve with suggestions This makes One gap worth closing before merge: the guard only catches the flag when it comes after Smaller thing: Real-world evidenceNo 🔍 Technical detailsIssues found 🟡 The guard misses
So If you'd rather not scan 🟢 🟢 Verified as correct
Strengths
|
The flag is declared on both the top-level parser and parent_parser. argparse parses a subcommand into a fresh namespace and copies every key back over the parent's, so parent_parser's default=None erased a value given before the subcommand: 'gaia --base-url X email -q hi' parsed to base_url=None. For 'gaia email' that meant the new amd#4312 rejection never fired in that order -- the query ran on the daemon's server with no warning, the exact silent surprise the guard exists to prevent. SUPPRESS keeps the key out of the subparser's namespace so the top-level value survives, fixing the same silent-ignore for every command that inherits parent_parser.
|
Reproduced the gap and fixed it at the cause rather than in the email handler.
The existing rejection test is now parametrized over all three positions (after the subcommand, before it, and
🔍 Technical detailsCause: Fix: Verified against the real parser across both orders, including the nested case (
Not addressed (🟢): |
# Conflicts: # docs/reference/cli.mdx # src/gaia/cli.py
gaia email --base-url <url>used to health-check the given Lemonade server and then triage on a different one: whatever the daemon's email sidecar was already using. So users pointing email at another server got a passing check and requests to the wrong place. The flag now fails with exit 2 and says what works: restart the daemon withLEMONADE_BASE_URLset. The email agent already honours that variable.Rejecting the flag was one of the two options in the issue. Wiring it through would mean adding a per-request server field to the frozen sidecar query contract, and letting any daemon client repoint the email agent's inference. That's a design decision, so this PR doesn't make it.
Overlaps:
emailas accepting--base-url. With this PR it's still accepted at parse time and then rejected in the handler, so that table needs a note if both merge.gaia emailoptions table. Expect a trivial doc conflict there.Test plan
python -m pytest tests/unit/test_email_cli.py -q: the new test fails onmain(1 failed, 3 passed) and passes on this branch (4 passed)python -m pytest tests/unit/cli tests/unit/test_email_cli.py tests/unit/test_email_autonomy_cli.py tests/unit/test_amd_gaia_urls.py tests/unit/test_email_sidecar_relay.py -q: 348 passed, 7 skippedgaia email --base-url http://x:1/api/v1 -q hiexits 2 with the guidance, and no daemon or Lemonade call is madesrc/gaia/cli.py;python util/check_doc_links.py --internal-onlyFixes #4312