Skip to content

feat(ask-person): the main flow of RFC-0014 - person.ask, the ticket, the resume link and the reply page (step 1) - #68

Merged
acn-ericlaw merged 2 commits into
mainfrom
feat/ask-person-main-flow
Nov 19, 2026
Merged

acn-ericlaw merged 2 commits into
mainfrom
feat/ask-person-main-flow

Conversation

@acn-ericlaw

Copy link
Copy Markdown
Collaborator

What

  • extensions/ask-person/ask_person.py: person.ask, the composable function a graph's hold path calls before it suspends for a person. The message names the graph (graph_id, description, node), the transaction (correlation_id, turn), the waiting calls as the loop returned them and the suspension's ttl; the function issues a signed, stateless ticket (v1.<payload>.<mac>: the canonical JSON of {g, c, t, k, e} and its HMAC-SHA256 under ask.ticket.key, base64url without padding, a previous key verifying after a rotation), builds the resume link and sends the whole message as one event to every route in ask.channels, best effort and in parallel - a local route, or a peer over the endpoint listed for it - knowing nothing of what a route does with it. kind: advice (a status update, an acknowledgement) travels with no ticket and no link.
  • The reply page and endpoint, mounted on the host: GET /ask/{ticket} verifies the ticket, identifies the person, reads the current wait from the engine by the reference graph's re-advice ({turn} on the allowlisted entry with the correlation id) and renders the form - approve or refuse with a note, an answer with the options offered, a call that runs on resume - and never resumes; POST /ask/reply with {ticket, decisions} verifies, identifies, validates the decisions, prefixes [who at time] to each tool call's note, sends {turn, decisions} to the entry the ask.graphs allowlist maps the graph id to, and passes the engine's status and body through; an expired ticket is a 410 without a call to the engine, a silent engine a 502. Identity by ask.reply.auth: none (development), proxy (the gateway's trusted header, the installation's SSO), oauth2 (PyJWT against the issuer's JWKS, discovered or given; the new ask extra), and a channel app's bearer with decided_by in every mode.
  • The host hook: EventApiServer.create_app(routes) and Platform.add_routes(mount) register an extension's own routes after the host's paths and before the catch-all.
  • tests/vectors/ask-person-vectors.json (72 cases: the ticket issued, verified, tampered, expired and rotated; the message validated in its fixed order and the event built; the re-advice and the resume requests; the outcomes), generated from the module and cross-checked - the first ticket's MAC reproduced with openssl dgst -hmac byte for byte - so the Node twin can implement the ticket from the file alone. tests/test_ask_person.py (100 tests): the vectors; the function on the bus with channels that take, refuse and miss the event; the page and the endpoint against a fake engine; the three auth modes with a signed RS256 token; the hook's ordering; the boot's refusals by name; health; inspect.
  • README, resources/application.yml, CHANGELOG Unreleased/Added 5, the root README's Scope paragraph, the ask extra (PyJWT[crypto]) in the extras and the dev extras.

Why

RFC-0014 (mercury-composable #653, Eric's concept and rulings R1-R8 of 2026-11-19), build plan step 1. The loop can wait for a person - a marked write, the ask row of loop spec 7.3 - and the graph suspends durably, but nothing carried a waiting call to anyone or brought a decision back except a request a developer typed. The main flow built here knows no channel and keeps no store: the engine waits, the pack delivers and collects, one reply path - the resume link - serves every channel, a GET shows and only a submit resumes, and the engine's at-most-once resume stays the authority. The agent-question app (step 3) will receive the event and automate the click as one channel among chat, mail and a topic.

Decisions taken in the build, for the review: the allowlist and the channel endpoints are YAML lists of {id, entry} / {route, url} maps or a=b,c=d text for a -D value (the flat configuration cannot enumerate a nested map); a bare number in ttl and the timeouts is seconds (the helper's grammar); a question's answer is never stamped (an ask row's decision has no note); a ticket part outside the base64url alphabet is a 400, never decoded leniently; only the current key issues, so a previous key cannot stand in for a missing one.

Gates: ruff OK, basedpyright 0 errors, pytest 704 passed and 74 skipped (the gated live tests); a boot through mercury-serve served the page, /health and inspect.

🤖 Generated with Claude Code

acn-ericlaw and others added 2 commits November 19, 2026 13:48
… the resume link and the reply page (step 1)

A graph's hold path calls person.ask before it suspends for a person; the
function issues a signed stateless ticket, builds the resume link and sends
one message event to the configured channel routes, knowing none of them.
The reply page shows the wait by the reference graph's re-advice and never
resumes; the reply endpoint verifies, identifies (none, proxy, oauth2, a
channel app's bearer), stamps who decided on each note and forwards the
resume through the ask.graphs allowlist. Platform.add_routes mounts an
extension's routes before the host's catch-all. 72 shared vectors, 100 tests.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@acn-ericlaw
acn-ericlaw merged commit 5fef533 into main Nov 19, 2026
5 checks passed
@acn-ericlaw
acn-ericlaw deleted the feat/ask-person-main-flow branch November 19, 2026 06:04
acn-ericlaw added a commit that referenced this pull request Nov 19, 2026
…main

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant