From 1f54593b2c55c97205147bb9e97d3116ec2e54cb Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Sun, 8 Feb 2026 15:14:47 -0800 Subject: [PATCH] Add reply verification to X post script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After posting a reply, verify via API that the tweet is actually threaded under the target. Catches the silent failure where the old tweepy-based script posted replies as standalone tweets. Deleted 2 orphaned standalone tweets that should have been replies. 🤖 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta --- .skills/interacting-with-x/scripts/post.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.skills/interacting-with-x/scripts/post.py b/.skills/interacting-with-x/scripts/post.py index e7e0a95..6a7b8ad 100644 --- a/.skills/interacting-with-x/scripts/post.py +++ b/.skills/interacting-with-x/scripts/post.py @@ -46,8 +46,24 @@ def create_tweet( sys.exit(1) data = resp.json()["data"] + tweet_id = data["id"] + + # Verify reply threading if this was supposed to be a reply + if reply_to: + verify = requests.get( + f"{API_BASE}/tweets/{tweet_id}", + params={"tweet.fields": "conversation_id,referenced_tweets"}, + auth=auth, + ) + if verify.status_code == 200: + vdata = verify.json().get("data", {}) + refs = vdata.get("referenced_tweets", []) + is_reply = any(r.get("type") == "replied_to" for r in refs) if refs else False + if not is_reply: + print(f"WARNING: Tweet {tweet_id} posted but NOT threaded as reply to {reply_to}", file=sys.stderr) + return { - "id": data["id"], + "id": tweet_id, "text": data["text"], } -- 2.51.2