commit e0cddda9611916ad71612fe2209b48d7dd613849
parent 598403b5f1f10fd531d05931d4ea88eda1e5547b
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sun, 1 Nov 2026 01:37:18 -0400
editor: X's jar-age banner is three short lines — "X cookies are 3 h old (limit 60 min)", the one action for the login source in use, and the job it refused; no evidence line, no lead paragraph
The banner said the same instruction three times (headline, the jar line, the guard's sentence as evidence). A jar-age view is now `compact`: headline from the jar's age (loadCookieAlerts passes the jar it read to the builder), `fix` = "Refresh cookies (or Connect X account) on /settings — then Recheck." for the profile login or "Open x.com in Firefox — then Recheck." for the browser login, `detail` = the refused job (or the channel, or "N X jobs are queued") when there is one. Rumble's and every other banner are unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
5 files changed, 98 insertions(+), 13 deletions(-)
diff --git a/common/jobs/pacingGuard.test.ts b/common/jobs/pacingGuard.test.ts
@@ -275,9 +275,24 @@ test("the fresh-jar rule raises X's jar-age banner (the job refused at its start
assert.ok(x?.raisedAt && !x.clearedAt);
assert.equal(x.kind, "jar-age");
assert.deepEqual(x.jobs.map((j) => j.id), [bDone.jobId]);
- const view = buildServiceCookieAlerts(await readServiceCookieState(paths), { now: Date.now(), browser: "firefox" });
- assert.match(view.alerts[0]?.headline ?? "", /^X needs fresh cookies: press Refresh cookies \(or Connect X account\) on \/settings/);
- assert.match(view.alerts[0]?.headline ?? "", /open x\.com in firefox/);
+ // Three short lines: the age, the one action for the login source in use, the job it refused.
+ const st = await readServiceCookieState(paths);
+ const view = buildServiceCookieAlerts(st, {
+ now: Date.now(),
+ browser: "firefox",
+ xJar: { source: "profile", ageMinutes: 120, maxAgeMinutes: 60 },
+ });
+ assert.equal(view.alerts[0]?.headline, "X cookies are 2 h old (limit 60 min)");
+ assert.equal(view.alerts[0]?.fix, "Refresh cookies (or Connect X account) on /settings — then Recheck.");
+ assert.equal(view.alerts[0]?.detail, `Refused fetch-posts ${bDone.jobId} (${SLUGS[1]}).`);
+ assert.equal(view.alerts[0]?.compact, true);
+ const browserView = buildServiceCookieAlerts(st, {
+ now: Date.now(),
+ browser: "firefox",
+ xJar: { source: "browser", ageMinutes: 200, maxAgeMinutes: 60 },
+ });
+ assert.equal(browserView.alerts[0]?.headline, "X cookies are 3 h old (limit 60 min)");
+ assert.equal(browserView.alerts[0]?.fix, "Open x.com in Firefox — then Recheck.");
// A real challenge from X while the jar-age banner is up escalates it to a
// blocking alert, keeping the job it holds.
diff --git a/common/lib/serviceCookies.ts b/common/lib/serviceCookies.ts
@@ -516,6 +516,9 @@ export type ServiceCookieAlertView = {
canRecheck: boolean;
// The jobs the alert stopped (failed or cancelled), not yet re-run.
stoppedJobs: ServiceCookieJobView[];
+ // Drawn as headline + `fix` (one action line) + `detail` when it is not
+ // empty — no evidence line (X's jar-age banner).
+ compact?: boolean;
rerunAt?: string;
rerunJobIds?: string[];
};
@@ -561,6 +564,13 @@ export type ServiceCookieAlertsPayload = {
const STOPPED_STATUSES = new Set(["failed", "cancelled"]);
+// "45 min", "3 h", "16 days".
+function jarAgeText(min: number): string {
+ if (min < 120) return `${min} min`;
+ const h = Math.floor(min / 60);
+ return h < 48 ? `${h} h` : `${Math.floor(h / 24)} days`;
+}
+
function hhmm(isoText: string): string {
return isoText.slice(11, 16);
}
@@ -590,6 +600,9 @@ export function buildServiceCookieAlerts(
now: number;
browser?: string;
statusOf?: (jobId: string) => string | undefined;
+ // X's jar as read from disk: a jar-age banner's headline says its age, and
+ // its one action line matches the login source in use.
+ xJar?: Pick<XJarStatusView, "source" | "ageMinutes" | "maxAgeMinutes">;
},
): ServiceCookieAlertsPayload {
const alerts: ServiceCookieAlertView[] = [];
@@ -620,6 +633,46 @@ export function buildServiceCookieAlerts(
(e.evidence.channel ? `, ${e.evidence.channel}` : "");
const stale = !e.clearedAt;
const n = stoppedJobs.length;
+ // X's jar-age banner is THREE SHORT LINES, no lead paragraph (operator's UI
+ // rule): how old the jar is, the one thing to do for the login source in
+ // use, and which job it refused when it refused one.
+ if (stale && e.kind === "jar-age") {
+ const jar = opts.xJar;
+ const age = jar?.ageMinutes != null ? jarAgeText(jar.ageMinutes) : null;
+ const limit = jar && jar.maxAgeMinutes > 0 ? ` (limit ${jar.maxAgeMinutes} min)` : "";
+ const action =
+ jar?.source === "browser"
+ ? `Open x.com in ${browserName(opts.browser).replace(/^[a-z]/, (c) => c.toUpperCase())} — then Recheck.`
+ : "Refresh cookies (or Connect X account) on /settings — then Recheck.";
+ const queued = /^(\d+ X jobs? (?:is|are) queued)/.exec(e.evidence.line)?.[1];
+ const refused = job
+ ? `Refused ${job.kind ? `${job.kind} ` : ""}${job.id}${e.evidence.channel ? ` (${e.evidence.channel})` : ""}.`
+ : e.evidence.channel
+ ? `Refused an X job on ${e.evidence.channel}.`
+ : queued
+ ? `${queued}.`
+ : "";
+ alerts.push({
+ service: e.service,
+ label,
+ family: serviceFamily(e.service),
+ state: "stale",
+ kind: e.kind,
+ since: e.since,
+ raisedAt: e.raisedAt,
+ lastSeen: e.lastSeen,
+ count: e.count,
+ videos: e.videos,
+ evidence: e.evidence,
+ fix: action,
+ headline: age ? `${label} cookies are ${age} old${limit}` : `${label} cookies are past their age limit${limit}`,
+ detail: refused,
+ compact: true,
+ canRecheck: true,
+ stoppedJobs,
+ });
+ continue;
+ }
alerts.push({
service: e.service,
label,
diff --git a/editor/app/components/dashboard/CookieAlertsPanel.tsx b/editor/app/components/dashboard/CookieAlertsPanel.tsx
@@ -54,6 +54,15 @@ function AlertCard({
<div className="flex flex-wrap items-start justify-between gap-3">
<div className="flex min-w-0 flex-col gap-1">
<p className={`text-sm font-medium ${stale ? "text-destructive" : "text-brand"}`}>{alert.headline}</p>
+ {alert.compact ? (
+ <>
+ <p className="text-xs" aria-label={`${alert.label} cookies action`}>
+ {alert.fix}
+ </p>
+ {alert.detail && <p className="text-xs text-muted-foreground break-words">{alert.detail}</p>}
+ </>
+ ) : (
+ <>
<p className="text-xs text-muted-foreground break-words">
{alert.detail}
{alert.family === "forum" && channel && (
@@ -86,6 +95,8 @@ function AlertCard({
{alert.evidence.line}
</code>
)}
+ </>
+ )}
</div>
<div className="flex shrink-0 flex-wrap items-center gap-1.5">
{stale && alert.canRecheck && (
diff --git a/editor/app/lib/cookieAlerts.ts b/editor/app/lib/cookieAlerts.ts
@@ -44,11 +44,6 @@ export async function loadCookieAlerts(
const replayable = Boolean(live?.spec ?? meta?.spec);
if (status && replayable) statuses.set(id, status);
}
- const payload = buildServiceCookieAlerts(state, {
- now,
- browser: configuredCookieBrowser(),
- statusOf: (id) => statuses.get(id),
- });
// Never a request: a stat of the profile's jar, or (browser login) a cached
// name-only read of Firefox's store. A read that fails leaves `x` out.
let settings: ReturnType<typeof getSettings> | null = null;
@@ -57,13 +52,21 @@ export async function loadCookieAlerts(
} catch {
settings = null;
}
+ let x: Awaited<ReturnType<typeof readXJarAge>> | undefined;
if (settings) {
try {
- payload.x = await readXJarAge(paths, settings, { maxAgeMinutes: resolvedXMaxCookieAgeMinutes(settings), now });
+ x = await readXJarAge(paths, settings, { maxAgeMinutes: resolvedXMaxCookieAgeMinutes(settings), now });
} catch {
/* no X login to read */
}
}
+ const payload = buildServiceCookieAlerts(state, {
+ now,
+ browser: configuredCookieBrowser(),
+ statusOf: (id) => statuses.get(id),
+ ...(x ? { xJar: x } : {}),
+ });
+ if (x) payload.x = x;
payload.timer = serviceCookieTimerView(settings?.serviceCookies.recheckIntervalMinutes);
return payload;
}
diff --git a/editor/e2e/cookie-alerts.spec.ts b/editor/e2e/cookie-alerts.spec.ts
@@ -281,11 +281,14 @@ test("X: a fetch refused for an old jar raises the X banner with the jar's age;
await page.goto(`${baseUrl}/`);
const banner = page.getByRole("alert", { name: "X cookies" });
- await expect(banner).toContainText("X needs fresh cookies: press Refresh cookies (or Connect X account) on /settings");
- await expect(banner).toContainText("cookie jar past its age limit");
- await expect(banner.getByLabel("X cookie jar")).toHaveText(
- "The X cookie jar was written 3 h ago (limit 60 min): press Refresh cookies (or Connect X account) on /settings.",
+ // Three short lines, no lead paragraph: the age, the one action, the job it refused.
+ await expect(banner.locator("p").first()).toHaveText("X cookies are 3 h old (limit 60 min)");
+ await expect(banner.getByLabel("X cookies action")).toHaveText(
+ "Refresh cookies (or Connect X account) on /settings — then Recheck.",
);
+ await expect(banner).toContainText("Refused an X job on x-other.");
+ await expect(banner.locator("code")).toHaveCount(0);
+ await expect(banner).not.toContainText("X cookies were last refreshed");
await banner.screenshot({ path: testInfo.outputPath("x-cookie-banner.png") });
await page.screenshot({ path: testInfo.outputPath("x-cookie-banner-page.png"), fullPage: false });