Skip to content

feat(agent-question): the store-and-forward inbox of the person an agent asks - RFC-0014 step 3 - #70

Merged
acn-ericlaw merged 2 commits into
mainfrom
feat/agent-question-app
Nov 19, 2026
Merged

acn-ericlaw merged 2 commits into
mainfrom
feat/agent-question-app

Conversation

@acn-ericlaw

Copy link
Copy Markdown
Collaborator

What

  • extensions/agent-question/agent_question.py, a standalone application on the package and the first channel of RFC-0014's Part II: a store-and-forward inbox for the person an agent asks, standing beside a chat, a mail server or a topic as one channel among equals. The main flow (person.ask, step 1) knows nothing of it and sends it the message event like any route. agent.question.inbox is the intake: a wait is upserted on (graph_id, correlation_id, turn) - a re-advice for the same turn updates the card rather than adding one - and an advice is appended; one instance orders a process's writes, and the row is committed before any push. Two inboxes behind one protocol: memory (development, the reference semantics) and PostgreSQL (psycopg 3 with the audit store's connection keys, statement timeout and failure logging by type and SQLSTATE; schema/postgres.sql with the change sequence question_inbox_seq and the partial unique index that makes waits upsert and advices append; purge.sql the installation's retention; dev/schema-apply.sh for the helper's development database).
  • The person's side under the host through Platform.add_routes: GET /questions/app (the page, cards grouped by transaction), GET /questions?since=<seq> (the replay a reconnecting device calls first - every row that changed since its cursor, with the cursor to continue from), GET /questions/events (the stream a connected device holds; Last-Event-ID is the same cursor; keep-alive comments from the host's setting), POST /questions/{id}/decide (the automated click: {ticket, decisions, decided_by} to the link's own base under the app's bearer, the outcome recorded and broadcast; accepted → answered, nothing waiting → expired, refused or unreachable → open with the outcome shown) and POST /questions/{id}/seen for an advice. A sweeper and every replay expire open waits past their expiry. Identity question.auth: none, proxy, oauth2, as the main flow's.
  • tests/vectors/agent-question-vectors.json (30 cases: the row a message becomes, the state an outcome leaves, the click's request, the reference inbox on a scripted sequence with its ids and change sequence), shared with the Node twin; tests/test_agent_question.py (48 tests: the vectors, the intake on the bus, the replay and the stream with keep-alives, a decision forwarded to a fake reply endpoint and broadcast, an advice seen, expiry, the proxy mode, the PostgreSQL statements on a recording fake and the record mapping, the hooks and the boot; a live PostgreSQL gated on AGENT_QUESTION_TEST_URL). README, resources/application.yml, CHANGELOG Unreleased/Added 6, a continuity fact and the session log.

Why

RFC-0014 (mercury-composable #653), build plan step 3, after the main flow (#68) and the Playground's hold path (mercury-composable #654). The person who must decide uses a device that is not always connected: the message is committed before any push, a reconnecting device replays everything open since its cursor and chooses which card to answer, and the engine stays the authority on an answer - a second device on the same card gets nothing waiting.

Defaults set without a ruling, for the review: the inbox defaults to memory with a boot warning (PostgreSQL for a deployment); the connection keys follow the audit store rather than one URL; the app keeps no retention key - purge.sql carries the installation's interval; a re-advice updates the row in place, so the spec's superseded state is not needed (states: open, answered, expired, seen); a refused decision leaves the row open with the outcome shown, since the graph re-notifies with the reason; timeout.ms is milliseconds by its name, the durations seconds.

Gates: ruff OK, basedpyright 0 errors, pytest 751 passed and 75 skipped; a smoke with the two pack applications chained and no engine behind them (a wait and an advice delivered, replayed with the link, the click reaching the reply endpoint and recording the absent engine's 502 with the wait left open, the stream and the page served).

🤖 Generated with Claude Code

acn-ericlaw and others added 2 commits November 19, 2026 15:15
…ent asks - RFC-0014 step 3

A standalone application on the package and the first channel of the
ask-a-person design: the intake upserts a wait and appends an advice, in
memory or PostgreSQL; the page, the replay by change sequence, the stream
with Last-Event-ID as its cursor, the automated click to the link's reply
endpoint under the app's bearer, and seen for an advice. 30 shared vectors,
48 tests, the schema, the purge and the development scripts.

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 480f20a into main Nov 19, 2026
5 checks passed
@acn-ericlaw
acn-ericlaw deleted the feat/agent-question-app branch November 19, 2026 07:21
acn-ericlaw added a commit that referenced this pull request Nov 19, 2026
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