Skip to content

fix(reddit): detect auth status in doctor check#261

Open
thomaslau0229 wants to merge 1 commit intoPanniantong:mainfrom
thomaslau0229:fix/reddit-auth-detection
Open

fix(reddit): detect auth status in doctor check#261
thomaslau0229 wants to merge 1 commit intoPanniantong:mainfrom
thomaslau0229:fix/reddit-auth-detection

Conversation

@thomaslau0229
Copy link
Copy Markdown

Problem

agent-reach doctor reported ✅ ok for Reddit as long as rdt was installed — even when every API request would fail with HTTP 403 Forbidden.

Root cause: Reddit has required authentication for all requests since 2024 (including public subreddit reads). The old check only verified the binary existed, never whether the session was authenticated.

Additionally, the currently pinned rdt-cli (v0.4.1 on PyPI) predates the authentication improvements in v0.4.2. The newer version is available at public-clis/rdt-cli and recommended for users hitting auth issues.

Solution

Make check() call rdt status --json and inspect the authenticated field.

New behavior:

  • ok — installed and authenticated (shows username)
  • ⚠️ warn — installed but not logged in → shows two recovery paths
  • off — not installed → points to v0.4.2+ and public-clis/rdt-cli

Recovery paths shown in the warn message

  1. Automaticrdt login (extracts cookies from browser session)
  2. Manual via Cookie-Editor — for Chrome/Edge 127+ which introduced App-Bound Encryption that blocks automatic cookie extraction. Includes direct Chrome Web Store link for easy installation.

Tests

All four states covered. All existing tests pass.

pytest tests/test_channels.py::TestRedditChannel -v   # 5 passed
pytest tests/                                          # all passed

Real-world context

Discovered while debugging a production pipeline: agent-reach doctor showed Reddit as healthy, but every rdt sub <subreddit> call silently returned 403. The manual Cookie-Editor workaround was confirmed working on Windows with Chrome 127+.

Reddit has required authentication for all API requests since 2024.
Previously, the doctor check only verified that rdt was installed,
reporting ok even when all requests would fail with HTTP 403.

This fix makes the doctor check call rdt status --json to verify
the session is actually authenticated before reporting success.

Changes:
- check() now runs rdt status --json and inspects authenticated field
- Reports warn (not ok) when rdt-cli is installed but not logged in
- Warn message includes two recovery paths:
  - Automatic: rdt login (extracts cookies from browser)
  - Manual: Cookie-Editor extension for Chrome/Edge 127+ where
    automatic extraction fails due to App-Bound Encryption
    (Chrome Web Store link included for discoverability)
- Adds test coverage for all four states: off / ok / warn / error
- Fixes pre-existing lint issues in test_channels.py (I001, F841)
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.

1 participant