feat(gmail): migrate Gmail integration from private repo#323
Conversation
Migrates the Gmail integration from the private `integrations` repo to the public `autohive-integrations` repo after a security/safety/secrets review found no hardcoded secrets, internal URLs, customer references, or proprietary business logic. Drops legacy artefacts that don't belong in the public repo: * integration.py — vendored old SDK copy (public uses PyPI package) * test_gmail_integration.py — manual harness (replaced by tests/) Includes 21 actions across messages, threads, drafts, and labels, with HTML sanitisation via bleach and pagination on every list endpoint. Closes #322
🔍 Integration Validation ResultsCommit: Changed directories:
|
| import sys | ||
|
|
||
| sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) | ||
| from gmail import gmail # noqa: F401 |
| @@ -0,0 +1,6 @@ | |||
| import context # noqa: F401 | |||
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e0f3b8faa
ℹ️ 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".
| # Handle CC recipients if present | ||
| if "cc" in inputs: | ||
| if isinstance(inputs["cc"], list): | ||
| message["cc"] = ", ".join(inputs["cc"]) | ||
| else: | ||
| message["cc"] = inputs["cc"] | ||
|
|
||
| message["subject"] = inputs["subject"] |
There was a problem hiding this comment.
Add BCC handling for new sends
When users send a new email, the implementation copies only to and cc into the MIME message and then immediately sets the subject, so any BCC support advertised in gmail/README.md/the root README is unavailable for send_email (and direct callers passing bcc would silently drop those recipients). Draft creation/update already handles bcc, so mirror that logic here and expose the field in this action's schema.
Useful? React with 👍 / 👎.
| return parsedate_to_datetime(email["date"]) | ||
| except Exception: | ||
| # Fallback: use the email ID as a rough ordering mechanism | ||
| return email["id"] |
There was a problem hiding this comment.
Keep thread sort keys comparable
If a thread contains one message with a parseable Date header and another with a missing or malformed Date, this fallback returns a string while the successful path returns a datetime; Python 3 cannot compare those key types, so thread_emails.sort(...) raises and the whole get_thread_emails action returns an error for that thread. Use a single comparable key type for both paths, such as a tuple with a parse-success flag and timestamp/id.
Useful? React with 👍 / 👎.
|
Please ignore all the warnings in this PR - this is a 1:1 migration and will be fixed up in a subsequent PR. |
Closes #322
Summary
Migrates the Gmail integration from the private
Autohive-AI/integrationsrepo to the publicautohive-integrationsrepo.Security / safety / secrets review
Reviewed before migration — clean:
integration.py)autohive-integrations-sdkfrom PyPItest_gmail_integration.py)What's included
gmail/config.json— copied as-isgmail/gmail.py— copied as-is (usesgoogleapiclient+bleachfor HTML sanitisation)gmail/icon.png— copied as-isgmail/__init__.py— empty (matches public repo convention)gmail/requirements.txt— kept at SDK~=1.0.2(migrate as-is; SDK 2.0 upgrade is a separate concern)gmail/README.md— rewritten in the public repo style (modelled ongoogle-calendar/README.md)gmail/tests/{__init__.py,context.py,test_gmail.py}— copied placeholder structureREADME.md— added Gmail entry near other Google integrationsValidation
Companion PRs
gmail/)migrating-private-integrationskill)