Skip to content

fix(source): cookie-only source with --skip-local-storage and --skip-secrets - #153

Merged
mvanhorn merged 8 commits into
mainfrom
fix/source-cookie-only-mode
Oct 15, 2026
Merged

mvanhorn merged 8 commits into
mainfrom
fix/source-cookie-only-mode

Conversation

@mvanhorn

Copy link
Copy Markdown
Owner

Summary

A normal source can now run cookie-only. --skip-local-storage stops each push from carrying the browser's Local Storage leveldb, and --skip-secrets stops the source from reading the secrets bus at all. Before this, the only cookie-only route was cdp_source, which needs a second Chrome running with a debug port.

  • --skip-local-storage (or AGENTCOOKIE_SKIP_LOCAL_STORAGE=1) is feat(source): add --skip-local-storage to stop shipping Local Storage #150 by @Dannyxlm, cherry-picked with both commits and their authorship intact. On the reporter's Mac it took each push from about 90 MB to about 1.8 MB with the same cookies delivered. A Linux sink never applied that Local Storage anyway.
  • --skip-secrets (or AGENTCOOKIE_SKIP_SECRETS) skips loadSecretsPayload on every push. In --watch it also starts neither the secrets-bus watcher nor the discovery watcher, so no manifest or carried file is read. Push sinks and teammates pulling GET /pull receive no secrets.
  • The env var fails closed: any value other than empty or 0 turns it on, and a value other than 1 warns once naming it. A typo such as true cannot keep shipping credentials.
  • agentcookie doctor gains a "Secrets push" line ("skipped" or "shipping N cli(s)"), recorded from the last real push. A --dry-run leaves it alone.
  • The threat model notes that the switch stops future sends only. Secrets already delivered stay on the sinks and teammates that hold them.

Supersedes #150. Its two commits are kept on this branch with @Dannyxlm as author.

Co-authored-by: Dannyxlm [email protected]

Closes #151 (requested by @jnyross).
Related: #149 (item 1; items 2 to 4 are in the push-cadence PR and #152)

Verified

  • go build ./...
  • go vet ./...
  • go test -race ./...
  • golangci-lint v2.11.4 (the CI pin): 0 issues

The tests swap the secrets loader for a stub that fails the test if it is called. They check:

  • with the env set to 1, neither the envelope nor the /pull cache carries a secrets field
  • clearing the env ships the stubbed CLI again
  • the flag alone also skips
  • true and no skip and warn once, while 0 and empty do not skip
  • with the switch on, watch startup builds no secrets watchers
  • a dry run keeps the last secrets summary
  • an old source-state.json reads back as not skipped

Code review: ce-code-review at full depth, with correctness, security, testing and maintainability reviewers plus an independent Codex adversarial read (gpt-6-luna, independence verified).

  • Verdict: Ready with fixes.
  • Both actionable findings are fixed on this branch: a dry run overwrote the doctor summary, and the skip switches moved to source_skip.go.

Notes

No source.yaml key is added; TestSourceConfigYAMLKeysUnchangedForOlderBinaries guards that file. The wire format is unchanged: the skipped tarball and secrets fields are just empty. Without either flag nothing changes.


Compound Engineering

🤖 Generated with Claude Code

https://claude.ai/code/session_01LgVWtkXgDGWMh6L95d8piN

Dannyxlm and others added 5 commits October 14, 2026 23:41
Every push packs the source profile's Local Storage leveldb into the
envelope, and the watcher also pushes on Local Storage writes. A Linux
sink (or any sink with skip_chrome_sqlite) never applies it. On one Mac
the directory was 64 MB, so each push was ~90 MB (150 GB uploaded in
16.5 h), and slow uplinks overran the watcher's 60 s push budget.

--skip-local-storage (or AGENTCOOKIE_SKIP_LOCAL_STORAGE=1 for a
LaunchAgent) skips the pack and stops watching the directory. Default
behavior, source.yaml keys and the wire format are unchanged.

Refs #149
…ndexedDB

Addresses review on #150: the default-push case clears an inherited AGENTCOOKIE_SKIP_LOCAL_STORAGE, the test compares whole Cookies slices instead of hosts, and the FAQ notes IndexedDB stays opt-in.
A normal source always loaded the secrets bus and shipped it to every
push sink and, through GET /pull, to every paired teammate. Owners who
keep tokens in a password manager had no way to say "never ship
secrets from this source" short of running a CDP source.

agentcookie source --skip-secrets (or AGENTCOOKIE_SKIP_SECRETS) skips
loadSecretsPayload on every push and, in --watch, starts neither the
secrets-bus watcher nor the discovery watcher, so no manifest or carried
file is read. The env var fails closed: any value other than empty or 0
turns it on, and an unusual value warns once. Source state records
whether the last push skipped secrets and how many CLIs it shipped, and
doctor reports it as "Secrets push". Docs cover the cookie-only recipe
and note that the switch does not remove secrets already delivered.

Requested by @jnyross in #151.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LgVWtkXgDGWMh6L95d8piN
A --dry-run cycle sends nothing, but it overwrote the recorded secrets
summary, so doctor could say "shipping N cli(s)" for secrets that never
left the machine. Dry runs now leave it alone. The skip switch helpers
move to source_skip.go to keep source.go from growing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LgVWtkXgDGWMh6L95d8piN
@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues remain.

Summary

Adds --skip-local-storage and --skip-secrets for cookie-only source runs, plus a saved secrets summary for doctor.

  • Source pushes can leave out the browser’s Local Storage.
  • Source pushes can leave out secrets from the secrets bus.

Reviews (4) · Last reviewed commit: "fix(source): carry the saved secrets sum..." · Reviewed by Greptile

Comment thread internal/cli/source.go Resolved
Comment thread internal/cli/source.go Resolved
@mvanhorn
mvanhorn merged commit 48725d6 into main Oct 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Owner-level, fail-closed switch to stop a normal source shipping secrets-bus data (like --skip-dbsc-suspect)

2 participants