promote: fix browser-post failures from captured failure DOM (reddit + dead-session detection) - #105
Merged
Merged
Conversation
…gram) Best-effort fixes for the browser-automation posting failures now surfacing correctly after the #103 reconciliation fix. Each targets the exact element the Playwright error resolved to: - instagram: file input is display:none — wait for state:'attached', not 'visible' (a hidden input never becomes visible → the reported timeout). - reddit: scope the lexical body editor to :visible — a hidden editor template otherwise won .first() and never became visible. - facebook: drop the `[aria-label*="create"]` fallback (it substring-matched "…why you created moshcoding" on a hidden element); match the composer by button text instead; scope the editor to :visible. - threads: broaden the compose trigger (labels + "What's new?") and scope the editor to :visible. CAVEAT: these are UNVERIFIED — browser automation of live social sites can't be tested without the account's cookie session + a browser, and the sites change their DOM frequently. The durable fix is connecting reddit/facebook/threads via OAuth (the API adapters in lib/sp/post.ts already post reliably and return a real URL); Instagram has no post API so it stays browser-only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
Pulled the real page HTML/URL from the failed sp_post rows (debug_html/url) and
fixed against the actual DOM instead of guessing:
- reddit: the real body editor is inside <shreddit-composer name="body">; Reddit
ALSO renders a hidden duplicate data-lexical-editor in the flair-picker modal
(<r-post-flair-edit-modal>, slot="editor") which .first() kept grabbing → the
"resolved to hidden" timeout. Scope to the body composer + :visible.
- assertLoggedIn: wait for networkidle before judging (Instagram/Threads redirect
to login CLIENT-SIDE after domcontentloaded, so the old immediate URL check
missed dead sessions) and flag a near-empty shell as a login wall. Dead
sessions now fail with SESSION_EXPIRED → account marked token_expired → the UI
prompts a cookie reconnect instead of an opaque selector timeout.
- captureDom: capture <body> outerHTML, not the whole document — FB's multi-MB
<head> was eating the 600k budget and truncating before the composer, making
FB failures undiagnosable.
Diagnosis from the captured DOM (NOT code-fixable — user action):
- instagram cookies are DEAD (redirects to /accounts/emailsignup) → re-export.
- threads session dead/blocked (served a ~40-char shell) → re-export.
- facebook IS logged in ("(3) Facebook") but its composer was past the old
truncation; the wider capture + #105 selector tweaks should surface next run.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ralyodio
added a commit
that referenced
this pull request
Jul 30, 2026
Pulled the real page HTML/URL from the failed sp_post rows (debug_html/url) and
fixed against the actual DOM instead of guessing:
- reddit: the real body editor is inside <shreddit-composer name="body">; Reddit
ALSO renders a hidden duplicate data-lexical-editor in the flair-picker modal
(<r-post-flair-edit-modal>, slot="editor") which .first() kept grabbing → the
"resolved to hidden" timeout. Scope to the body composer + :visible.
- assertLoggedIn: wait for networkidle before judging (Instagram/Threads redirect
to login CLIENT-SIDE after domcontentloaded, so the old immediate URL check
missed dead sessions) and flag a near-empty shell as a login wall. Dead
sessions now fail with SESSION_EXPIRED → account marked token_expired → the UI
prompts a cookie reconnect instead of an opaque selector timeout.
- captureDom: capture <body> outerHTML, not the whole document — FB's multi-MB
<head> was eating the 600k budget and truncating before the composer, making
FB failures undiagnosable.
Diagnosis from the captured DOM (NOT code-fixable — user action):
- instagram cookies are DEAD (redirects to /accounts/emailsignup) → re-export.
- threads session dead/blocked (served a ~40-char shell) → re-export.
- facebook IS logged in ("(3) Facebook") but its composer was past the old
truncation; the wider capture + #105 selector tweaks should surface next run.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Reads the real page HTML/URL captured on each failed sp_post (debug_html/url) and fixes against the actual DOM.
Root causes found:
<shreddit-composer name="body">, but a HIDDEN duplicatedata-lexical-editorin the flair-picker modal was matched by.first(). Fix: scope to the body composer +:visible. ✅/accounts/emailsignup).Code changes: reddit editor scoping;
assertLoggedInnow waits for networkidle + flags empty shells so dead sessions report SESSION_EXPIRED (account flagged token_expired, UI prompts reconnect) instead of opaque timeouts;captureDomgrabs<body>not the whole doc so FB's huge head stops truncating the composer; plus instagram file-input waits attached-not-visible and facebook drops the greedy[aria-label*=create].tsc (app+worker) clean; live behavior only confirmable by re-running with valid sessions.