Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

simplify daily stats Slack formatting (#3503)

kt1a4dde57b198
diff --git a/docs/daily-stats.md b/docs/daily-stats.md
index 366ff7b0ca..c4f084f217 100644
--- a/docs/daily-stats.md
+++ b/docs/daily-stats.md
@@ -11,6 +11,10 @@ the preceding seven-day window, and MAU with the preceding 30-day window. Succes
rate changes use percentage points. A zero baseline shows `new (baseline 0)`;
no completed runs gives an unavailable success rate.
+The Slack message marks increases with 🟒 ↑ and decreases with πŸ”΄ ↓; unchanged
+values keep a neutral arrow. These indicate direction, not whether a change is
+good or bad. A divider separates the metrics from the dashboard link.
+
Active users count anonymous installations that emitted `agent run completed`,
including successful, failed, and aborted runs. They do not count verified people.
Tokens sum `total_tokens`, including recorded cache usage; they do not measure
diff --git a/scripts/daily_stats.py b/scripts/daily_stats.py
index f389bd29e4..b875fc41e7 100644
--- a/scripts/daily_stats.py
+++ b/scripts/daily_stats.py
@@ -115,7 +115,7 @@ def change(current, previous, *, percentage_points=False):
else:
delta, unit = (current / previous - 1) * 100, "%"
delta = round(delta, 1)
- arrow = "↑" if delta > 0 else "↓" if delta < 0 else "β†’"
+ arrow = "🟒 ↑" if delta > 0 else "πŸ”΄ ↓" if delta < 0 else "β†’"
return f"{arrow} {abs(delta):.1f}{unit}"
@@ -148,10 +148,7 @@ def render_report(points, day):
lines.append(f"β€’ *Run success rate: {rate}* Β· "
f"{change(rates[day], rates[yesterday], percentage_points=True)} vs yesterday Β· "
f"{change(rates[day], rates[last_week], percentage_points=True)} vs last week")
- lines.extend([f"<{DASHBOARD_URL}|Open dashboard>",
- "Active users count anonymous installations with a completed run. "
- "Tokens are recorded usage, including cache; they do not measure cost. "
- "Test accounts and known benchmarks are excluded."])
+ lines.extend(["", f"<{DASHBOARD_URL}|Open dashboard>"])
return "\n".join(lines)
@@ -205,7 +202,13 @@ def main():
"refresh": "force_blocking", "async": False,
}, token=token, service="PostHog"))
text = render_report(parse_results(response, day), day)
- args.output.write_text(json.dumps({"text": text, "unfurl_links": False,
+ metrics, dashboard = text.rsplit("\n\n", 1)
+ blocks = [
+ {"type": "section", "text": {"type": "mrkdwn", "text": metrics}},
+ {"type": "divider"},
+ {"type": "section", "text": {"type": "mrkdwn", "text": dashboard}},
+ ]
+ args.output.write_text(json.dumps({"text": text, "blocks": blocks, "unfurl_links": False,
"unfurl_media": False}))
print("Report prepared and validated. Metric values were not logged.")
elif args.command == "send":
diff --git a/scripts/test_daily_stats.py b/scripts/test_daily_stats.py
index 037f1555ba..fb4b0b9b1d 100644
--- a/scripts/test_daily_stats.py
+++ b/scripts/test_daily_stats.py
@@ -119,20 +119,21 @@ class ReportTests(unittest.TestCase):
stats.parse_results(response, DAY)
def test_percentage_changes_and_zero_baselines(self):
- cases = [(100, 80, "↑ 25.0%"), (80, 100, "↓ 20.0%"),
+ cases = [(100, 80, "🟒 ↑ 25.0%"), (80, 100, "πŸ”΄ ↓ 20.0%"),
(100, 100, "β†’ 0.0%"), (0, 0, "β†’ 0.0%"),
(100, 0, "new (baseline 0)"), (None, 100, "n/a")]
for current, previous, expected in cases:
self.assertEqual(stats.change(current, previous), expected)
- self.assertEqual(stats.change(90, 80, percentage_points=True), "↑ 10.0pp")
+ self.assertEqual(stats.change(90, 80, percentage_points=True), "🟒 ↑ 10.0pp")
+ self.assertEqual(stats.change(80, 90, percentage_points=True), "πŸ”΄ ↓ 10.0pp")
def test_report_compares_complete_rolling_windows_and_success_rate(self):
report = stats.render_report(stats.parse_results(fixture(), DAY), DAY)
self.assertTrue(report.startswith("*Prime Agent Daily Stats (Oct 5, 2026)*\n"))
lines = report.splitlines()
- self.assertTrue(lines[2].startswith("β€’ *DAU: 100* Β· ↑ 25.0%"))
- self.assertTrue(lines[3].startswith("β€’ *WAU: 300* Β· ↑ 50.0%"))
- self.assertTrue(lines[4].startswith("β€’ *MAU: 700* Β· ↑ 40.0%"))
+ self.assertTrue(lines[2].startswith("β€’ *DAU: 100* Β· 🟒 ↑ 25.0%"))
+ self.assertTrue(lines[3].startswith("β€’ *WAU: 300* Β· 🟒 ↑ 50.0%"))
+ self.assertTrue(lines[4].startswith("β€’ *MAU: 700* Β· 🟒 ↑ 40.0%"))
self.assertNotIn("β€”", report)
self.assertNotIn("(UTC)", report)
for expected in ("DAU: 100", "↑ 25.0% vs yesterday", "↑ 100.0% vs last week",
@@ -163,7 +164,20 @@ class ReportTests(unittest.TestCase):
request.assert_not_called()
send.assert_not_called()
self.assertNotIn("95.0%", stdout.getvalue())
- self.assertIn("Run success rate: 95.0%", json.loads(output.read_text())["text"])
+ payload = json.loads(output.read_text())
+ text = stats.render_report(stats.parse_results(fixture(), DAY), DAY)
+ metrics, dashboard = text.rsplit("\n\n", 1)
+ self.assertEqual(payload, {
+ "text": text, "unfurl_links": False, "unfurl_media": False,
+ "blocks": [
+ {"type": "section", "text": {"type": "mrkdwn", "text": metrics}},
+ {"type": "divider"},
+ {"type": "section", "text": {"type": "mrkdwn", "text": dashboard}},
+ ],
+ })
+ self.assertIn("Run success rate: 95.0%", payload["text"])
+ self.assertTrue(payload["text"].endswith(f"<{stats.DASHBOARD_URL}|Open dashboard>"))
+ self.assertNotIn("Active users count", payload["text"])
def test_prepare_api_uses_fresh_blocking_query(self):
with tempfile.TemporaryDirectory() as directory, \