fix(gateway): isolate gmail watcher restart and abort handling#82395
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d940579a14
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. Source inspection shows current main starts Gmail/Tailscale setup without an abort signal, and the PR body provides a runtime probe that exercises the cancellation path with local command shims. Real behavior proof Next step before merge Security Review detailsBest possible solution: Land a reviewed version that keeps cancellation in the gateway/Gmail owner paths, preserves abort exit semantics in the shared process helper, and retains focused regression coverage. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main starts Gmail/Tailscale setup without an abort signal, and the PR body provides a runtime probe that exercises the cancellation path with local command shims. Is this the best way to solve the issue? Yes. The patch uses the narrow maintainable path: register cancellable post-ready handles, pass AbortSignal through the existing Gmail/Tailscale command calls, and normalize abort exits in the shared process helper without adding config or public contracts. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against e650f8930d9d. |
Signed-off-by: samzong <[email protected]>
Signed-off-by: samzong <[email protected]>
5ebfdec to
c550d5d
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Merged via squash.
Thanks @samzong! |
…law#82395) Merged via squash. Prepared head SHA: 6150284 Co-authored-by: samzong <[email protected]> Co-authored-by: frankekn <[email protected]> Reviewed-by: @frankekn
…law#82395) Merged via squash. Prepared head SHA: 6150284 Co-authored-by: samzong <[email protected]> Co-authored-by: frankekn <[email protected]> Reviewed-by: @frankekn
…law#82395) Merged via squash. Prepared head SHA: 6150284 Co-authored-by: samzong <[email protected]> Co-authored-by: frankekn <[email protected]> Reviewed-by: @frankekn
…law#82395) Merged via squash. Prepared head SHA: 6150284 Co-authored-by: samzong <[email protected]> Co-authored-by: frankekn <[email protected]> Reviewed-by: @frankekn
…law#82395) Merged via squash. Prepared head SHA: 6150284 Co-authored-by: samzong <[email protected]> Co-authored-by: frankekn <[email protected]> Reviewed-by: @frankekn
…law#82395) Merged via squash. Prepared head SHA: 6150284 Co-authored-by: samzong <[email protected]> Co-authored-by: frankekn <[email protected]> Reviewed-by: @frankekn
…law#82395) Merged via squash. Prepared head SHA: 6150284 Co-authored-by: samzong <[email protected]> Co-authored-by: frankekn <[email protected]> Reviewed-by: @frankekn
Summary
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
src/hooks/gmail-watcher.tsmodule and used temporary executable shims onPATHto recordtailscaleandgogprocess calls without real credentials.node --import tsx --input-type=module <<'NODE'with a runtime probe that:tailscaleandgogexecutables onPATH;[email protected]with Tailscale targetold-target:8788;tailscale status --jsoncommand is still in flight;[email protected]with Tailscale targetnew-target:8788;startup cancelled, old Tailscale serve mutations are0, and new Tailscale serve mutations are1.node scripts/run-vitest.mjs src/hooks/gmail-watcher.test.ts src/hooks/gmail-setup-utils.test.ts src/hooks/gmail-watcher-lifecycle.test.ts src/gateway/server-startup-post-attach.test.tsnode scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfonode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.src.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/test-src.tsbuildinfonode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/gateway/server-startup-post-attach.test.ts src/gateway/server-startup-post-attach.ts src/hooks/gmail-setup-utils.test.ts src/hooks/gmail-setup-utils.ts src/hooks/gmail-watcher-lifecycle.test.ts src/hooks/gmail-watcher-lifecycle.ts src/hooks/gmail-watcher.test.ts src/hooks/gmail-watcher.tspnpm exec oxfmt --check --threads=1 src/gateway/server-startup-post-attach.test.ts src/gateway/server-startup-post-attach.ts src/hooks/gmail-setup-utils.test.ts src/hooks/gmail-setup-utils.ts src/hooks/gmail-watcher-lifecycle.test.ts src/hooks/gmail-watcher-lifecycle.ts src/hooks/gmail-watcher.test.ts src/hooks/gmail-watcher.tsgit diff --checkTest Files 4 passed (4),Tests 44 passed (44).tsgocore and source-test type checks completed with exit code 0.Found 0 warnings and 0 errors.startup cancelled.tailscale serve --set-path ... old-target:8788command ran after cancellation.tailscale serve --set-path /gmail-pubsub --yes new-target:8788command.runCommandWithTimeoutsets abort termination state and does not collapse it into exit-success semantics.crabboxwas unavailable locally (crabboxnot inPATH,../crabbox/bin/crabboxmissing, andscripts/crabbox-wrapper.mjsfailed sanity checks).Root Cause (if applicable)
Regression Test Plan (if applicable)
src/gateway/server-reload-handlers.test.tssrc/gateway/server-startup-post-attach.test.tssrc/hooks/gmail-watcher.test.tssrc/hooks/gmail-setup-utils.test.tssrc/process/exec.test.tsUser-visible / Behavior Changes
Diagram (if applicable)
N/A
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation:Repro + Verification
Environment
tailscale/gogexecutable shimsSteps
startup cancelled.old-target:8788Tailscale serve mutation.new-target:8788Tailscale serve mutation.Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
Review Conversations
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations