Skip to content

test: isolate Gateway reload and Gemini auth fixtures - #131625

Merged
steipete merged 2 commits into
mainfrom
steipete/fix-stale-gateway-tests
Aug 28, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/fix-stale-gateway-tests

Conversation

@steipete

@steipete steipete commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves two Gateway reload test-fixture failures found while verifying the current-main missing-export repair, and preserves this PR's existing host-independent Gemini fixture repair. This is explicitly maintainer-requested broken-main repair and bounded sibling cleanup.

The missing-export repair itself landed concurrently in #131627 as 871b18dff5039484e86c76d282699a8defcb1654. This PR has been rebased onto that canonical fix and leaves its rollback test byte-for-byte unchanged; it does not duplicate the repair.

Why This Change Was Made

The Gmail failure test emitted a restart signal without clearing its unconsumed token, causing later tests to coalesce instead of emit. It now uses the existing withGatewayRestartSignal fixture, asserts actual emission, and always stops its reloader.

The environment-publication test drained every fake timer even after all five expected service events completed. A captured callback proved the remaining timer was recurring maintenance. The test now awaits the existing config-write application receipt with real timers, supplies a valid snapshot fixture, and always stops its reloader. All event-order assertions remain; there is no timeout increase, retry, weaker assertion, new mock, or production/storage change.

The Gemini dotenv fixture captures/restores both environment variables and clears inherited GOOGLE_APPLICATION_CREDENTIALS while testing file-only resolution. The adjacent test still covers process-precedence behavior.

The canonical missing-export provenance is #131545 (code/PR author and merger @steipete) intentionally internalizing the helper, followed seven minutes later by #118157 (commit author Ayaan Gazali, PR author @ayaangazali, merger @steipete) adding a stale test import. #131627 correctly tests the exported rollback operation with the real channel manager and keeps the helper private.

User Impact

No runtime or public API change. Developers get meaningful, independent reload fixtures and deterministic dotenv-path coverage. No changelog entry is needed for these internal test repairs. No live Gateway, provider call, real credential, dependency, version, snapshot, protocol, schema, or SQLite implementation was changed.

Production LOC: +0/-0. Tests: +94/-71 (net +23) in two existing files; most churn moves existing assertions under guaranteed cleanup. No new test case or production seam.

Evidence

Fresh main 4bbb3660dfb00d54e493e917756c329573bb786b reproduced all three missing-export failures. The original shuffled Gateway trio had 6 failures / 349 tests at seed 828: three import failures and three restart-token follow-on failures. This PR's first head fixed the import but still reproduced 3 failures / 349 tests. Seed 829 independently exposed the environment-publication timer loop; that case failed alone too.

After fixture repair, the Gateway trio passes 349/349 at seeds 828 and 829, including repeat proof after rebasing onto the canonical #131627 fix:

pnpm test src/gateway/server-reload-channel-restart.test.ts src/gateway/server-reload-handlers.test.ts src/gateway/server-channels.test.ts --maxWorkers=1 --sequence.shuffle --sequence.seed=828 --reporter=verbose
pnpm test src/gateway/server-reload-channel-restart.test.ts src/gateway/server-reload-handlers.test.ts src/gateway/server-channels.test.ts --maxWorkers=1 --sequence.shuffle --sequence.seed=829 --reporter=verbose

A reversible preserveManualStop: true to false owner fault failed all three rollback cases; production bytes were restored exactly. The environment-publication case passes alone using its application receipt, retaining all five service-order assertions.

The Gemini dotenv case failed on unmodified main with a synthetic inherited path. Both backend auth and isolated-completion files pass 46 tests with the same synthetic input:

GOOGLE_APPLICATION_CREDENTIALS=/tmp/openclaw-fixture-only-adc.json pnpm test extensions/google/cli-backend-auth.test.ts extensions/google/cli-backend-isolated.test.ts --maxWorkers=1 --reporter=verbose

The complete changed-file gate passed for the original three-file superset: formatting, guards, all three Knip scans, core and plugin test types, and both lint lanes. Conflict resolution only removed the duplicate rollback edit; both retained file blobs exactly match the checked and reviewed version. Deslop found no additional cleanup. Fresh Codex autoreviews of the handler commit and whole-PR diff reported no actionable findings at the configured P0 threshold.

pnpm check:changed -- extensions/google/cli-backend-auth.test.ts src/gateway/server-reload-channel-restart.test.ts src/gateway/server-reload-handlers.test.ts

Candidate: 60d7cf6c6a35f7a024b0cf3c7cb5bcacf046ce65, based on 871b18dff5039484e86c76d282699a8defcb1654. The earlier CI run 33153600809 belongs to the pre-conflict head, not this candidate. Canonical repair CI 33152936793 is independently verified successful at its exact head. Final CI 33154122327 completed successfully for exact candidate 60d7cf6c6a35f7a024b0cf3c7cb5bcacf046ce65. Native review artifacts, mandatory hosted preparation, and native merge all completed without changing that head.

Proof is deterministic local test execution, not a live Gateway or Google API run. Production is unchanged. AI-assisted with Codex.

Landing verification

Merged through scripts/pr merge-run as 717cb7cb. Reconstructed the merge of actual parent 3234bb295d173a9cdcbd22ae0ec9548b07ae68b6 and reviewed head: expected and landed trees both equal 259edfd415cb5267a9cfc1c608236fc53309511c. Exactly the two intended test files changed, and both blobs match the reviewed candidate. Native worktree, temporary refs, operation lock, processes, and remote task branch are gone; unrelated worktrees/processes were preserved.

The latest ClawSweeper comment at landing was the fresh exact-head review-started notice, with no published findings or rank-up moves; it was explicitly recorded as pending, not clean, in the premerge proof. Independent autoreview and exact-head CI/native gates were complete. The visible checkout was returned to clean latest main, and the repaired three-case test passed again there.

@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime extensions: google size: XS maintainer Maintainer-authored PR labels Aug 28, 2026
@steipete
steipete marked this pull request as ready for review August 28, 2026 07:49
@steipete

Copy link
Copy Markdown
Contributor Author

Independent broken-main repair verification found this PR while checking for an in-flight fix; I am adopting this PR rather than creating a duplicate.

Fresh main 4bbb3660dfb reproduced all three missing-export failures. The rollback entrypoint here is the correct production owner, and the private helper should remain private. Shuffled sibling proof also reproduced a Gmail test that leaves an emitted restart token behind (seed 828: three additional failures). A second seed found an environment-publication test that drains a recurring maintenance timer after its expected service events already completed.

I am completing the bounded test-fixture cleanup and fresh proof on this PR: existing signal cleanup at the Gmail producer, and the existing config-write receipt for environment-publication completion. No production, SQLite, protocol, dependency, or live Gateway changes. The existing Google fixture fix will be preserved. Native review/prepare/merge and exact-head CI remain required before landing.

Make the Gemini dotenv credential-path fixture independent of process credentials and restore its environment even when preparation fails. Exercise channel rollback through its production entrypoint after the internal start helper became private, preserving manual-stop race and explicit-resume coverage.
@steipete
steipete force-pushed the steipete/fix-stale-gateway-tests branch from 516fd53 to 60d7cf6 Compare August 28, 2026 08:07
@steipete steipete changed the title fix(test): repair stale gateway-reload import and host-dependent Gemini auth fixture test: isolate Gateway reload and Gemini auth fixtures Aug 28, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Ready for native merge at 60d7cf6c6a35f7a024b0cf3c7cb5bcacf046ce65.

The canonical missing-export repair is already on main in #131627 (871b18df). This PR preserves that rollback test exactly and finishes the independently reproduced fixture cleanup. Production +0/-0; tests +94/-71. All retained assertions remain, with existing signal cleanup and config-write receipt ownership instead of leaked state or timer draining.

Fresh proof: 349/349 Gateway tests at both shuffled seeds 828 and 829 after the final conflict resolution; 46/46 Google backend auth/isolated tests with a synthetic inherited path; the complete changed-file gate passed for the byte-identical retained files. Deslop and fresh whole-PR Codex autoreview found no accepted/actionable findings at the configured P0 threshold. The PR body records failing-first and reversible owner-fault evidence and the exact test commands.

Exact-head CI 33154122327 completed successfully. Native review-init, main/PR guards, review-artifacts-init, review-validate-artifacts, and OPENCLAW_TESTBOX=1 scripts/pr prepare-run 131625 all passed. Preparation preserved the exact reviewed/tested head and reused its successful hosted gates; no gate bypass or additional Testbox allocation.

I re-read the latest ClawSweeper comment immediately before landing. It is still the current-head review-started notice, with no findings or Rank-up moves: published. That review is pending, not described as clean; fresh independent autoreview and native exact-head gates are complete. No live Gateway/Google API proof was run because this is test-only and those operations were explicitly excluded. No changelog, production, dependency, version, protocol, schema, or SQLite implementation changes.

@steipete
steipete merged commit 717cb7c into main Aug 28, 2026
115 of 116 checks passed
@steipete
steipete deleted the steipete/fix-stale-gateway-tests branch August 28, 2026 08:18
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 29, 2026
* test: repair auth isolation and channel rollback coverage

Make the Gemini dotenv credential-path fixture independent of process credentials and restore its environment even when preparation fails. Exercise channel rollback through its production entrypoint after the internal start helper became private, preserving manual-stop race and explicit-resume coverage.

* test(gateway): isolate reload completion and restart signals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: google gateway Gateway runtime maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant