Repository navigation
Conversation
…er_post_readback)
A builtin officer that files outbound drafts had no way to learn, on its own,
whether a post it asked for is live upstream, or which account its plugin's
venue session is signed in to: it escalated those questions to its owner.
officer_post_readback{plugin, venue, draft_id | post_ref | text, parent_ref?,
account?, project?} files a read-back for the plugin bound to the officer. The
plugin collects it (POST /plugin/v1/readbacks/claim, leased 15 minutes) and
answers found / absent / unknown with the post's ref and URL and the account it
saw (POST /plugin/v1/readbacks/{id}/answer). The answer becomes ONE
plugin.readback item in the officer's queue, in the answer's transaction, with
account_matches when both accounts are known. A read-back the plugin never
answers (3 hand-outs, or 6 hours) is answered unknown by muster itself.
A read-back sends nothing: it files, approves, retries and re-files no draft.
Only the owner's officer (outbound_drafts grant, as officer_post_draft) and the
owner's plugin bound to THAT officer; a draft_id must be the officer's own on
that plugin; the plugin routes see only the presenting plugin's rows, under the
owner's row-level security besides.
Migration 0210 adds plugin_readbacks (owned, forced RLS, personal share class;
renumber at merge if main moved).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…and pre-allow ledgers CI found three ledgers the first commit missed: the read-back routes are bearer-only plugin routes (csrf_ledger.golden), AnswerReadback reads the plugin's owner and is never reached by a server app (owner-read sites), and a builtin officer's session pre-allows officer_post_readback beside officer_post_draft. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
plugin_readbacks references plugins, so the fixture's TRUNCATE of plugins must name it too (CI shard 0: cannot truncate a table referenced in a foreign key constraint). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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
A builtin marketing officer had no way to settle "did the post for draft N go out, and on which account is the plugin's session?" by itself: it escalated those questions to its owner, who then had to check by hand. The plugin that posts already reads posts back after posting; this gives the officer a read-only way to ask it.
What
officer_post_readback{plugin, venue, draft_id | post_ref | text, parent_ref?, account?, project?}— offered withofficer_post_draft(builtin officer, type grantsoutbound_drafts). Files a read-back for the plugin bound to the officer. Sends nothing. At most 20/day and 5 unanswered per officer.messages):POST /plugin/v1/readbacks/claim {"limit":1-5}→200 {"readbacks":[{readback_id, venue, account, project, post_ref, text, parent_ref, draft:{draft_id, body, target_kind, target_ref, external_ref, status}|null, attempts, lease_until}]}; leased 15 min, re-handed out after a lapse.POST /plugin/v1/readbacks/{id}/answer {status: found|absent|unknown, post_ref?, url?, account_seen?, detail}→200 {readback_id, status, item_id}; first answer wins; 404 not this plugin's; 400 bad field; 409 officer gone.plugin.readbackitem in the officer's queue (subjectreadback:<id>), same transaction, with the request as filed andaccount_matcheswhen both accounts are known.unknownby muster (answered_by: "muster").plugin_readbacks(owned, forced RLS, personal share class; rls_off/RLSOn wired; every DB ledger test updated). 🔴 Renumber at merge if main moved (another officer PR may also add a migration).docs/plugins.md"Read-backs: is a post live?".Authz
Only the owner's officer and the owner's plugin bound to that officer: the tool refuses another owner's plugin, an unbound plugin and one bound to another officer;
draft_idmust be the officer's own draft on that plugin; claim/answer touch only the presenting plugin's rows (and RLS besides). The isolation walk now seeds a read-back of A's and checks B's plugin cannot tell it from a ghost.Alternatives rejected
POST /plugin/v1/messagesas anote: no new answer route, but the answer would be unstructured fenced text and not bound to the request (any message could claim to answer it).readback): reuses the claim channel but drags in approval, expiry and at-most-once semantics meant for posting — exactly what a read must never touch.Tests (red/green)
New
internal/api/plugin_readbacks_pg_test.go(4 tests). Red atorigin/main: does not compile (officers.ToolPostReadbackand the routes do not exist). Green at HEAD: 4/4 against a local Postgres. Mutation matrix (each restored after, positive control re-run green):outbound_draftsgrantTestReadbacksAreTheOwnersOfficerAndPluginOnlyTestReadbacksAreTheOwnersOfficerAndPluginOnly(plugin bound elsewhere)TestReadbacksAreTheOwnersOfficerAndPluginOnlyTestReadbacksAreTheOwnersOfficerAndPluginOnly(RLS still holds across owners: the isolation walk stays green, as it should)draft_idnot scoped to the officerTestAReadbackNamingADraftCarriesItsTextAndSendsNothingTestAReadbackThePluginNeverAnswersIsAnsweredUnknownAlso run locally (scoped
-run): route golden, plugin capability/door/server/team ledgers, isolation + principal walks, step-up and team-host tool ledgers, officer tool listings, and theinternal/dbmigration/RLS/share ledgers.make leakscanclean.🤖 Generated with Claude Code