Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(context-layer): send dream summaries as text (#92338)

Peter Kirkhama9e6c31f4d25
diff --git a/products/context_layer/backend/repo_lint.py b/products/context_layer/backend/repo_lint.py
index 087254b92398..e52f4ae8edac 100644
--- a/products/context_layer/backend/repo_lint.py
+++ b/products/context_layer/backend/repo_lint.py
@@ -279,7 +279,8 @@ fi
summary_file="${1:-}"
set --
if [ -n "$summary_file" ]; then
- set -- "$@" -F "summary=@$summary_file"
+ summary="$(cat "$summary_file")"
+ set -- "$@" --form-string "summary=$summary"
fi
if [ "$branch" != "main" ]; then
set -- "$@" -F "branch=$branch"
diff --git a/products/context_layer/backend/test/test_repo_lint.py b/products/context_layer/backend/test/test_repo_lint.py
index 1bac42377f9d..0996bf201266 100644
--- a/products/context_layer/backend/test/test_repo_lint.py
+++ b/products/context_layer/backend/test/test_repo_lint.py
@@ -1,6 +1,8 @@
+import os
import uuid
import shutil
import tempfile
+import subprocess
from collections.abc import Callable
from pathlib import Path
@@ -112,6 +114,45 @@ class TestRepoLint(SimpleTestCase):
def test_default_structure_is_clean(self) -> None:
assert lint_repo(self.root) == []
+ def test_publish_sends_summary_contents_as_text(self) -> None:
+ bin_dir = self.root / "bin"
+ bin_dir.mkdir()
+ (bin_dir / "git").write_text(
+ """#!/bin/sh
+if [ "$1" = "rev-parse" ]; then
+ echo "dream/2026-09-01"
+fi
+"""
+ )
+ (bin_dir / "curl").write_text(
+ """#!/bin/sh
+for arg do
+ printf '<%s>\\n' "$arg"
+done
+"""
+ )
+ (bin_dir / "git").chmod(0o755)
+ (bin_dir / "curl").chmod(0o755)
+ summary_file = self.root / "dream summary.md"
+ summary_file.write_text("Reviewed recent activity")
+
+ result = subprocess.run(
+ [self.root / "scripts" / "publish", summary_file],
+ cwd=self.root,
+ env={
+ **os.environ,
+ "PATH": f"{bin_dir}:{os.environ['PATH']}",
+ "POSTHOG_API_URL": "https://example.com",
+ "POSTHOG_PERSONAL_API_KEY": "test-key",
+ "POSTHOG_CONTEXT_LAYER_COMMITS_PATH": "/commits/",
+ },
+ capture_output=True,
+ text=True,
+ check=True,
+ )
+
+ assert "<--form-string>\n<summary=Reviewed recent activity>" in result.stdout
+
def test_valid_pages_in_every_directory_are_clean(self) -> None:
(self.root / "areas").mkdir()
(self.root / "areas" / "analytics.md").write_text(