Skip to content

Use paired tags for standing & per-turn context - #6701

Merged
salman1993 merged 4 commits into
mainfrom
codex/xml-standing-context
Aug 26, 2026
Merged

Use paired tags for standing & per-turn context#6701
salman1993 merged 4 commits into
mainfrom
codex/xml-standing-context

Conversation

@salman1993

@salman1993 salman1993 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Why

PR #6503 bundled a broader context compiler with several prompt-shape and telemetry changes, making it difficult to isolate whether paired XML-like top-level boundaries improve agent behavior. This keeps the follow-up experiment focused on framing only.

What

  • Replace top-level standing and per-turn bracket headers with paired tags while preserving inner section content and event/message framing
  • Carry only metadata already present in dynamic headers as attributes, such as thread counts, truncation, event type, and batch count
  • Preserve every section body verbatim so the model executes the exact bytes reviewed in Desktop
  • Keep routing metadata, event content, batching, and delivery behavior unchanged
  • Teach Desktop diagnostics to parse the new framing while retaining compatibility with archived bracket-framed sessions; ambiguous paired boundaries render as the complete captured prompt

Risk Assessment

Medium — the change is limited to agent prompt framing and diagnostic parsing, but it affects both standing context and every dynamic agent turn. Bodies and delivery behavior remain unchanged, and compatibility parsing remains for prior sessions.

References

Update — 2026-08-24

  • Addressed review feedback by removing entity encoding/decoding from the execution and diagnostic paths.
  • Added regressions for literal closing tags, placeholders, entity-looking text, ampersands, and authored boundary whitespace.
  • Verified cargo test -p buzz-acp (805 unit + 9 integration), Desktop tests (5,412 before the main sync; 5,439 in the pre-push gate), Desktop typechecking, and Tauri clippy/tests.
  • Live local relay startup and message ingestion passed. The live ACP reply step is blocked locally because installed Goose 1.0.23 no longer provides the documented goose acp command and no alternate ACP adapter is installed.

Update Aug 25, 12:13 EDT: Extended paired tags to per-turn top-level sections.

  • Converted context, conversation/thread context, event batches, and steer/interrupt boundaries without changing their inner bodies.
  • Preserved existing header metadata as attributes only; added no new prompt metadata.
  • Verified 806 Buzz ACP unit tests plus 9 integration tests, 5,441 Desktop tests, Desktop typechecking and formatting, and all differential pre-push lanes.

Update Aug 25, 13:58 EDT: Addressed framing review feedback.

  • Updated operational base instructions to reference the emitted <context> section and added a regression guard against stale [Context] instructions.
  • Restored batched steer/interrupt cardinality in Desktop diagnostic titles with focused coverage for both paths.
  • Verified 807 Buzz ACP unit tests plus 9 integration tests, 5,442 Desktop tests, Desktop typechecking and formatting, and every differential pre-push lane including Tauri clippy/tests.

Update Aug 25, 15:37 EDT: Hardened legacy transcript compatibility.

  • Semantic standing-context parsing now requires paired framing at the start and complete input consumption.
  • Historical bracket-framed personas keep literal balanced tag examples in their original section; malformed or mixed current framing displays as the complete captured prompt.
  • Added regressions for the reported legacy persona case and trailing unframed text; verified 60 focused parser tests, 5,444 full Desktop tests, formatting, and typechecking.

Update Aug 25, 16:31 EDT: Preserved slash-command prompt block boundaries.

  • Desktop now sets aside a valid connector-facing slash-command block only when the following block begins recognized paired framing, parses the semantic blocks normally, and retains the command as visible Prompt metadata.
  • Added an end-to-end transcript regression using the production three-block ACP shape, including the user bubble, author pubkey, event ID, and grouped prompt context.
  • Verified 113 combined transcript tests, 5,445 full Desktop tests, formatting, typechecking, and all applicable pre-push lanes.

Generated with Codex

@salman1993
salman1993 marked this pull request as ready for review August 24, 2026 19:23
@salman1993
salman1993 requested a review from a team as a code owner August 24, 2026 19:23

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 622628b650

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/src/features/agents/ui/agentSessionTranscriptHelpers.ts Outdated
@salman1993
salman1993 force-pushed the codex/xml-standing-context branch 2 times, most recently from 269f772 to 846cc40 Compare August 24, 2026 23:00
Signed-off-by: Salman Mohammed <smohammed@squareup.com>
@salman1993
salman1993 force-pushed the codex/xml-standing-context branch from 846cc40 to c9fbf45 Compare August 25, 2026 16:12
@salman1993 salman1993 changed the title Use paired tags for standing agent context Use paired tags for agent prompt sections Aug 25, 2026
@salman1993 salman1993 changed the title Use paired tags for agent prompt sections Use paired tags for standing & per-turn context Aug 25, 2026
Signed-off-by: Salman Mohammed <smohammed@squareup.com>
@salman1993

Copy link
Copy Markdown
Contributor Author

🤖 Paired closing tags give the model a clear signal for where each section ends, instead of relying on the next header to imply the boundary. Intuitively, that should make it easier to keep context, instructions, memory, and incoming events from bleeding into one another—especially as prompts get longer.

Signed-off-by: Salman Mohammed <smohammed@squareup.com>
Signed-off-by: Salman Mohammed <smohammed@squareup.com>

@atishpatel atishpatel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed exact head 2da5ff7a2847095a3b6705bf366d459a101b7201: approved — no actionable findings.

The change consistently applies paired top-level framing across modern/legacy standing context and per-turn sections without mutating section bodies. Attribute escaping is confined to generated metadata, and Desktop decodes only those attributes. The diagnostic parser fails closed to the full captured prompt on malformed/ambiguous framing, retains bracket-framed history compatibility, and preserves a connector-facing slash-command block separately from semantic context.

Independent validation on a dedicated clean worktree at this SHA:

  • cargo test -p buzz-acp: 807 unit + 9 lifecycle tests passed
  • cargo clippy -p buzz-acp --all-targets -- -D warnings: passed
  • cargo fmt --all -- --check: passed
  • Desktop pnpm test: 5,445 passed
  • Mutation check: removing quote escaping from generated attributes was caught by semantic_section_attributes_do_not_mutate_body
  • GitHub checks are green

