Repository navigation
custom(google-disconnect-forget): forget Google data on disconnect, 30-day limit on mail and event text - #4
Merged
Conversation
… mail, and mail text 30 days after a thread goes quiet Disconnecting Gmail (or importing a different client) now drops what HQ took from that mailbox: the ledger's mail threads keep only their id, project, chat and times (letters, subjects, senders, gist, drafts, a reply copied into a waiting, the model's reason are removed, with secure_delete and a WAL checkpoint so the bytes leave the file), the mail intake's message ids, and the mail reader's cursor; a pass that was reading when the mailbox went writes nothing. Every 6 hours a mail thread quiet for 30 days is forgotten the same way, and older letters leave threads still going. The model's guess on a letter runs with --no-session-persistence, so the letter's text leaves no Claude transcript. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… Gmail and Calendar words of an account or of events older than 30 days A Gmail or Calendar run kept the mail's subject and snippet, the sender, the meeting's title, place and link, with no age limit. forgetAutomationRunGoogleEvents (on the store) drops them: by account, a finished run loses its event, folded keys, output snapshot and who/where, and an unfinished run loses only the words so it still folds and dedupes; by date, finished runs whose event is older than the cutoff lose the event. The run, its times, status and source stay. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ets what Orca kept from it — trigger cursors, Drive text, timers, run history, the default pick GoogleConnect.disconnect (Settings, CLI and phone all call google.disconnect) now calls forgetGoogleAccount after the sign-in file goes: the account's Gmail history point, calendar sync tokens and bots' listening times leave orca-google-triggers.json, its Drive text leaves the paging cache, and listeners drop the trigger checker's meetings and timers and the account's run history. A default-account file naming the removed address is removed too, so the last account leaves no address behind. Each automation tick drops Gmail and Calendar words older than 30 days from run history, once an hour. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aves the waiting's event snapshots waiting.replied / waiting.updated / waiting.replyDelivered events carry the whole waiting, so the reply text, author, link and ts copied from a letter stayed in the events table after the waiting row was cleared. Those snapshot fields are nulled for answers from the forgotten letters, on disconnect and for letters past 30 days (found by the automated security review of the branch). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…gger checker, so a check still waiting on Google can't start a bot or write its old state back The checker is upstream's file again: its forgetAccount and the max-lines suppression are gone (the CI ratchet rejected the suppression). Instead the runtime holds a retirable checker; on disconnect the old one stops, its memory (schedules, timers, backoff) goes with it, and its runForEvent and writeState become no-ops for any check still in flight. The next tick runs a fresh checker over the scrubbed state; the run path drops repeat events. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rive read in flight and a long mail thread's first subject no longer bring back what a disconnect or the 30 days removed - HQ mail ledger: a pass begun before a reset ingests nothing and saves no guess, even when the same address is connected again meanwhile. - Drive text cache: a read still converting when an account is forgotten does not put its text back into the cache. - A mail thread still going once its first letters age out gets a neutral title; the old one was that letter's subject or the model's gist of it. - The disconnect test now checks real files under a temporary home (sign-in and trigger state gone, the other account kept) instead of mocked calls. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… lose their Google words too, and the mail ledger stops reading the old mailbox at once (Codex review, round 2) - Run history: for 6 hours after a disconnect, each tick scrubs that account's runs again, so a run going at the disconnect, or an event already on its way into a run, loses its words once it settles. Only events from before the disconnect: the same address connected again keeps its new runs. Asking again writes nothing when nothing changed. - HQ mail ledger: a mailbox gone mid-pass sends no more letters to the model, and Done / project events logged under `gmail:<thread>` move to the forgotten key, so the thread id leaves event history. - The trigger-state test asserts the surviving entries as literals. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nnect keeps none of the old mailbox's ids, and the 30-day mail sweep runs on the mail reader's poll instead of a timer of its own (Codex review, round 3) - HQ mail intake: a pass that began before a disconnect drops the ids it wrote once its writes are done, so a pass waiting on ClickUp at the disconnect cannot bring the old mailbox's ids back. A forget writes through its own temp file, so it cannot collide with the intake's. - The 30-day mail sweep is checked on each poll of the mail reader (at most every 6 hours) and adds no `setInterval` of its own. - The Gmail disconnect test that only counted mock calls is gone; an invariant test of the in-flight intake takes its place. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er check at once, so another account's Calendar timer due before the next tick is set again instead of skipped (Codex review, round 3) Retiring the checker cancels every pending Calendar timer. A meeting of another account with a zero-minute trigger that starts before the next tick was then skipped, since the next check sees it already started. The fresh checker now checks right after the disconnect; its tick guard keeps it from overlapping the service's own tick. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disconnecting a Google account (or the HQ mailbox) now removes what Orca+ kept from it, and Google mail/event text stops living forever in HQ's ledger and in automation run history. This follows the Google Workspace AI tools terms: no user data kept after a disconnect, nothing derived from it kept past 30 days.
What changes
HQ mailbox (
gmail:disconnect, also a client change inimportGmailClient)gmail:<thread>) keep only their id, project, chat and times. Letters, subjects, senders, the model's gist and drafts, a reply copied into a waiting, and the guess's reason are removed.secure_deleteplus a WAL checkpoint so the bytes leave the file.slack-scout/mail-state.json→seen: [],lastCheckAtkept) and the mail reader's cursor are reset. A reader pass that was mid-read when the mailbox went sends no more letters to the model and writes nothing, even if the same address is connected again meanwhile. An intake pass that began before the disconnect (say, waiting on ClickUp) drops the ids it wrote once its writes are done.gmail:<thread>move to the forgotten key, so the thread id leaves event history too.Mail thread (older letters removed).--no-session-persistence, so it leaves no Claude transcript.Bot Google accounts (
google.disconnect: Settings, CLI and phone)forgetGoogleAccount(email)runs after the sign-in file is removed. It drops the account's Gmail history id, calendar sync tokens and bots' listening times fromorca-google-triggers.json, and its Drive text from the paging cache (a Drive read still converting at that moment doesn't put its text back). Registered listeners drop the account's run history and retire the trigger checker.default-account.encis removed when it names the removed address, so the last account leaves no address behind. A pick this host can't read is kept, as before.Automation run history
forgetAutomationRunGoogleEventsby account: a finished run losesevent,eventKeys,outputSnapshotand actor/place. An unfinished run loses only the text fields, so it still folds and dedupes.Not changed (on purpose)
~/.orca/google/client.enc,<profile>/gmail/client.enc). They are the app's own key, not user data, and reconnecting needs them.Bot.googleAccountsand the accounts named in automation rules. These are settings: which bot may use which account.--downloadat the user's request, bot memory, and chat transcripts. These need a separate decision.automationRunmetadata, a not-started card that Send again replays). The chat journal is its own subsystem; left for a decision (Codex P1, round 1).Known limits
gmail:%forget also reaches threads the separate Gmail MCP writes under the same prefix: it removes more than needed, never less.~/.orca/google(orca servebeside the desktop app) doesn't hear a disconnect made in the other one; its run history is cleaned by the 30-day sweep.--no-session-persistence) are not removed; telling them apart from other sessions needs its own change.Testing
google-account-forget(also a Drive read in flight),google-connect-disconnect(real files under a temporary home: sign-in and trigger state gone, the other account kept),google-default-account(last account leaves no default),google-trigger-retire(a check waiting on Google at disconnect starts no bot and writes no state),automation-run-google-forget,pulse-ledger-forget(incl. the trimmed thread's title),hq-mail-forget(an intake pass in flight at a disconnect keeps no ids),hq-mail-ledger-reader(disconnect mid-pass, reset vs. in-flight pass with the same address),hq-task-questions-no-transcript. The mock-only Gmail listener test from the first round is dropped.oxlintandoxfmt --checkare clean on the touched files; the max-lines ratchet no longer reports any file of this PR. No local typecheck per the project's Mac rule; CI runs it.Performance
None, because the new work runs only on a disconnect, on each tick for 6 hours after one (a repeat scrub of that account that writes nothing when nothing changed), once an hour (run history sweep) and every 6 hours (mail ledger sweep, checked on the existing mail reader poll), each a single indexed pass over local data; the trigger checker is recreated only on a disconnect, and its first check, run at once, rebuilds the coming-day schedules once (one Calendar read per watched calendar).
Risk
// Custom build (google-disconnect-forget): google-connect, google-credential-store, google-drive-text-cache, google-trigger-runtime, automation-persistence.google-trigger-checker.tsis unchanged from upstream; the retire wrapper lives in the newgoogle-trigger-retire.ts.Level: Medium
secure_delete, so freed pages can hold old bytes until SQLite reuses them.How to revert
git revertthe ninecustom(google-disconnect-forget)commits. No schema or file-format changes; the files and tables keep their shape.🤖 Generated with Claude Code