The release-group branch landed with test-only type errors and
unformatted modules, so mise run check failed before the cog could ship.
Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
Lidarr's album lookup matches titles only: it cannot say whether an album
really holds the requested track, and it returns nothing when Spotify's album
title differs from MusicBrainz's. Both are gaps this closes.
watch/musicbrainz.py searches recordings and returns the release groups that
hold that recording: release-group MBID, primary and secondary types, first
release date, credited artist and the track titles on each release. It spaces
calls by the documented one per second, retries 429/503, and returns nothing
on failure, so an import never breaks because MusicBrainz is down. Music
trackers use the same User-Agent string as the rest of the bot.
watch/music.py: MusicImporter takes an optional musicbrainz collaborator
(absent in the existing tests, so their behaviour is unchanged). When it is
present, _album asks it for the groups holding the track, and:
- choose_album prefers a candidate whose MBID is known to hold the track over
one that merely wins on release type,
- a dead end (no title match in the catalog) is resolved by looking up the
release group MusicBrainz named, by MBID,
- credited-artist filtering keeps "Various Artists" compilations out,
- any MusicBrainz error falls back to exactly the previous answer.
Tests came first: 11 unit cases for parsing, credit filtering, containment,
retry, throttle spacing and degradation, and 5 integration cases against a
scripted Lidarr edge for containment preference, dead-end resolution, the
compilation guard and the outage path. They failed before the module existed;
the full suite is 376 passed and ruff is clean.
Live check against the live MusicBrainz API (Avicii "Wake Me Up")
returned five credited release groups, including the studio album "True"
holding the track and the single. It confirms the ranking shapes and the
containment lookup; it also shows the honest limit: when the requested album
title is the single, the single is still what gets chosen, because switching
to a different album is not this function's call.
Not deployed. Branch is for the Buffy agent to merge and deploy.
Without the solver, YouTube logs an n-challenge failure and leaves formats
missing even when a file is produced.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
The quadlet cannot pass a path containing spaces, so the library folder is
now Music/YouTube.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
importplaylist monitors the release group that contains a requested track.
When Lidarr returned more than one match for the title, choose_album gave up
and the requester had to pick by hand; when a single was the only match, the
grab targeted an uncached single. Uncached singles are what stall against
TorBox on a plan-1 account, exceed the proxy timeout and make Lidarr retry
with yet another release — the Avicii singles were stuck in that loop.
Release groups now rank album > EP > single, with a plain edition ahead of a
compilation, live, remix, DJ-mix, mixtape, soundtrack or spoken-word edition.
The rank only breaks ties: a lone match is still selected, and two equally
ranked candidates stay ambiguous so the requester chooses.
Tests came first (tests/test_music_release_preference.py, 8 cases): studio
album over single, EP between the two, plain over compilation and live,
plain single over a remix edition, ties still ambiguous, typeless lookups
keeping the old behaviour, a lone single still selected, and the artist
check not being outranked. watch/music.py was changed only after those
tests failed. Full suite: 362 passed; ruff clean.
Not deployed. Branch is for the Buffy agent to merge and deploy.
Playlist reviews mixed "artist absent from MusicBrainz" with genuine album
ambiguity, so requesters had no path forward for artists the catalogue lacks.
Report that reason separately, keep album matching (including the manual
picker) to the Spotify artist so tribute/cover releases are never monitored,
and add `importplaylist youtube` (yt-dlp search or a pasted link, downloaded
into the Jellyfin music folder) plus `importplaylist ignore` for a permanent
skip. Failed downloads and ignored songs stop counting as review.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
A failing catalogue lookup aborted the whole import, leaving every later
song unresolved with no review label until the seven-day stall. Isolate
per-track failures, retry them while the job waits, surface them after
three attempts, and clear stale labels once a song arrives. Requesters can
now retry reviewed songs or pick their Lidarr album directly.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
The import guard already required verification, but no command could clear
the pending mutation, so a flagged playlist stayed stuck.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
DOGEBOT_PROXY (default http://10.77.0.1:3128, empty disables) is passed to
uv and pip inside the Red image; the home network reaches PyPI at ~30 KB/s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- tests/test_watch_cog.py + watch_helpers.py: the watch cog against a fake
media-preload on a real socket (spec-shaped JSON, bearer token), so the
generated client, httpx, httpcore and anyio all run. 21 tests; checked
against six mutations of watch.py, each caught.
- scripts/test-container.sh installs cog requirements the way Red's
Downloader does (pip -t lib, image's PIP_CONSTRAINT, lib appended after
the venv via DOGE_COGS_LIB). On the pre-constraint image 20 watch tests
fail with the 2026-11-09 production error; on the current image all pass.
- test_alignment_isolation: discover every core module instead of a hand
list that had missed guess, render, baseline, sampling and others.
- TESTING.md (the loop, good tests, layers) and CLAUDE.md for agents.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Guesses now see what's normal on the server: a weekly cached baseline from
24 random moments in the public channels (per-regular style numbers, message
shares, and a model-written culture summary from anonymised conversations),
and how the person compares with the regulars. `alignment baseline` rebuilds
and shows it; ALIGNMENT_BASELINE=off turns it off.
Each person's time zone comes from aikaterna's timezone cog (read from its
Config); Mountain Time otherwise. The dossier adds nickname, custom status
and roles, since bots can't read the About me bio.
scripts/experiments holds the harnesses and results: the baseline moved
Chaotic Neutral from 9/10 to 8/10; per-axis scores didn't repeat between
identical asks, so relative ranking of scores was dropped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L
Activity hours, late nights, weekends and transcript headers use
ALIGNMENT_TIMEZONE (default America/Denver, so MST/MDT) until per-person
zones come from the timezone cog. tzdata is a requirement for hosts
without a system zone database.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L
- Context: around a couple of their messages on each sampled page, fetch
the channel conversation. core/conversations.py merges quick consecutive
messages into turns, splits conversations at 20-minute lulls (replies
stay with what they answer), trims around the person and renders
transcripts with others as A, B, ...; people who blocked guesses are
hidden, bots left out.
- core/activity.py: posting rate between sampled pages over the years
and its variation, busiest UTC hours and spread, nights and weekends,
burstiness, run length, length and style shares.
- Avatar: ImageMagick palette with colour names, and a description from
the model's vision (Qwen3.5 has it).
- core/guess.py: dossier packed to a token budget (default 32k,
ALIGNMENT_CONTEXT_TOKENS) round-robin across the history; page count
follows the budget. Discord markup is tidied first: raw text ran at
1.6 chars/token, tidied 2.4, which cut one real prompt from 34k to 14k
tokens. New candid, debiased system prompt; temperature 0.3.
- gather.py holds the Discord fetching; the cog shows progress.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L
alignment guess used the last 35 messages in the 8 busiest channels. It
now uses Discord's guild message search (author filter, channels the
viewer can see) to reach the person's whole history: core/sampling.py
picks 8 random pages across all of it, walking past the 10,000-result
offset limit with max_id windows, keeps 5 random messages with text from
each, and picks 35. Search allows about one request per 5 seconds, so
that's ~40 s; 70 single random messages took over two minutes on a real
10,193-message history. Falls back to scanning channels without search.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L
- alignment suggest/suggestions/accept/reject, with Accept/Reject buttons
that survive restarts (DynamicItem); model guesses are suggestions too.
- Custom charts (core/spec.py): title, column and row names, per-cell
labels and colours; entries keep their classic position. Used in
pictures, text, parsing, autocomplete and YAML export/import.
- alignment guess: up to 35 recent messages to an OpenAI-compatible local
model, answer constrained by a JSON schema to the chart's labels;
alignment guessing to opt out.
- Text through ImageMagick's Pango coder when present, so emoji and other
scripts fall back to fonts that have them. Names are escaped for Pango
and for ImageMagick's %[fx:], %w, \n and @file escapes, which Pango text
otherwise expands (tested).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L
test-container runs the suite inside dogebot's Red image on yveltal, with
its ImageMagick 6, fonts and the cogs' info.json requirements, and is part
of mise run check. It fails on the copy_alpha bug that reached the bot.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L
Draw the chart with ImageMagick: one 3x3 picture, or nine tiles sent as a
Components V2 media gallery (3x3), with avatars cut into circles. Names and
avatars are looked up live; people who left are greyed out.
Move all logic into doge_alignment/core, which imports neither discord.py
nor Red: immutable Chart dataclasses with pure operations, Config/YAML
storage, a view model, pure layout geometry, a Wand painter and an avatar
fetcher. The cog and a new CLI (python -m doge_alignment) are front ends.
Commands are now one hybrid `alignment` group (text and slash): show, set,
remove, prune, clear, style, export, import, admin add/remove/list. Red's
admin/mod roles, Administrators and the server owner count as admins.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L
Fixes:
- setting or removing an alignment dropped the server's admin list
- charts were YAML files inside the cog folder, which Downloader replaces
on every update; they now live in Red's Config
- the cog imported Wand (ImageMagick) at load time and couldn't load
where ImageMagick is missing, such as dogebot's container
- info.json pip-installed this whole repo, red-discordbot and discord
included, into Red's lib folder
- /alignment_remove_admin let the bot owner past one check and then
refused them at the next
Structure: the cog folder is self-contained like watch. chart.py holds
the rules as pure functions; render.py keeps the image helpers (grid
layout fixed, debug viewers removed) and is imported only when used. The
repo is now a uv virtual project (no package build), with Red pinned to
dogebot's 3.5.24.
Standards: ruff with the lptn settings, ty and annotations, and pytest
(chart rules, Config storage and red_delete_data_for_user on Red's test
backend, image helpers) now cover both cogs; 52 tests. Missing features
are listed in doge_alignment/TODO.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L
`[p]watch <title>` asks the home lab's media-preload service to cache a
movie, a season, some episodes or the next N unwatched episodes, and
keeps a progress message (with a Cancel button) updated until done.
`link`/`unlink` store a Jellyfin user name for "next"; `status` and
`cancel` work on request ids.
The API client in clients/media-preload-client is generated from the
service's OpenAPI spec with openapi-python-client (`mise run
generate-client`); the cog installs it from this repo via info.json.
Also: ruff target py311 (Red 3.5's Python), a dev group with the client,
pytest, ruff and ty, and mise tasks. Lint and type checks cover the new
cog; doge_alignment is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L