Repository navigation
Conversation
Records where issues live, the triage label vocabulary, and the domain doc layout, so the engineering skills read config instead of guessing. Issues point at this fork rather than upstream PostHog/posthog. Every gh command carries an explicit --repo, because a bare gh call starts resolving to upstream as soon as an upstream remote is added. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017H2QuJYDAMJMQtA7R3ZNnH
Adds POST/GET /api/projects/:team_id/workflow_llm_generations/ behind the workflows-llm-action flag: team-secret-token auth, per-project submit throttle, atomic Redis dedupe keyed by invocation and payload, and an AI-credit budget gate answered at submit. The Celery task runs two passes: the author's model generates text, then a pinned extraction model fills declared output fields under a strict JSON schema, with one retry for model-fixable failures, a shared 60s wall-clock budget, a flat 4096-byte envelope cap, and both passes billed as PostHog AI credits on one trace per run. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011XmQejLq5BhgHigZJUK97C
…al state Submit now accepts an optional wake_token minted by the caller and stores it on the generation record. Every terminal write - success, failure, capacity_unavailable via on_failure, and the task_revoked hook - produces a $workflows_llm_generation_finished internal event echoing that token, so the parked CDP job wakes without polling. The event is a wake-only signal: it carries no generation output, and the woken job still collects the result through the authenticated retrieve. Failure and pending TTLs rise to outlive the caller's new backup poll ladder (marks at 1, 3 and 5 minutes); a record that expired between marks would answer the next poll with a 404 the caller can only read as the feature being off. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmBZpwtzi7uKicgAdyv9yA
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A workflow author cannot make a workflow write text that adapts to the person it runs for. Personalizing beyond variable substitution means calling an LLM from their own backend and writing the result back, which most teams never do.
This is the bottom layer of a 4-PR stack implementing the Generate text spec. It ships the server side: the generation endpoint the CDP calls, and the Celery task that runs the model calls and signals completion.
Changes
POST/GET /api/projects/:team_id/workflow_llm_generations/, authenticated with the team secret token the CDP already holds, behind theworkflows-llm-actionflag (fail-closed, organization-aggregated).feature_unavailablewhen the flag is off, 429 withRetry-Afterfrom the 60/minute per-project submit throttle.wake_tokenminted by the caller. Every terminal write (success, failure, exhausted retries, revoked task) produces a$workflows_llm_generation_finishedinternal event echoing it, so the parked CDP job wakes without polling.feature_unavailable.long_runningqueue runs two passes: the author's model generates text, then a pinned extraction model (gpt-5.6-luna) fills declared output fields under a strict JSON schema. Zero declared fields skip the second pass.invocation_idplus a payload hash claimed with an atomicSET NX. No Django model, no migration.$ai_billable,ai_product: workflows) on one trace per workflow run. Submit gates on the org AI credit budget and answers over-quota as a 200 terminal failure without enqueuing.Note
Two decisions to sanity-check in review:
tach.tomlgains aproducts.workflows -> products.ai_observabilityedge for the model registry import (ai_observabilityis not isolated and has no facade; a facade would be a larger cross-product change), and byte-identical duplicate Generate text steps in one run intentionally share a generation (the payload hash is the separator, per spec).How did you test this code?
response_formatpass-through,minimalreasoning acceptance, route model coverage). No gateway credentials exist in this environment. The reasoning fallback (minimal, degrade tolow) is implemented and tested; the probes need a real gateway before rollout.Automatic notifications
Docs update
Docs, skills, and MCP updates ship in the top layer of this stack.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Orchestrated multi-agent implementation: Opus 5 implemented under strict red-green TDD, three Fable 5 reviewers (spec compliance, adversarial correctness, cleanliness/test quality) raised 17 findings, an Opus fix pass resolved them, and a Fable confirm pass verified each fix by reading the code and re-running the tests. Skills invoked: /tdd, /implement, /improving-drf-endpoints (via review lens), /writing-tests, /writing-pr-descriptions, /stacking-prs. Notable session decisions: rejected a scouted Django-model design in favor of the spec's Redis-only records; kept
gpt-5.6-lunaa workflows-local constant instead of adding it to the shared model registry to avoid a side effect on the AI observability picker. The review pass converted a read-then-write dedupe into an atomic claim and added the revoked-task handler that prevents forever-pending records.v2 revision (Fable 5, single session, human-directed): after review, the transport moved from constant polling to park-and-wake. This layer gained the
wake_tokenfield, the terminal-write wake event, and the raised TTLs. Skills invoked: /improving-drf-endpoints, /writing-tests, /writing-user-facing-copy, /stacking-prs, /writing-pr-descriptions. The spec deltas are recorded on issue #22 and in the updated blueprint artifact.