Skip to content

feat: improve reddit session reliability#4

Open
777genius wants to merge 1 commit into
m13v:mainfrom
777genius:feat/reddit-session-reliability
Open

feat: improve reddit session reliability#4
777genius wants to merge 1 commit into
m13v:mainfrom
777genius:feat/reddit-session-reliability

Conversation

@777genius

Copy link
Copy Markdown

Summary:

  • Add Reddit whoami and headed login helper commands
  • Allow REDDIT_HEADLESS, REDDIT_PROFILE_DIR, and REDDIT_BROWSER_EXECUTABLE overrides
  • Validate the logged-in account through Reddit API state before posting
  • Add an old Reddit API fallback for top-level comments when the UI login state is unreliable
  • Add public visibility checks for newly posted comments

Tests:

  • python3 -m py_compile scripts/reddit_browser.py
  • git diff --check
  • staged diff reviewed for local config, accounts, tokens, cookies, and product-specific data

m13v added a commit that referenced this pull request Jul 6, 2026
)

Root cause of lost drafts: a producer cycle that dies after its worker writes the
result but before consuming it strands the result in claude-queue/result/ (a
consumed result is deleted, so a surviving one = never consumed) -> no plan, no
merge, no card. Nothing detected or recovered these.

#1 Salvage (scripts/salvage_orphaned_prep_results.py, wired into run-draft-and-publish.sh):
   scans result/ for orphaned twitter-prep results (past the queue timeout so no
   live producer is racing, and within a max-age so stale threads are retired) and
   merges their candidates into the review queue via merge_review_queue.py (dedup-safe).
   Recovered 11 real stranded drafts on first run.

#2 Success/orphan visibility (claude_job.py): log a "consumed result for job X"
   event on the success path (the silent gap that made an orphaned result look
   identical to a healthy one); the salvage script logs the "ORPHAN ..." event.

#3 Correlation (claude_job.py): every provider.log line now carries batch=<BATCH_ID>
   so it links to the cycle's own twitter-cycle-<batch>.log.

#4 Remote visibility (scripts/relay_provider_log.py, wired into mcp/src/index.ts):
   tail claude-queue/provider.log to Cloud Logging (context="queue-provider"),
   incremental + self-locking + forward-only baseline, so a stranded batch on a
   customer box is queryable remotely instead of only on the box.

Also: refresh the CLAUDE.md note now that the persona lane is arm-aware.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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