Skip to content

[feat] Add {{mustache}} rendering (prompt unification WP-B3)#4393

Open
junaway wants to merge 18 commits into
release/v0.100.2from
feat/add-mustache-rendering
Open

[feat] Add {{mustache}} rendering (prompt unification WP-B3)#4393
junaway wants to merge 18 commits into
release/v0.100.2from
feat/add-mustache-rendering

Conversation

@junaway
Copy link
Copy Markdown
Contributor

@junaway junaway commented May 21, 2026

Summary

Implements WP-B3 of the prompt runtime unification RFC: adds mustache as the fourth prompt template_format and makes it the default for newly created apps, prompt configs, and LLM-as-a-judge evaluators. It builds on the low-level renderer from WP-B1 and the structured renderer from WP-B2.

mustache is real Mustache (via the mystace engine) plus the one Agenta extension every format already carries: tags that start with {{$ are resolved as JSONPath against the render context. Existing curly, fstring, and jinja2 prompts are untouched — old apps keep their declared format, and only new creation paths write mustache.

This is primarily a backend/SDK package. The frontend changes are the minimal type-and-picker surface needed to load, preserve, and select mustache; the larger playground/native-JSON work stays in the frontend follow-up packages (WP-F2/F3).

What's in it

SDK rendering (sdks/python/agenta/sdk/utils/)

  • templating.py — new _render_mustache(...); TemplateMode widened to include "mustache". Rendering follows the same shield-and-substitute model the other formats use: {{$...}} JSONPath tags are shielded from the engine, the rest is rendered by mystace, and the resolved JSONPath values are substituted into the output last, as inert text — never re-parsed. Partials ({{>...}}), empty placeholders, JSON-Pointer tags, NUL bytes, and engine parse errors fail clearly.
  • types.pyPromptTemplate accepts mustache and keeps its public TemplateFormatError surface for chat/completion callers.
  • rendering.py — type-widening only; render_messages(...) / render_json_like(...) work unchanged once the mode is accepted.

Effect on the other renderers (curly / jinja2 / fstring)

Adding mustache was done by extracting one shared {{$...}} JSONPath helper (_render_with_jsonpath) rather than a mustache-only path, so the other formats are touched to varying degrees:

  • curly — functionally equivalent. Its output is unchanged: it already resolved {{$...}} as inert data, and resolvers.py has zero diff. It is now the reference behavior the other two {{ }} formats match, rather than a special case.
  • jinja2 — refactored onto the shared helper, behavior preserved. _render_jinja2 no longer renders directly; it routes through _render_with_jsonpath, so {{$...}} is shielded from Jinja, the engine runs, and resolved values are substituted last as inert data ({% raw %} / {# #} spans are skipped and left to Jinja). Same rendered output, now sharing curly's JSONPath contract.
  • fstring — untouched. Still template.format(**context); no JSONPath, no change.
  • One error-contract change that spans all formats (but is only newly observable for mustache/jinja2). The TemplateFormatError message for unresolved variables now interpolates the actual template_format instead of the hardcoded literal "curly" (types.py, both the chat/completion and structured paths). For curly the wording is identical to before ("…in curly template…"). What changed is that, after the JSONPath unification, an unresolved {{$...}} tag can now raise UnresolvedVariablesError from mustache and jinja2 too — so the interpolation is what keeps their error message correctly labeled (previously they would have been mislabeled "curly"). fstring never raises this error (it uses str.format, surfacing KeyError), so for fstring the branch is dormant — the change applies to it in principle but is not currently triggerable.

Engine config (sdks/python/agenta/sdk/engines/running/)

  • interfaces.py — the mustache default lands here for all three workflow types:
    • llm_v0_interface: the template_format schema scalar widens its enum to ["mustache", "curly", "fstring", "jinja2"] and flips default from curly to mustache (this is what new LLM/completion apps inherit, and the dropdown default).
    • chat_v0_interface and completion_v0_interface: built-in default config flips "template_format" from curly to mustache.
  • handlers.pyauto_ai_critique_v0 learns a v5 default of mustache (v2 → fstring, v3/v4 → curly unchanged). An explicit template_format always wins over the version default; old judge revisions keep their original behavior.
  • builtin.py — the built-in auto_ai_critique template bumps to version 5 / template_format="mustache".

Backend resource (api/oss/src/resources/evaluators/evaluators.py)

  • LLM-as-a-judge evaluator definitions bump to version 5 and carry an explicit hidden template_format: "mustache" field, so newly created judges render with mustache.

Error contract

  • MustacheTemplateError — unsupported partial, empty placeholder, JSON-Pointer tag, NUL byte, or mystace parse error.
  • UnresolvedVariablesError — an unresolved curly placeholder or a failed {{$...}} JSONPath tag, in any of mustache / jinja2 / curly (cross-format parity).
  • TemplateFormatError — the public PromptTemplate surface, preserved.

Frontend (type + picker surface only)

  • template_format unions widened to include "mustache" across the editor token plugin, chat-message components, prompt schema control, and the shared chat-prompt extractor. mustache shares curly's {{name}} extraction/highlighting path.
  • New templateFormatOptions.ts: the picker now offers only mustache and jinja2 to new prompts. curly / fstring are legacy — hidden from the picker, but a prompt that already stores one keeps it visible and selectable (no silent coercion). Restores hiding that had regressed; pinned by a unit test.
  • Shared resolveTemplateFormat(...) is reused in the workflow molecule so mustache is preserved instead of coerced.

Docs

  • rfc.md — dependency choice (mystace vs chevron, with langchain_core considered and rejected), the three intentional Mustache deviations, the JSONPath compatibility requirement, and the security note (narrow context, never-re-parse).
  • _mustache-templates.mdx — draft how-to (variables, sections, {{$...}}, value coercion, what's unsupported, and escaping literal {{ }}).
  • escape-analysis.md — standalone analysis of the escape question raised in review: no backslash escape exists in mystace or langchain_core/chevron; the canonical literal-brace mechanism is the Mustache delimiter swap (and {% raw %} for jinja2). Decision: document now, defer a backslash escape unless real demand appears for literal {{ in curly.
  • findings.md, research.md, plan.md, qa.md, status.md, README.md — design workspace and review-findings record.

Compatibility

  • Existing apps remain on their declared format. curly / fstring / jinja2 behavior is unchanged.
  • Only new creation paths write mustache. Old judge revisions keep their per-version default.
  • Frontend never coerces a stored legacy format; it stays selectable for prompts that already use it.

Validation

  • cd sdks/python && uv run ruff format + uv run ruff check — clean.
  • cd sdks/python && uv run pytest oss/tests/pytest/unit -q — green (mustache coverage across JSONPath resolution, sections, value coercion, partial/empty/JSON-Pointer/NUL rejection, cross-format {{$...}} parity, PromptTemplate, and LLM-as-a-judge).
  • pnpm --filter @agenta/entity-ui test — picker and mustache-extraction regression pins pass.
  • pnpm lint-fix + types:check on the touched web packages — clean.

Copilot AI review requested due to automatic review settings May 21, 2026 10:44
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. feature labels May 21, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment May 26, 2026 11:43pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b19a16e-09c2-43ae-a11b-07ef8e8f32af

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR introduces comprehensive RFC and implementation documentation for the prompt-runtime unification effort, including the overarching problem space (RFC), the WP-B3 mustache rendering workstream specification, research foundation, multi-phase implementation plan, QA strategy, and status tracking, plus updates to the main documentation to cross-link and clarify the rollout behavior.

Changes

Prompt Runtime Unification and Mustache Rendering

Layer / File(s) Summary
Prompt Runtime Unification RFC - Problem and Solution Requirements
docs/design/prompt-runtime-unification/rfc.md
Defines the overarching RFC for unifying prompt variables, JSON handling, template formats, and runtime behavior across completion, chat, and judge services, including variable availability matrix, solution requirements, work packages, test plan, and future directions.
WP-B3 Mustache Rendering - Workstream Scope and Overview
docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/README.md
Describes WP-B3 purpose, scope requirements for mustache format support (nested-only dot lookup, selector resolution order, literal-brace escaping), frontend visibility rules for curly legacy mode, and SDK test coverage extensions.
WP-B3 Mustache Rendering - Technical Specification and Design
docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md
Detailed RFC specifying mustache as the fourth template format and new default, defining variable substitution semantics (dotted-name traversal, JSONPath/$, JSON Pointer handling), array indexing, value coercion, escaped-literal delimiter mechanism, and complete backend/frontend implementation design across renderer layers, prompt models, judge validation, and engine interfaces.
WP-B3 Mustache Rendering - Research and Technical Foundation
docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/research.md
Evaluates existing SDK renderer pipeline, validates candidate Mustache implementations (including langchain_core evaluation), and specifies the desired mustache subset with JSONPath/JSON Pointer and nested-only dotted lookup, plus escaping approach.
WP-B3 Mustache Rendering - Multi-Phase Implementation Plan
docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/plan.md
Seven-phase plan covering nested-only resolver introduction, library evaluation, low-level renderer extension with escaped delimiters, runtime adoption across prompt validation and entry points, new-app defaults, frontend preservation of curly/mustache rules, and documentation alignment.
WP-B3 Mustache Rendering - QA and Testing Strategy
docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/qa.md
Comprehensive QA plan defining test objectives across renderer behavior, library integration, resolver/structured rendering, call-site contracts, and new-app defaults, with detailed happy paths, compatibility regression targets, unsupported-construct expectations, test isolation/mocking guidance, and concrete pytest/lint commands.
WP-B3 Mustache Rendering - Status, Progress, and Decision Log
docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/status.md
Status tracking document recording WP-B1/B2 completion, progress log, WP-B3 decision set (mustache as variable-substitution, new-app defaults, delimiter escaping, legacy separation), no blockers, open questions about dependency/type scope, and immediate next steps with validation commands.
Main RFC Documentation - Updates and Cross-Linking
docs/design/prompt-runtime-unification/README.md
Updates to the top-level README clarifying mustache as the new default for fresh apps, hiding curly from new-app format selection while preserving it for legacy apps, adjusting WP-F2 rollout-plan wording, and adding wp-b3-mustache-rendering implementation-tracking entry.

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess whether it relates to the changeset. Add a description explaining the purpose of the mustache rendering implementation, key changes made, and any relevant context for reviewers.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title '[feat] Add {{mustache}} rendering (prompt unification WP-B3)' directly and clearly summarizes the main change: introducing mustache template rendering as part of the prompt unification work package B3.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-mustache-rendering

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the WP-B3 design workspace and updates the prompt-runtime-unification documentation set to describe introducing a mustache template mode (nested-only dotted lookup + brace escaping) as the default for newly created apps/prompt configs, while preserving legacy curly behavior for existing configs.

Changes:

  • Added a new WP-B3 documentation workspace (RFC, research notes, plan, QA plan, status tracking).
  • Added/updated the parent prompt-runtime-unification RFC to include mustache semantics and rollout sequencing.
  • Updated the prompt-runtime-unification README index to reference the new WP-B3 workspace and clarify new-app default behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/README.md Entry point for the WP-B3 workspace and its scope/files.
docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/status.md Tracks current decisions, open questions, next steps, and validation commands.
docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md Defines proposed mustache subset semantics, escaping, compatibility, and dependency evaluation plan.
docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/research.md Maps current runtime touchpoints and evaluates Mustache library options.
docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/plan.md Phased implementation plan for adding mustache support and defaults.
docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/qa.md Test strategy covering renderer behavior, compatibility, and call-site adoption.
docs/design/prompt-runtime-unification/rfc.md Parent RFC describing the broader runtime/frontend unification effort and template-format semantics.
docs/design/prompt-runtime-unification/README.md Index updates to reference WP-B3 and refine wording around defaults/curly visibility.
Comments suppressed due to low confidence (6)

docs/design/prompt-runtime-unification/rfc.md:46

  • The referenced implementation paths here look outdated for this repo checkout: PromptTemplate lives in sdks/python/agenta/sdk/utils/types.py, and the judge helper _format_with_template is in sdks/python/agenta/sdk/engines/running/handlers.py (there is no api/sdk/agenta/... path). Updating these links would keep the RFC actionable for readers.
* Config lives under `parameters.prompt`: `messages`, `template_format`, `input_keys`, and `llm_config`.
* Rendering goes through `PromptTemplate.format(**inputs)` in `api/sdk/agenta/sdk/types.py`, which supports `curly`, `fstring`, and `jinja2`.
* Completion exposes top-level `inputs` keys as variables. Chat exposes the same keys except `messages`, which is appended as typed messages after rendering (not exposed as a template variable).

**LLM-as-a-judge** is close in behavior but uses a separate runtime path.

* Config is a flat evaluator shape: `prompt_template`, `model`, `response_type`, `json_schema`, `correct_answer_key`, `threshold`, `version`, optional `template_format`.
* Renders messages through `_format_with_template` in `api/sdk/agenta/sdk/workflows/handlers.py`. It supports the same three formats as `PromptTemplate.format`; the default depends on evaluator `version` — `fstring` for v2, `curly` for v3+.

docs/design/prompt-runtime-unification/rfc.md:58

  • This “Current State” bullet about rendering behavior is no longer accurate in the current code: the judge path renders json_schema via render_json_like(...) and _format_with_template doesn’t ‘return original content with a warning’ for supported formats. Please update these bullets to match the current runtime behavior so the RFC doesn’t contradict the implementation.
* **Provider/model resolution.** Chat and completion use workflow provider settings; the judge manually extracts a fixed provider-key set and therefore cannot reliably use custom or self-hosted models configured in the UI.
* **Rendering.** Each service has different rendering behavior:
  * `PromptTemplate.format` raises on Jinja errors; `_format_with_template` returns the original content with a warning.
  * Chat and completion recursively render `llm_config.response_format`. The judge builds `response_format` from `response_type` / `json_schema` and does not render variables inside `json_schema`.

docs/design/prompt-runtime-unification/rfc.md:93

  • Markdown formatting issue: there are extra ** characters at the end of this bold sentence, which will render incorrectly. It should likely be a single bold span followed by a period.
The basic rule should be: **native JSON stays native until template rendering****.**

docs/design/prompt-runtime-unification/rfc.md:162

  • Several typos/grammar issues in this section reduce clarity: “All services (chat, completion, chat)” repeats chat; “providers settings” should be “provider settings”; and “The should all support …” is missing a subject (likely “They”).
* All services (chat, completion, chat) should resolve providers settings using the same path. As such:
  * The should all support custom/self-hosted models configured in the UI

docs/design/prompt-runtime-unification/rfc.md:163

  • This bullet has mismatched parentheses and is missing a closing parenthesis after “explicitly set”, which makes it hard to read. Consider rephrasing/splitting the sentence to avoid nested parentheses.
* LLM-as-a-judge must not inject unsupported optional parameters such as `temperature` (the default should be None unless explicitly set (just like we currently do in chat/completion).

docs/design/prompt-runtime-unification/rfc.md:176

  • Minor punctuation/spacing issues: there’s an extra space before the semicolon in “acceptable ;” and the sentence ends with “welcome..”. Cleaning this up will improve readability.
* The variables panel (right side of the playground) shows:
  * variables discovered from the prompt
  * variables available from the current testcase or trace context, labeled with source and type
* The prompt editor provides autocomplete for available variables. A degraded solution with only top-level autocomplete is definitely acceptable ; a full solution with full nested autocompletion is surely welcome..

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/design/prompt-runtime-unification/rfc.md Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (6)
docs/design/prompt-runtime-unification/rfc.md (2)

199-290: ⚡ Quick win

Clarify status of "JP's notes" sections.

The document contains four "JP's notes" sections (at lines 199-215, 225-232, 245-253, 276-290) that appear to be implementation details or developer notes. These inline notes may not belong in the formal RFC, or should be clearly marked as non-normative implementation guidance to distinguish them from requirements.

Consider either:

  • Moving these notes to a separate implementation guide or the WP-B3 planning documents
  • Clearly marking them as "Non-normative implementation notes" if they should remain
  • Removing them if they've served their purpose during draft review

144-145: ⚡ Quick win

Strengthen caveat about partial Mustache implementation.

The RFC mentions that mustache "do not implement the full mustache spec (no sections or partials)" but this critical limitation is embedded in a long sentence. Given that the WP-B3 RFC (lines 31-48) explicitly lists all unsupported features, users might be surprised if they expect standard Mustache behavior.

Consider adding a prominent callout or note immediately after introducing the mustache format to highlight that this is "Mustache-compatible variable substitution" rather than full Mustache. This aligns with the WP-B3 RFC's "Agenta's Mustache-compatible variable substitution mode, not full Mustache" language.

docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md (1)

57-58: 💤 Low value

Clarify why chevron is "too old" for SDK dependency.

Line 57 states "Do not use noahmorrison/chevron directly. It is too old for a new SDK runtime dependency." While the directive is clear, explaining why it's too old (unmaintained? incompatible? security issues?) would help future maintainers understand the decision.

Consider adding a brief explanation, such as:

Do not use `noahmorrison/chevron` directly. The package is unmaintained (last release 2016) and not suitable for a new SDK runtime dependency.
docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/research.md (1)

79-114: ⚡ Quick win

Consider flagging the dependency decision more prominently.

The evaluation recommends langchain_core.utils.mustache (line 98), but the dependency note (line 114) is somewhat buried. Since adding langchain-core to the SDK is a significant architectural decision, consider:

  1. Adding a decision box or callout at the top of the "Library Evaluation" section.
  2. Specifying concrete acceptance criteria for the Phase 2 spike (package size threshold, import time threshold, transitive dependency count).
  3. Defining a clear fallback plan if langchain-core is rejected (e.g., "implement local tokenizer using the reference patterns from langchain-core source").

This ensures reviewers and implementers understand the dependency is conditional and has an escape hatch.

docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/plan.md (1)

16-27: ⚡ Quick win

Consider whether Phase 2 timing is optimal.

Phase 2 (library spike) is scheduled after Phase 1 (resolver implementation). This ordering could lead to rework if the langchain_core evaluation reveals that its tokenizer or renderer has incompatible behavior that affects resolver design.

Two options:

  1. Move Phase 2 before Phase 1 - Evaluate the library first, then design resolvers around the chosen tokenizer.
  2. Keep current order - Design resolvers independently, then adapt the library integration to match Agenta's resolver contract (this is what the research doc recommends at line 98-106).

The current order is defensible if the resolver semantics are non-negotiable product requirements (which they appear to be). If so, consider adding a note in Phase 2 explicitly stating: "Resolver semantics from Phase 1 are fixed requirements; library integration must adapt to them, not vice versa."

docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/status.md (1)

50-57: ⚡ Quick win

Consider adding tentative recommendations for open questions.

The open questions are well-identified, but some could benefit from tentative recommendations to guide Phase 2 evaluation:

  • Line 53 (langchain-core acceptability): Add tentative threshold, e.g., "Proceed if package adds <5MB and <10 transitive deps; otherwise implement local tokenizer."

  • Line 54 (unsupported constructs): Add tentative direction, e.g., "Preferred: raise explicit UnsupportedConstructError with helpful message pointing to jinja2 for advanced logic."

  • Line 55 ({{.}} vs {{$}}): The note already recommends {{$}} and keeping {{.}} invalid - consider promoting this to the Decisions section if it's settled.

This would make Phase 2 (library spike) more deterministic without requiring another design review cycle.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e1e69858-cde0-4168-a9c4-8f86f6b690c5

📥 Commits

Reviewing files that changed from the base of the PR and between 5eef689 and 78ac5a4.

📒 Files selected for processing (8)
  • docs/design/prompt-runtime-unification/README.md
  • docs/design/prompt-runtime-unification/rfc.md
  • docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/README.md
  • docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/plan.md
  • docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/qa.md
  • docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/research.md
  • docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md
  • docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/status.md

Comment thread docs/design/prompt-runtime-unification/rfc.md Outdated
Comment thread docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/README.md Outdated
Comment thread docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/research.md Outdated
Comment thread docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md Outdated
Comment thread docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md Outdated
Comment thread docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md Outdated
Comment thread docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md Outdated
Comment thread docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md Outdated
Comment thread docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md Outdated
Comment thread docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md Outdated
Comment thread docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md Outdated
Comment thread docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md Outdated
Comment thread docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md Outdated
Comment thread docs/design/prompt-runtime-unification/wp-b3-mustache-rendering/rfc.md Outdated
@junaway junaway marked this pull request as draft May 21, 2026 11:41
Copilot AI review requested due to automatic review settings May 21, 2026 13:32
Copilot AI review requested due to automatic review settings May 22, 2026 10:08
@junaway junaway marked this pull request as ready for review May 22, 2026 10:12
@dosubot dosubot Bot added documentation Improvements or additions to documentation python Pull requests that update Python code typescript labels May 22, 2026
@junaway junaway changed the base branch from main to release/v0.100.1 May 22, 2026 10:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 38 out of 41 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • web/pnpm-lock.yaml: Language not supported

Comment thread web/packages/agenta-shared/src/utils/chatPrompts.ts Outdated
Comment thread web/packages/agenta-ui/src/Editor/plugins/token/TokenPlugin.tsx Outdated
Comment thread sdks/python/agenta/sdk/utils/types.py Outdated
Addresses three PR #4393 review findings (WPB3-018/019/020):

- chatPrompts.ts: extractVariablesFromText missed mustache/curly/jinja2
  tags with inner whitespace ({{ name }}). Mustache treats {{ name }} and
  {{name}} as equivalent, so the {{ }} patterns now allow optional spaces.
- TokenPlugin.tsx: the default-branch comment overstated coverage by
  claiming an "fstring fallback"; the {{ }} regexes do not match fstring's
  {...} placeholders. Comment corrected to state reality.
- types.py: PromptTemplate.template_format defaults to `curly`, but the
  field description called mustache the default. Reworded so the model
  default (curly, legacy compat) is distinct from the mustache default that
  app-creation flows/interfaces set explicitly.

Tests: whitespace token-extraction cases added to chatPromptsMustache.test.ts
(via the public extractPromptTemplateContext). entity-ui vitest 13 passed;
@agenta/shared + @agenta/ui types:check clean; entity-ui lint clean;
ruff format + check clean on types.py.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 22, 2026 10:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 38 out of 44 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • web/pnpm-lock.yaml: Language not supported

Comment thread docs/docs/prompt-engineering/integrating-prompts/_mustache-templates.mdx Outdated
Comment thread docs/design/prompt-runtime-unification/rfc.md Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

Railway Preview Environment

Preview URL https://gateway-production-fa33.up.railway.app/w
Project agenta-oss-pr-4393
Image tag pr-4393-048fb5d
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-05-26T23:49:13.717Z

jp-agenta and others added 2 commits May 22, 2026 13:37
Addresses two PR #4393 review findings (WPB3-021/022):

- _mustache-templates.mdx: the value-coercion table claimed dict/list
  render as compact JSON with "no extra whitespace" (e.g. {"x": 1}). The
  renderer uses json.dumps(ensure_ascii=False) with default separators, so
  the real output is {"x": 1, "y": 2} (spaces after : and ,). Reworded the
  row to match; renderer unchanged (curly-matching behavior is intended).

- Parent RFC + README: the {{$...}} description still used the superseded
  "pre-rendered as JSONPath ... then the resulting template is rendered"
  framing, implying JSONPath results are fed back through the engine. WPB3-010
  fixed only the wp-b3 doc set; this extends the same correction to the parent
  docs. Reworded every occurrence (rfc.md / README.md) to shield -> render ->
  substitute-last (inert data, never re-parsed); also tightened wp-b3 rfc.md.

Verification: render-helper + structured-rendering suites 185 passed (covers
all four modes incl. jinja2's shared-JSONPath path); ruff clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Make explicit in summary.md and web-handoff.md that adding mustache touched
the other renderers via a shared {{$...}} JSONPath helper:

- curly: functionally equivalent (output unchanged; now the reference behavior).
- jinja2: refactored onto the shared helper, behavior preserved.
- fstring: untouched.
- error-contract change spans all formats but is only newly observable for
  mustache/jinja2: the "Unreplaced variables in <format> template" message now
  interpolates the real format instead of the hardcoded "curly". curly wording
  is identical to before; fstring never raises this error so the branch is
  dormant for it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@junaway junaway changed the base branch from release/v0.100.1 to release/v0.100.2 May 26, 2026 19:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 38 out of 43 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • web/pnpm-lock.yaml: Language not supported

Comment on lines +32 to 38
// Default: {{ }} variable tokens only. Covers "curly" and "mustache" —
// mustache shares curly's {{name}} delimiters for plain variables, so it
// tokenizes through this path. (fstring also falls through to here, but its
// {...} single-brace placeholders are NOT matched by these {{ }} regexes.)
const full = /\{\{[^{}]*\}\}/
const input = /\{\{[^{}]*$/
const exact = /^\{\{[^{}]*\}\}$/
Comment on lines +295 to +298
except Exception as exc:
raise MustacheTemplateError(
f"Mustache template error in content: '{template}'. Error: {exc}"
) from exc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feature python Pull requests that update Python code size:XXL This PR changes 1000+ lines, ignoring generated files. typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants