Skip to content

Ship stack A: edit a code-managed template with your agent #516

Closed

Description

@Silthus

Turns the integration branch spec/template-agent-edit into one reviewed draft PR on PostHog/posthog, per SHIP.md "Ship ticket". It covers Spec #502 stack A: #512, #503 and #509. The branch starts from spec/code-managed-templates at 07d7e0e, so the PR stacks on PostHog#118924.

wayfinder:ship

Activity

  1. self-assigned this
    on Oct 17, 2026
  2. Silthus commented on Oct 17, 2026

    @Silthus
    OwnerAuthor

    Runtime: T3 child task
    Task: node:delegated-task:command%3Amcp%3Afccb5a2f-b9fc-4c83-906b-f57b46974a4b%3Adelegate-task%3Awf-email-ship-516-1
    Cast: Opus 5.5, high. Cap 240 minutes. Ships spec/template-agent-edit at 8a50f6ef11c, stacked on PostHog#118924.

  3. Silthus commented on Oct 17, 2026

    @Silthus
    OwnerAuthor

    Note

    🤖 Opus 5.5 responding on behalf of Michael

    Resolution

    PR: PostHog/posthog#118980 (draft), branch Silthus:spec/template-agent-edit, stacked on #118924. Review starts after d746c355e26.
    Reviewed head: 0960e3de1162369dc6b77d8b3f9f9912562cab5c. fleet proof gate exits 0 on it.

    What shipped

    Review

    qa-swarm, because the diff extends a public API contract (read-only template fields, the MCP get tool) and adds devDependencies.

    Round HEAD Lanes Fixed Rejected
    1 (full) 069216473b7 GPT-6.1 Sol high: correctness, risk, design, systems, author perspective; Opus 5.5 high: fresh eyes, UI 10 3
    Live run 1 069216473b7 real app built from the branch 1 3
    2 (fixes) 5ff207cb20c same 7 lenses on the fix diff 7 0
    Final reads 1–4 fa25e693a33 → 0960e3de116 GPT-6.1 Sol high 2 0
    Live runs 2–3 5ff207cb20c, fa25e693a33 real app 2 1

    Fixed, among others:

    • Uploaded source.repository/path/ref went verbatim into a prompt an agent with repository write access runs. The builder now treats a value outside a repository, path or ref shape as unknown.
    • The Liquid scan was quadratic on unclosed {{ on every list and retrieve (8.4 s on 40k characters). It is now a forward scan (4 ms on 200k).
    • Two tickets built the variable list twice: the server scan, and a frontend regex over the server's prose. The server now returns change_prompt_variables.
    • Copy HTML file left a second preheader tag behind, and broke the round trip for Liquid holding &amp; or </title.
    • "Show full prompt" painted blank in Chromium. A scroll container inside the collapse inside the popover's 3D transform never paints, and global styles make every <pre> one.
    • Focus return, a second click on the button, Escape on the button, and Copy prompt pushed out of view.
    • message template duplicated now also fires on "Duplicate with my changes" and the library card.
    • A stale sentence is dropped when a reload points at another file.
    • One self-inflicted regression: a formatter rewrote two Django templates in 01cbef1d39e. Final read 1 caught it, and 158cccc1401 restores them byte for byte.

    Proof (HEAD 0960e3de116)

    • Live run in the real app, built from the branch on a scratch database, at 069216473b7 and fa25e693a33:
      • posthog-node upload from a git checkout; REST upload; base-written row; released and GUI templates;
      • the injection attempt is dropped from the prompt;
      • in Chromium at 1440 and 560 px: clipboard equals sentence + context, the full prompt paints, focus returns, Copy HTML file is byte for byte, edge cases parse back through the SDK, no write request;
      • an agent round trip edited only the file and re-uploaded.
      • 004b1bdc322, 3ae1cce0091 and 0960e3de116 came after the last browser run. Their proof is the render and API tests.
    • Prod shape: gap, accepted under the standing instruction (production read access from 2026-11-02).
    • Local gate on HEAD:
      • messaging backend 387 passed, mypy clean, ruff clean;
      • frontend tsgo clean; TemplateLibrary + Git jest 9 suites, 111 tests;
      • MCP typecheck, tool snapshots and name lint;
      • hogli build:openapi regenerated; pre-push ci:preflight --strict 0 failures.
    • CI: fork PR workflows wait for a maintainer to approve the run. Gap.

    Calls made (🤖, also in the PR's Decisions block)

    • Ran qa-swarm instead of a single review: the diff touches the public API contract and dependencies.
    • Kept upload validation as feat(messaging): upload, send and lock code-managed email templates PostHog/posthog#118924 built it, as the spec puts it out of scope. The builder decides what reaches the prompt instead.
    • Added a third read-only field, change_prompt_variables, so one scanner owns the variable list.
    • Moved "Copy prompt" above "Show full prompt".
    • Fixed the second click in this component, not in the shared Popover.
    • No frontend flag check on the button: only flagged uploads make a template code-managed, as for feat(messaging): upload, send and lock code-managed email templates PostHog/posthog#118924's tag and notice.
    • Graded the merge risk medium, so no shadow diff was owed.
    • Rejected: a pending state on the clipboard copy; feedback for Cmd+Enter on an undescribed sentence; renaming the side-menu label; rewording the path-less "Find the HTML file" line and the starter, which are the spec's text; blank lines left where preheader tags were removed.
    • CodeRabbit is retired on this repository, so it did not run.

    For stack B (#517, spec/template-request-change)

    Merging this branch changes things stack B builds on:

    Follow-ups

    • Shared Popover: Popover.tsx never calls refs.setReference, so a press on any popover's own trigger counts as outside. The trigger's click then reopens the popover. "Quick start" in the same header does the same.
    • Base PR feat(messaging): upload, send and lock code-managed email templates PostHog/posthog#118924: CodeManagedSource.tsx still renders an injected source value as a link in the page header. It should apply the same shape rule.
    • Lemon UI: a scroll container inside a LemonCollapse inside a Popover stays unpainted in Chromium. Other popovers with collapsible scrolling content may show it.
    • The library card's message template duplicated event has no test. messageTemplatesLogic has no test file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

wayfinder:shipReviewed draft delivery of an integration branch

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions