feat(ai): expose prompt config on fetched prompts - #4329
Conversation
|
Reviews (1): Last reviewed commit: "feat(ai): expose prompt config on fetche..." | Re-trigger Greptile |
|
|
Size Change: +1.5 kB (+0.01%) Total Size: 17.9 MB 📦 View Changed
ℹ️ View Unchanged
|
|
the cache-pollution test mutates only top-level properties. Since configs commonly contain |
marandaneto
left a comment
There was a problem hiding this comment.
left a test suggestion but not a blocker, LGTM
|
Fixed in cf01aff. The test now also mutates a nested value, so swapping structuredClone for a shallow copy would fail the test |
Problem
PostHog prompt versions can now store a
configobject next to the prompt content (PostHog/posthog#74264): model parameters, tools, or any agent configuration, versioned with the prompt and returned by the fetch endpoint. The SDK parses API responses into typed result objects, so the field is currently fetched and thrown away. Python counterpart: PostHog/posthog-python#801.Changes
PromptRemoteResultgainsconfig: Record<string, unknown> | null, always present on api/cache/stale_cache results (null when the version has none). The fallback result declaresconfig: undefined, matching how it handlesnameandversion.configor send a non-object shape read asnull(same tolerance as the existing "server ignored the label param" handling)structuredClone, so mutatingresult.configbefore spreading it into an LLM call cannot pollute later cache hits (this exact bug was caught by review on the Python PR; here it is prevented from the start)Release info Sub-libraries affected
Libraries affected
Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Claude Code authored this under my direction as the JS counterpart of PostHog/posthog-python#801. Four new tests (config through api and cache, stale-cache retention, cache-pollution guard, older-server matrix); the four existing full-equality metadata assertions now include
config: null, pinning the "config is always present on remote results" contract. The changeset file was written manually in.changeset/.