...the debug utility to kind of like understand how, what happens with the social, you…
- User
...the debug utility to kind of like understand how, what happens with the social, you know, every day after the update you should get a... We should send a social sharing post to the email the admin or message the admin with some potential to share but that didn't send today can you try to understand why they send it to you
- User
based on the debug utilites
- Assistant
I’m tracing the daily social-share notification path and the available debug utilities first, then I’ll check the scheduler, the send conditions, and any recent changes that could have blocked today’s run.
- Assistant
I found two likely paths: the in-bot social/share flow in
src/features/sharing, and a separate daily “social picks” pipeline exposed byscripts/send_social_picks.pyplus[SocialPicks]logic in the summariser. I’m reading those next, along with the debug utility commands that can trace logs and recent errors. - Assistant
I’ve confirmed there is a built-in social-picks DM flow in the summariser, and an older standalone script that fetches “today’s” summary directly from the DB. The next step is to see which path is actually wired into the daily run and whether today’s summary/date logic caused it to skip.
- Assistant
I’ve narrowed it to the scheduled summary job calling
_send_social_picks_dm()at the end of summary generation. Before I hit the live debug commands, I’m checking the date lookup and summary persistence code because the standalone social-picks script and the scheduled path may disagree on what counts as “today.” - Assistant
The repo doesn’t have a project virtualenv, and the default
pythonhere is a bare pyenv 3.8 interpreter withoutsupabase, which is whyscripts/debug.pyfailed. I’m using the local bot logs now to verify whether today’s scheduled summary reached the social-picks step and whether it failed before or during the DM send. - Assistant
I have enough context for a focused diagnosis plan:
- Query Supabase directly for
system_logsanddaily_summariesbecause the local debug script is blocked by missing deps. - Check whether the April 9, 2026 scheduled summary ran at all, whether
[SocialPicks]logs exist, and whether a summary row was stored for the summary channel. - If the run failed before social picks, trace the first blocking error. If the run completed, compare the scheduled in-bot path against the standalone “fetch today’s summary” script and patch whichever assumption is wrong.
- Query Supabase directly for
- Assistant
I have the actual production failure now. The social-picks flow did run on April 9, 2026 at
07:24 UTC, Claude returned picks, author lookup succeeded, and then Discord rejected the DM payload with400 Invalid Form Body: In content: Must be 2000 or fewer in length.I’m pulling the summary row and the surrounding run logs next so I can confirm whether this is a one-line regression in the new “include all assets + creator info” formatting and patch it cleanly.
- Assistant
I’m patching the social-picks sender now. The failure is specific: today’s new per-pick format appended creator info plus every asset URL into one DM, and at least one pick crossed Discord’s 2,000-character limit. I’m changing it so the core pick stays compact and any asset URLs spill into follow-up messages in bounded chunks instead of hard-failing the whole send.
- Assistant
The fix is in place locally. I’m doing a quick compile check and reviewing the diff now; after that I’ll summarize the exact production failure with timestamps and the patch location.
- Assistant
Findings
- On April 9, 2026 at
07:24:43 UTC(09:24Berlin), the daily summary did reach the social-picks step. Claude returned picks, lookup succeeded, and author resolution succeeded. The failure happened at07:24:57 UTC, when Discord rejected the DM with:400 Bad Request ... In content: Must be 2000 or fewer in length. - The regression is in summariser.py. The current code was packing the draft, why, creator info, original post link, and every asset URL for a pick into one
admin_user.send(content)call. Today’s April 9 summary included picks with a lot of media, so at least one pick overflowed Discord’s 2,000-character limit.
- On April 9, 2026 at
- User
Can you please fix that issue that you came across there? Make sure we have a VEMV or whatever that we can run. And are you confident now that it will run now and we're sending each of the recommendations for the social pics one at a time?
- Assistant
I’ve already fixed the DM overflow in the social-picks sender. I’m setting up a local
.venvnow and then I’ll run a targeted verification so I can answer the confidence question with something concrete rather than hand-waving. - Assistant
I found two practical gaps while doing this properly: there was no project
.venv, and.gitignoredoesn’t currently ignore.venv/. I’m fixing both, then I’ll run the social-picks path against today’s real summary with a stubbed DM sender to prove it now splits into multiple messages instead of tripping the 2,000-char limit. - Assistant
I’ve confirmed Python 3.11.11 is available through pyenv, so I’m using that for the project virtualenv instead of the bare 3.8 interpreter that was breaking the debug utility. After the venv is up, I’ll install the repo deps there and run a stubbed end-to-end social-picks verification.
- Assistant
The
.venvcreation and dependency install is running now. Once that finishes, I’ll use.venv/bin/pythonfor the verification so the debug and repo scripts run against a consistent interpreter instead of the system one. - Assistant
The virtualenv is ready and the full repo requirements are installed into
.venv. I’m running one targeted verification now against today’s real April 9 summary with a fake DM sink that enforces Discord’s 2,000-character limit, so we can answer whether the picks are now sent one by one without another overflow. - Assistant
The venv is good. My first verification pass hit a
python-dotenvedge case from stdin execution, not the social-picks code itself. I’m rerunning with an explicit.envpath and the same Discord-length guard. - Assistant
The verification just caught a real bug in my first patch: I reused
chunk_long_content, but that helper lives onAttachmentHandler, notChannelSummarizer. I’m correcting that now and rerunning the same guarded verification. - Assistant
The helper is fixed in the right class now. I’m rerunning compile plus the same April 9 verification with the 2,000-character guard.
- Assistant
The core fix is verified. I’m doing one last sanity check that the debug utility itself runs under the new
.venv, since that was part of the original friction here. - Assistant
The issue is fixed in summariser.py. I also added
.venv/to .gitignore, created a project.venv, installed the repo requirements there, and verified the debug utility runs with./.venv/bin/python scripts/debug.py --help.On confidence: yes, I’m confident the specific failure is fixed. I verified the social-picks sender against the real April 9 summary with a fake DM sink that enforced Discord’s 2,000-character limit. The result was
6sent messages with lengths437, 1878, 417, 543, 477, 543, all under the limit. That means the 3 recommendations are now handled one pick at a time, with each pick sending its own core DM first; if a pick has lots of media, its asset URLs spill into follow-up DM(s) instead of crashing the whole send.One important nuance: it is not “exactly one Discord message per recommendation” anymore in the overflow cases. It is “one recommendation processed at a time, with extra asset follow-up messages if needed.” That is why this should now run reliably. The only remaining step is deployment; until this code is deployed, production will still have the old behavior.