feat(hooks): support gws as alternative to gog for Gmail Pub/Sub#35506
feat(hooks): support gws as alternative to gog for Gmail Pub/Sub#35506JoshuaLelon wants to merge 5 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR adds However, two critical bugs exist in the process-management layer that make the gws service daemon unreliable:
The gws feature cannot ship in its current form — the daemon is unreliable and will silently stop working in production after crashing twice. Confidence Score: 2/5
Last reviewed commit: ae737c9 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae737c98b7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 238c48a120
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
238c48a to
22a9e69
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 22a9e696c0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
8f48403 to
4a20215
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 61ea14c02a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Buffer partial lines from stdout (NDJSON may arrive in chunks) | ||
| let buffer = ""; | ||
| child.stdout?.on("data", (data: Buffer) => { | ||
| buffer += data.toString(); |
There was a problem hiding this comment.
Decode gws stdout with a streaming UTF-8 decoder
spawnGwsWatch appends each chunk using data.toString() before line-splitting, which corrupts multi-byte UTF-8 characters when gws splits a character across chunk boundaries. In multilingual inboxes this can turn subjects/snippets into replacement characters (�) before JSON parsing/forwarding, so hook payload content is silently altered even though the message is otherwise valid; use a streaming decoder (for example StringDecoder) or buffer bytes until line boundaries before decoding.
Useful? React with 👍 / 👎.
…leak from spawnGwsWatch
61ea14c to
2bea21f
Compare
Summary
hooks.gmail.cli: "gog" | "gws"config option so users can choose between gog (push-based, Homebrew/macOS) and gws (pull-based, npm, cross-platform) for Gmail Pub/Sub hooks--cli gws) usesgws gmail +watchwhich polls Pub/Sub and outputs NDJSON — no Tailscale, no push endpoint, no renewal interval neededgmail-gws-bridge.tsmodule transforms Gmail API messages from gws stdout into the hook payload format expected by the gmail preset ({ messages: [{ id, from, subject, snippet, body }] })ensureDependencynow supportsnpminstall method alongsidebrewChanges
GmailCliModetype,cli/projectfields inHooksGmailConfig+ Zod schemaresolveGmailHookRuntimeConfigrelaxespushToken/topicrequirements for gws; addedbuildGwsWatchArgsgmail-gws-bridge.ts— NDJSON parsing, Gmail API message transform, hook POSTresolveProjectIdFromCredentials(cli)spawnGwsWatchwith NDJSON line buffering;startGmailWatcherbranches by cli moderunGmailSetup/runGmailServicebranch for gws (skip Tailscale/push subscription)--cli <gog|gws>option on bothsetupandruncommandsTest plan
pnpm checkpasses (lint + format + type check)pnpm test -- src/hooks/gmail— 41 tests pass across 4 filesopenclaw webhooks gmail setup --cli gws --account X --project P🤖 Generated with Claude Code