@salman1993
salman1993 merged commit f177f49 into main Aug 26, 2026
53 of 55 checks passed
@salman1993
salman1993 deleted the codex/xml-standing-context branch August 26, 2026 16:05
wpfleger96 pushed a commit that referenced this pull request Aug 26, 2026
* origin/main:
  Use paired tags for standing & per-turn context (#6701)
  fix(cli): preserve signatures in event reads (#6884)
  refactor(db): finish replaceable event store extraction (#6777)
  Fix Admin feedback filter overflow (#6825)
  fix(desktop): stop pulsing addressed agents on send (#6873)
  fix(desktop): prioritize sidebar channel status (#6861)
  feat(desktop): hyperlink selected composer text on link paste (#6684)
  chore(release): release Buzz Desktop version 0.5.20 (#6839)
  feat(desktop): add KLIPY GIF search to composers (#5554)
  fix(desktop): respect automatic mention preference after send (#6837)
  fix(release): attribute desktop candidates to the operator (#6831)
  fix(ci): check out source in docker.yml merge job (#6833)

Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
wpfleger96 pushed a commit that referenced this pull request Aug 26, 2026
…c-agent-commit-identity

* origin/main:
  Use paired tags for standing & per-turn context (#6701)

Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
brow added a commit that referenced this pull request Aug 26, 2026
…ignment

* origin/main: (33 commits)
  feat(desktop): restore message quick reactions (#6892)
  Use paired tags for standing & per-turn context (#6701)
  fix(cli): preserve signatures in event reads (#6884)
  refactor(db): finish replaceable event store extraction (#6777)
  Fix Admin feedback filter overflow (#6825)
  fix(desktop): stop pulsing addressed agents on send (#6873)
  fix(desktop): prioritize sidebar channel status (#6861)
  feat(desktop): hyperlink selected composer text on link paste (#6684)
  chore(release): release Buzz Desktop version 0.5.20 (#6839)
  feat(desktop): add KLIPY GIF search to composers (#5554)
  fix(desktop): respect automatic mention preference after send (#6837)
  fix(release): attribute desktop candidates to the operator (#6831)
  fix(ci): check out source in docker.yml merge job (#6833)
  chore(release): release Buzz Desktop version 0.5.19 (#6828)
  Remove public relay signing key fallback (#6729)
  docs(nest): make commit attribution policy-neutral (#6707)
  fix(desktop-messages): preserve inline agent mentions with persistent addressing (#6793)
  Qualify canonical relay images for staged delivery (#6781)
  feat(desktop): persist agent addressing across composer messages (#6714)
  feat: navigate images across message threads (#6705)
  ...

Signed-off-by: Tom Brow <tomb@block.xyz>

# Conflicts:
#	.env.example
#	crates/buzz-db/src/push.rs
#	mobile/lib/shared/profile/user_cache_provider.dart
wpfleger96 pushed a commit that referenced this pull request Aug 26, 2026
…-history

* origin/main:
  feat(desktop): restore message quick reactions (#6892)
  Use paired tags for standing & per-turn context (#6701)
  fix(cli): preserve signatures in event reads (#6884)
  refactor(db): finish replaceable event store extraction (#6777)
  Fix Admin feedback filter overflow (#6825)
  fix(desktop): stop pulsing addressed agents on send (#6873)
  fix(desktop): prioritize sidebar channel status (#6861)
  feat(desktop): hyperlink selected composer text on link paste (#6684)

Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
mfethe1 added a commit to mfethe1/buzz that referenced this pull request Aug 26, 2026
wpfleger96 pushed a commit that referenced this pull request Aug 26, 2026
…enericize

* origin/main:
  Deduplicate ACP thread prompt context (#6706)
  Apply access policy when reusing channel agents (#6838)
  feat(sidebar): prioritize unread DMs in overflow navigation (#6842)
  feat(projects): add agent and CLI project-home support (#6590)
  feat(desktop): restore message quick reactions (#6892)
  Use paired tags for standing & per-turn context (#6701)
  fix(cli): preserve signatures in event reads (#6884)
  refactor(db): finish replaceable event store extraction (#6777)
  Fix Admin feedback filter overflow (#6825)
  fix(desktop): stop pulsing addressed agents on send (#6873)
  fix(desktop): prioritize sidebar channel status (#6861)
  feat(desktop): hyperlink selected composer text on link paste (#6684)
  chore(release): release Buzz Desktop version 0.5.20 (#6839)

Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
salman1993 added a commit that referenced this pull request Aug 26, 2026
…cp-sessions

* origin/main:
  fix(desktop): accent-colored mention badges that count thread mentions (#6900)
  Add Buzz benchmark evaluation layers (#6823)
  fix(desktop): show edited head content in thread panel (#6887)
  fix(desktop-tooltip): increase surface contrast (#6897)
  Deduplicate ACP thread prompt context (#6706)
  Apply access policy when reusing channel agents (#6838)
  feat(sidebar): prioritize unread DMs in overflow navigation (#6842)
  feat(projects): add agent and CLI project-home support (#6590)
  feat(desktop): restore message quick reactions (#6892)
  Use paired tags for standing & per-turn context (#6701)
  fix(cli): preserve signatures in event reads (#6884)
  refactor(db): finish replaceable event store extraction (#6777)
  Fix Admin feedback filter overflow (#6825)

Signed-off-by: Salman Mohammed <smohammed@squareup.com>

# Conflicts:
#	crates/buzz-acp/src/pool.rs
brow added a commit that referenced this pull request Aug 26, 2026
…ifications-pr

* origin/main:
  Add gated security reviews (#6816)
  fix(desktop): accent-colored mention badges that count thread mentions (#6900)
  Add Buzz benchmark evaluation layers (#6823)
  fix(desktop): show edited head content in thread panel (#6887)
  fix(desktop-tooltip): increase surface contrast (#6897)
  Deduplicate ACP thread prompt context (#6706)
  Apply access policy when reusing channel agents (#6838)
  feat(sidebar): prioritize unread DMs in overflow navigation (#6842)
  feat(projects): add agent and CLI project-home support (#6590)
  feat(desktop): restore message quick reactions (#6892)
  Use paired tags for standing & per-turn context (#6701)
  fix(cli): preserve signatures in event reads (#6884)
  refactor(db): finish replaceable event store extraction (#6777)
  Fix Admin feedback filter overflow (#6825)
  fix(desktop): stop pulsing addressed agents on send (#6873)
  fix(desktop): prioritize sidebar channel status (#6861)
  feat(desktop): hyperlink selected composer text on link paste (#6684)

Signed-off-by: Tom Brow <tomb@block.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants