#23139: test: fix flaky auth tests when OPENCLAW_GATEWAY_TOKEN is present
channel: msteams
gateway
commands
agents
size: S
Running `pnpm test` locally with `OPENCLAW_GATEWAY_TOKEN` set causes `src/gateway/server-runtime-config.test.ts` and `src/browser/server.post-tabs-open-profile-unknown-returns-404.test.ts` to fail because they don't isolate their environment properly. This clears the token in `beforeEach` and restores it in `afterEach` for these specific suites.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixes flaky auth tests by properly isolating `OPENCLAW_GATEWAY_TOKEN` and `OPENCLAW_GATEWAY_PASSWORD` environment variables in test suites. The PR bundles several unrelated changes including Gemini 3.1 model support, markdownlint config updates, Windows long path detection improvements, and formatting fixes.
<h3>Confidence Score: 4/5</h3>
- Safe to merge with minor concerns about bundling unrelated changes
- The core test isolation fix is correct and necessary. The bundled changes (Gemini 3.1 support, markdownlint config, path detection) appear sound but violate the repository's guideline to avoid bundling unrelated changes in a single PR. The `@ts-ignore` additions are justified but go against the coding style preference to avoid `@ts-nocheck`/ignores when possible.
- No files require special attention - all changes are straightforward
<sub>Last reviewed commit: 2493b67</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#19885: test(gateway,browser): isolate tests from ambient OPENCLAW_GATEWAY_...
by NewdlDewdl · 2026-02-18
86.6%
#19937: fix(gateway): validate token/password auth modes and isolate gatewa...
by NewdlDewdl · 2026-02-18
83.0%
#16658: test: isolate env-dependent gateway/auth fixtures
by sauerdaniel · 2026-02-15
81.5%
#23055: test: clear gateway env vars in beforeEach to prevent leakage
by thinstripe · 2026-02-21
79.8%
#13881: fix: Address Greptile feedback - test isolation and channel resolution
by trevorgordon981 · 2026-02-11
79.2%
#7085: test: skip flaky workspace-paths & safe-bins tests on non-Linux/CI ...
by ThinkIbrokeIt · 2026-02-02
79.2%
#17912: fix: configure git to use HTTPS instead of SSH for GitHub URLs
by MisterGuy420 · 2026-02-16
78.5%
#7781: fix: resolve Google Gemini CLI auth credential extraction #4585
by ManojPanda3 · 2026-02-03
77.8%
#11048: fix: address repository issues (env, author, CI comments, security ...
by cavula · 2026-02-07
77.6%
#22658: Fix onboard ignoring OPENCLAW_GATEWAY_TOKEN env var
by Clawborn · 2026-02-21
77.4%