feat(examples/chat): executable approval tools behind the hero's pause - #1011
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
The hero's approval beat replays an authored narration depicting behaviour the product does not have: measured live, the model produces either clarifying questions (0/14 plans) or a 5,800-character ops document (22/22 plans), against a 482-character shipped narration. The cause is structural — after approval the graph has no tools to call, so describing is its only move. Design: seed a backup inventory into the graph State so it rides the checkpoint, add list_backups and delete_backups, and put the interrupt inside the destructive tool so approval is enforced by code rather than by the system prompt. Render the inventory as a registered tool view. Blocked on the duplicate-submit HTTP 400, which lands first as its own change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…h State Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…dState Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… can delete Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…leanup requests to them Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…s and empty states Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…very demo mode Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…re is recorded live only Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…the result Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The recording is a real live stream now, so the replay drops its 30ms per-event floor (a 5s GenUI stream would have taken 23s) and the hero's two agents filter transcript tokens to the generate node the way the demo shell already does — the thread title, which only generates once the interrupted run completes, was landing on the finished answer and tripping the streaming-markdown contract. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…val turn The mobile capture moves to 5000ms after the panel detaches: the resumed answer is longer now, so the old 2800ms frame parked the cursor's arrowhead on the delete_backups chip. Timeline measured by sampling the DOM. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
blove
force-pushed
the
blove/hero-executable-approval-design-23b7b3
branch
from
September 5, 2026 17:15
1e8c345 to
8502a6c
Compare
blove
enabled auto-merge (squash)
September 5, 2026 17:15
Contributor
Contributor
Contributor
Contributor
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.
Why
The hero's approval beat replayed an authored narration describing behaviour the product did not have: after approval the graph had nothing to execute, so the model either asked clarifying questions or wrote a 5,800-character ops document. Spec:
docs/superpowers/specs/2026-09-04-hero-executable-approval-tools-design.md; plan:docs/superpowers/plans/2026-09-05-hero-executable-approval-tools.md.What
examples/chat/python/src/backups.py: a demo-owned inventory seeded into the graphState(rides the checkpoint, frozen clock so every thread starts identically),list_backups, anddelete_backupswhose FIRST statement isinterrupt()— approval is enforced by code, not by the system prompt. Retained or unknown ids are refused before any interrupt; anything but an unambiguous yes deletes nothing and hands the human's words back to the model.libs/chatchat-tool-views: a JSON-object string result (how a LangGraph ToolMessage carries a dict return) is parsed into view props. Without this a LangGraph tool view only ever sawargsandstatus.BackupTableComponentregistered as thelist_backupstool view on the hero and all three demo modes via onedemoViews()registry; the "Approve before a destructive action" chip now runs the hero's scenario verbatim.hero-replay.jsonand both posters re-recorded.Two things the new recording exposed
transcriptNodeNames: ['generate']the way the demo shell does. The thread title only generates once the interrupted run completes, so its tokens landed on the just-finished answer and tripped the streaming-markdown contract, which stopped the next turn from rendering. This affected the live takeover path too.Measurement gate (10 live runs, gpt-5-mini)
{ "runs": 10, "interrupted": 10, "list_backups_first": 10, "delete_backups_called": 10, "used_request_approval": 0, "median_chars": 196.0, "max_chars": 228, "remaining_rows_after_approval": [5] }Shipped narration was 482 chars; the pre-tools plan was a median 5,802. In 4/10 runs the model's first
delete_backupscall included a retained id, was refused, and it re-called correctly; the committed take has a single call.Tests
test_delete_without_approval_interrupts_and_deletes_nothing— mutation-checked by replacing theinterrupt()call, which turns it red. 82 passing.list_backups+delete_backupsin the prompt run and a compact resume answer. 192 passing; chat lib 1159 passing; website suite green.🤖 Generated with Claude Code