The Slack App
maku-slack is the factory’s Slack App: a mention in a thread plans the work as one proposal, a maintainer’s Confirm or check mark files it and starts the work, and the broker’s signed webhooks tell the same thread how it goes. After filing, the thread answers questions about its task, and in channels that opt in, lets a linked maintainer stop a queued or running task or retry an escalated one behind a confirmation. Steering, every other approval class, and merges stay in the web UI; a forge.push approval has a card you can decide. A question from the run is linked in the thread, never answered there.
sequenceDiagram
participant U as Slack user
participant S as Slack
participant A as maku-slack
participant B as maku-broker
participant F as maku-factory
U->>S: @factory what to do
S->>A: app_mention (signed)
A->>B: handoff
A->>S: proposal message (metadata)
U->>S: Confirm, or a check mark
S->>A: block_actions or reaction_added (signed)
A->>B: run_create (sponsor, on_behalf_of, handoff)
B->>F: task
B-->>A: webhook (signed, ids only)
A->>S: thread line (end line edited in place)
Install
The umbrella chart installs the App as the subchart slack (charts/maku-slack), off by default. Turn
it on with values-slack.example.yaml, which
holds the four blocks that must agree. Helm cannot set one subchart’s values from another’s, so the
render checks them and fails naming the key that disagrees:
| Block | What it must say |
|---|---|
slack | the App: its image, issuerURL, roomsURL, and config (teamID, channels) |
maku.broker.webhooks | an entry named slack.principal (slack-app), network: cluster, url: http://factory-slack-app.<namespace>.svc.<clusterDomain>:8081/webhooks, existingSecret equal to slack.webhookSecret |
maku.broker.human.mcp.sponsored | an entry named slack-app |
maku-factory.config.api.sponsored | an entry named slack-app |
slack.enabled: false with a broker subscriber that still targets factory-slack-app fails too: every
event would go to a subscriber that does not exist, and the broker would disable it.
What it renders: one replica (factory-slack-app), its Service (events 8080, webhooks 8081,
metrics 9090), a ServiceAccount, a Role with get and update on factory-slack-threads alone, the
thread map, and the config built from slack.config plus the derived file paths and addresses.
The Secrets, by name:
slackSecretholdssigning-secret,bot-tokenandbot-user-id.principalSecretholdsclient-idandclient-secret, plusproject-idunder the preset: ZITADEL.webhookSecretholdssigning-key. The broker mounts the same Secret.
Exposure. Only POST /slack/events must be public, through expose.slack.
Network. slack.networkPolicy.mode must equal maku.networkPolicies.mode, and the App then
admits:
- Slack’s events from the gateway;
- the webhooks from the broker;
- the metrics from the scraper.
It reaches DNS, the apiserver, the broker’s :8080, slack.com and the IdP. The broker’s own policy
admits :8080 from the web front door alone, so the subchart adds room-broker-from-factory-slack-app,
which admits the App, and nothing else, to the broker’s :8080.
Off removes the App, its route, its ServiceMonitor and the maku-slack alert group. Without it the
factory loses:
- mention intake and proposals;
- thread lines;
forge.pushcards;@factory link.
MCP, the CLI and the web UI are unaffected.
The thread map survives upgrades. It is rendered with no data and kept on uninstall. A Flux
driftDetection or Argo CD sync still needs the ignore rule in
the chart’s README. An install
whose map already exists hands it to Helm first, as that README says.
Manifest
The App is one workspace’s: create it from this manifest, install it, and put the signing secret and the bot token in the secret store.
{
"display_information": { "name": "Factory" },
"features": { "bot_user": { "display_name": "factory", "always_online": true } },
"oauth_config": {
"scopes": { "bot": ["app_mentions:read", "chat:write", "reactions:read", "channels:history", "groups:history", "users:read"] }
},
"settings": {
"event_subscriptions": {
"request_url": "https://factory-slack.<domain>/slack/events",
"bot_events": ["app_mention", "reaction_added", "message.channels", "message.groups"]
},
"interactivity": { "is_enabled": true, "request_url": "https://factory-slack.<domain>/slack/events" },
"org_deploy_enabled": false,
"socket_mode_enabled": false
}
}Interactivity, and no slash command. Interactivity carries both kinds of button the App posts, a proposal’s Confirm and Cancel and an approval card’s two buttons. Its request URL is a setting of its own, apart from the Events request URL: the console keeps one under Event Subscriptions and one under Interactivity & Shortcuts, and both hold the same value, the App’s /slack/events. Slack signs a button press exactly as it signs an event, so one door with one signature check, one size cap and one workspace check serves both, and the body’s content type says which shape arrived (security). Both URLs change when the App moves (a cloud move, a new domain). Left stale, every button press gets Slack’s generic could not handle this payload while events still arrive, so mentions and replies work and no button does. After any move, press one proposal’s Confirm before anything else and check that maku_slack_app_requests_total{route="interactions"} rose (operations). The bot scopes do not change: chat:write covers chat.update (a card rewritten in place) and chat.postEphemeral (the line one clicker sees) as it already covers chat.postMessage. chat:write also covers the self-serve link’s answer, a direct message from the bot (chat.postMessage with the user’s id as channel, no im:write and no conversations.open) and, when that fails, chat.postEphemeral. users:read is optional: with it the link page names the Slack user by their handle, then their display name (users.info), without it by their id only; an App created from an earlier copy adds it under OAuth & Permissions and reinstalls.
Replies (a reply re-plans a proposal, and a filed thread answers five questions) need the message.channels (and, for private channels, message.groups) bot events: an App created from an earlier copy of this manifest must add them under Event Subscriptions in the Slack console and reinstall. The scopes (channels:history, groups:history) are already there. Without the events, mentions and check marks work as before and replies are never seen.
Config
maku-slack --config <file>, strictly decoded (an unknown key is refused).
| Key | Meaning |
|---|---|
teamID | Required. The one workspace served; any other workspace’s events are dropped |
channels | Required, at least one: <channel id>: {repositories: [owner/name], maxCostUSD, approvals, upkeep}. The repositories a proposal there may name, and the max_cost a check mark there sends (at least 0.01); repositories and maxCostUSD on the parent channel are optional when upkeep is set (dedicated upkeep channel) |
channels.<id>.upkeep | Optional: {repositories, routines?, notify?, digest?: {cron}}. Routes upkeep routine threads, breaker alerts, and periodic scorecards to this channel. routines filters by routine name when non-empty; notify defaults to [room.pr_opened, room.waiting_for_human, room.ended, routine.paused] and also admits room.merged and room.reverted ([] disables webhook posts); digest.cron is a 5-field UTC cron |
channels.<id>.approvals | Optional, default false: a forge.push wait in that channel is drawn as the card, and a press on it reaches the broker. Off, the wait keeps the text line, and a press on a card posted while it was on is answered “approvals are not turned on in this channel” with the room link, without reaching the broker. Turning it off is the fast rollback; it is not the authority, since a broker without human.slackDecide answers the route with a 404 and a press then says the factory could not be reached |
channels.<id>.intents | Optional, off (the default), shadow or on: whether tier 1 reads the replies of a filed thread that the phrase table does not know. shadow classifies each one, counts and logs it, and posts today’s unknown line. on is accepted and, until the read intents are served, behaves as shadow. Write it quoted or bare: YAML reads a bare off or on as a boolean, and the App reads it back as the word. Off is the rollback, and the fast one: tier 1 is never asked |
channels.<id>.collectReplies | Optional, default false: the channel’s agreement that its replies are stored, redacted, with the label the classifier gave them, for the broker’s retentionDays (30 by default) and then deleted. It needs intents shadow or on. A channel without it stores nothing a person typed |
channels.<id>.intentActions | Optional: the write actions the channel may offer, any of stop, retry, answer, steer, amend, each once. stop, retry and answer are served without needing intents: on — stop and retry on the phrase table (stop, stop it, how do i stop it, retry, try again) and as buttons on the waiting-for-human and escalated end lines, and answer on any free-text reply while the task waits on a question, each behind a ten-minute confirmation named to the presser while the broker’s human.slackStop, human.slackRetry or human.slackAnswer is on. steer and amend have no effect |
channels.<id>.notify | Optional: the webhook transitions that post a line in that channel, by full name. Absent means the four defaults (room.task_triaged, room.waiting_for_human, room.pr_opened, room.ended), so a run start, a review verdict, a budget notice and an approval close post nothing by default; room.merged and room.reverted rewrite the end line in place rather than posting a separate line (listing room.reverted in notify also posts a line of its own); [] means none. A name that is not a webhook type, a name listed twice, and a type the App draws no line for (room.task_received, room.run_ended, room.monitor_verdict) are refused at start. A card and its close follow approvals, not this list |
signingSecretFile, botTokenFile, webhookKeyFile, botUserIDFile | Required mounted files; each must be readable and non-empty, and the webhook key must parse (one or two base64 lines of at least 32 bytes): the App refuses to start otherwise, naming the field and never the content |
clientIDFile, clientSecretFile, projectIDFile, issuerURL | Required: the machine client at your identity provider, the project whose audience the token carries (preset: ZITADEL; generic takes audience instead, below), and the issuer (an absolute https URL; http is accepted only for a loopback host, in tests). The three files are checked at start like the others |
preset, tokenURL, scopes, audience | Optional. An empty preset is zitadel: the request above, projectIDFile required. generic mints at any OIDC issuer: tokenURL, else its discovery document’s token_endpoint, with scopes and audience sent as a parameter; projectIDFile is refused there. See identity |
brokerURL, roomsURL | The broker’s base URL, its human listener (http://<svc>.<ns>.svc.cluster.local:8080, no path: the App calls <brokerURL>/mcp), and the room pages’ base URL |
namespace | Where the factory-slack-threads ConfigMap lives |
escalatedHours | Optional, default 168: set it to the Factory’s spec.caps.escalatedHours, which the App cannot read. It words an escalated task’s If nothing is done, it stops in 7 days. (whole days as days, else hours); 0, no limit, says it stays parked. A negative value is refused |
eventsAddr :8080 | Slack’s events, POST /slack/events: the public route |
webhooksAddr :8081 | The broker’s webhooks, POST /webhooks: cluster only |
opsAddr :9090 | Metrics and the probes |
The App’s token is a client-credentials grant from your identity provider (preset: ZITADEL: the project-audience scope, openid and urn:zitadel:iam:org:project:id:<project id>:aud). The factory serves a Slack user listed in its onBehalfOf.slack, or, with onBehalfOf.slackLinks, one who linked themselves (self-serve link, The factory).
The broker needs one webhooks entry for the App (operations):
webhooks:
- name: slack-app
network: cluster
url: http://<svc>.<ns>.svc.cluster.local:8081/webhooks
events: [room.task_triaged, room.run_started, room.waiting_for_human, room.pr_opened, room.verdict_posted,
room.merged, room.reverted, room.budget_reached, room.ended, room.approval_closed, routine.paused]
repositories: [Smana/ai-native-ref]
secretFile: /etc/webhook/key # the key file the App mounts as webhookKeyFilenetwork: cluster; the port:8081is mandatory and the path is exactly/webhooks.eventsare the eleven above, by their full names: the broker refuses a short one. The App posts no line forroom.task_received,room.run_endedorroom.monitor_verdict, and none forroom.run_startedunless a channel’snotifylists it.room.approval_closedis what makes a card inert after the deadline or another surface’s decision, so a subscriber serving a channel withapprovals: truemust list it, androutine.pauseddelivers yield-breaker alerts for upkeep channels using bounded IDs and enums only.repositoriesis required.secretFileis the same key as the App’swebhookKeyFile: one or two base64 lines, each at least 32 bytes decoded.
Flows
Proposal. A mention is the request, in the person’s own words; no template. A mention carrying a GitHub pull request URL and review drafts a review plan (one read-only reviewer verdict on that pull request). The App calls handoff (and the broker’s plan re-validation for the canonical plan hash and offered workflows) and posts one plan message (Plan v1) in the thread: the repository, the issue (with the planner’s suggestion when the repository’s catalogue answered — no merge policy or outcome is named before a pull request exists), and one workflow card section (Workflow, Will run, Cost), then Confirm and Cancel. The broker stores the plan for 24 hours under its handoff id; the message’s metadata (factory_proposal: id, hash, author, rev, repo) carries the handoff id and revision rather than the plan body. A plan the composer wrote because the planner could not is labelled as such. When the plan’s author maintains the repository and the re-validation offers workflows, the message also carries a static select whose first option is Factory's choice: <workflow> and whose other options carry each workflow’s bare name, description and dollar ceiling (trimmed at a word boundary within Slack’s 75-character option description limit); nothing for anyone else, nor while a gap remains. Choosing a workflow pins it: the App has the broker re-validate the stored plan with {id, on_behalf_of, workflow} (no model call, no daily plan) and redraws the message as the next revision with its new hash; Confirm binds the hash shown, so a Confirm on the hash the select replaced is refused plan_changed. The broker checks the pin against the presser’s own catalogue, so a person who is not a maintainer is refused not_maintainer in an ephemeral line and the message stays as it was. A refused plan is one Not proposed: … line per closed reason. With planning off or unavailable on the broker, a mention answers the fixed line Planning is not available here; file on GitHub.. In a thread that already holds a proposal whose planner later went away, a reply or a mention is told Not re-planned: this deployment no longer plans from Slack; … and nothing is planned beside it. The two refusals made before the planner is asked — a request past 16 KB and a thread already filed or cancelled — stay the proposal’s, with its lines, and count as a proposal mention.
- A slow plan says so. When
handoffhas not answered after 4 seconds, the App posts onePlanning…message in the thread. The proposal then replaces that message in place (same message, same buttons rules); when Slack refuses the edit, the proposal is a new message and the status is edited toPlanning finished.. A refusal also edits it toPlanning finished.and says the refusal below it. A plan that answers inside 4 seconds posts no status. - A refused first mention orients.
not_linked,repository_not_allowed,repository_not_served_here(the request names a repository this channel does not serve),repository_served_elsewhere(one the factory serves, but not from this channel) andno_writeare causes the person can fix, so the App says the cause, the fix (@factory link, or the repositories this channel serves) and the rooms page in achat.postEphemeralonly the mentioner sees (chat:writecovers it, no new scope), in the thread. When Slack refuses the ephemeral, the same line is posted in the thread. The thread itself stays clean. - A reply re-plans. A reply by the mention’s author continues the stored handoff (
handoffwith{id, answer}) and updates the same message in place, so its buttons always bind the plan they sit under. Changed sections are marked, and when a hashed field moved (the repository, the budget, an issue’s title, body or class, the roles or their order) the header saysrequires a new confirmation. At most 40 revisions per proposal. When Slack refuses the edit, the App posts the revision as a new message and makes the replaced one inert. - A plan that asks posts its question. When the planner asks one question (the plan still carries a
[NEEDS CLARIFICATION: gN …]marker, outcomeasked), there is nothing to confirm yet: the App postsThe plan needs one answer first. The planner asks: <question>, the planner’s recommendation, and how to answer (reply with the answer, or replyaccept the restto take the recommendation), and makes inert a proposal that plan supersedes. The author’s reply continues the handoff ({id, answer}, or{id, acceptRest: true}foraccept the rest); the broker asks at most one question per handoff (the planner), so the plan that comes back is the proposal with Confirm. The message’s metadata (factory_plan_question:id,author,rev) carries no plan, so nothing is filed from it. - Confirm is a maintainer’s: it files the stored plan through
run_createwithhandoffandplan_hash, the same path as a check mark, and rewrites the message into the Filed line. An expired handoff answersNot filed: this proposal expired; mention me again to plan it.. The presser alone is told why a press filed nothing (Not filed: a newer revision of this proposal is in this thread; press that message's buttons., a repository the channel no longer serves, a hash that no longer binds the plan, and the check mark’s refusals below). - Cancel is the author’s alone (anyone else is told
Only @author cancels this proposal; a maintainer confirms it.); it rewrites the message intoProposal cancelled by @author; mention me again to plan another., with no buttons, and starts nothing. - A check mark on the proposal is the fallback for Confirm: the same checks and the same filing, answered in the thread.
After filing, the thread answers questions. A reply in a filed thread is matched, lowercased and without its closing ?, . or !, against a closed list of phrases, and answered from the room the Filed line names — never from the thread’s text:
| Ask | Answer, from |
|---|---|
status, how is it going, where is it | State:, the issue, Budget: $X of $Y (Z %) (so far until spendFinal), Merge: with the gate’s decision once there is one, and the room link (task) |
needs me, what needs me | one line per task ordered by the five inbox types (question, plan, review, blocked, failed) with its action and link, or Nothing waits on this task right now. (inbox) |
what changed, what has changed | the ten newest milestones, then More: the room page (task) |
the pull request, pr, the pr | its number and link, or No pull request yet in this room. (task) |
stop, stop it, how do i stop it | with stop in intentActions, a ten-minute confirmation (@<user>: stop task #<issue>? Its run ends now and the pull request stays open.) with Stop the task and Cancel; without it, I can't stop a run from here. Apply the `factory/stop` label on the issue, or use Stop on the room page: <link> and no broker call |
retry, try again | with retry in intentActions, a ten-minute confirmation (@<user>: retry task #<issue>? It runs again from where it stopped.) with Retry the task and Cancel; without it, I can't retry a task from here. Comment `/factory retry` on the issue, or open <link> and no broker call |
run it again deeper, retry deeper, retry with careful | with retry in intentActions, a ten-minute confirmation naming the target workflow and total ceiling (@<user>: run task #<issue> again under <workflow>? It may spend up to $<ceiling> in all.) with Run again deeper and Cancel; without it, same fallback as retry |
| anything else | (in a channel with intents shadow or on, also read by tier 1, which changes nothing the thread shows) I only understand these here: status, needs me, what changed, the pull request (and stop, which says how to stop), then the room link |
An answer is at most 12 lines; a longer one is cut at the tenth with …. Every value it quotes (a title, a need, a milestone) is escaped and stripped of control and invisible characters, so a <!channel>, a mention or a link in it fires nothing; the only links are the App’s own room page and the URLs the broker built. Each answer makes one sponsored read at most, and the disabled stop/retry and unknown answers none. A Filed line whose marker names no room is answered I can't tell which room this thread filed; open the room page from the Filed line above., a room the broker cannot read The room could not be read just now; try again in a minute., and a cancelled thread nothing.
Stop, retry and answering a question. When a channel lists stop in intentActions, room.waiting_for_human lines carry a Stop button; when it lists retry, escalated room.ended lines carry Retry and Run again deeper buttons (merged, stopped and completed end lines carry none). Pressing a button posts the same ten-minute confirmation named to the presser as typing the phrase. When a channel lists answer in intentActions and the task waits on a scoper question (needs_author or an open scope.question on an escalated or waiting task), any reply that is not one of the closed phrases above posts a ten-minute confirmation named to the reply’s author (I understood: answer "<exact words>") with Answer and Cancel. Only the named presser may confirm or cancel (Only @<user> confirms this.); after ten minutes a press answers This confirmation expired. and clears the buttons. Confirm calls POST /api/slack/stops, /api/slack/retries or /api/slack/answers when human.slackStop, human.slackRetry or human.slackAnswer is on, which re-resolves the GitHub login from slack_links and forwards to the factory’s POST /v1/tasks/{task}/stops, /retries and /answers to verify repository access and apply the transition; the confirmation message is rewritten in place (Stopped., Retried., Stepped up and queued., Answered — scoper restarted., Answered — a maintainer will restart the task., Only a maintainer of this repository can stop a task., Only the issue author or a maintainer of this repository can answer this question., This task is not running., This task is not escalated., This task has no deeper workflow to step up to., The task's cap leaves less than a whole run, so a retry would only stop again: raise the cap on a new task., Stepping up costs more than the cost confirmed for this task. To run the deeper workflow, start the task again with it (New task, or maku start --workflow <name>), which confirms its higher cost., This task is not waiting for an answer.).
Understanding a reply
A reply in a filed thread is read in two tiers. Tier 0 is the table of phrases above, unchanged and always first: a reply it knows never reaches tier 1. Tier 1 reads a reply tier 0 does not know, in a channel with intents shadow or on, from a linked Slack user, against a broker that serves intent_classify. The broker makes one bounded call on a cheap model, through the model gateway’s classifier route (gateway), shown the reply alone and the thread’s phase as one closed word, never the thread’s history, and maps the reply to one of ten intents: status, needs, changes, pr, steer, amend, stop, retry, retry_deeper or unknown (stepping up once via retry_deeper is the one workflow change available from Slack). A label with a confidence under the threshold, or one the model got wrong in shape, is unknown.
In shadow nothing a person can see changes. The thread gets exactly today’s unknown line, posted before the classifier is asked, and the App counts maku_slack_intents_total{tier="1", intent, outcome="shadowed"} and logs the label, its confidence, the phase and the reply’s SHA-256 and length, never its text. A classification the broker refuses (an author who is not linked, a cap reached, a model that timed out) leaves the same line and counts outcome="refused"; a broker without the tool counts not_enabled. No reply approves, steers, stops or confirms anything: a label is a count and nothing else.
What shadow keeps is the channel’s choice. With collectReplies: true each classified reply is stored, with its label, through the redactor, for human.slackIntents.retentionDays (30 by default) and then deleted; the broker’s retention job removes it with the rooms. Without the flag nothing is stored, so the platform holds no copy of thread text. maku-broker intent-samples exports what is stored, to label it and to measure the classifier (operations).
File. A white_check_mark files the task only when all of these hold: the message is the thread’s latest proposal; the user is linked, in onBehalfOf.slack or by a self-serve link (and the linked login is a maintainer); the message is the bot’s own proposal, re-read from Slack (a conversations.replies call on the message ts with limit=1; the message’s user is the bot’s) with a matching hash; the channel is configured. The idempotency key is the thread (<team>/<channel>/<thread_ts>): a second check mark in the thread, on any revision, is a duplicate and files nothing. A thread too long to read (over 5 pages) fails closed: nothing is edited or filed. The App then calls run_create with on_behalf_of: slack:<team>/<user>, the stored plan (handoff and plan_hash), the channel’s maxCostUSD and ref: slack/<team>/<channel>/<thread_ts>. The thread map records the room, and the Filed line names the sponsor (Filed #12 for @dana, sponsored by GitHub @smana), so a wrong link shows at its first use.
No silent check mark. Every refusal on the check-mark path (reaction or ✅ reply) is one thread line naming the reason and its fix, said once per proposal, user and reason (in memory, like the event dedup), so re-adding the ✅ does not repeat it:
| Case | Line |
|---|---|
| The channel no longer lists the proposal’s repository | Not filed: <repo> isn't served in this channel; ask an operator to add it to the channel's repositories. |
| The channel is no longer served | Not filed: this channel is no longer served; ask an operator to add it to the Slack App's channels. |
| The proposal’s hash fails | Not filed: this proposal no longer matches its check; mention me again to re-plan it. |
| A replaced proposal, a thread too long | react on the latest draft; start a new one with a mention |
not_linked | Not filed: @u is not linked to a GitHub account here; mention me with link to link it, then react again. |
not_a_maintainer | Not filed: @u's GitHub account is not a maintainer of <repo>; a maintainer must react. |
repository_not_allowed, repository_not_owned | ask an operator to add it to the Slack App's repositories |
principal_budget_exhausted | the Slack App's budget for today is spent; react again tomorrow |
daily_task_cap | the factory's daily task cap is reached; react again after 00:00 UTC |
| Any other code | Not filed: <the broker's refusal> |
A passing failure (kill_switch, principal_task_cap, link_unverified, ledger_unavailable, tasks_unavailable, intake_failed, meter_unpriced, the factory or Slack unreachable) says to react again, at most once per 5 minutes per proposal, user and reason. Silent on purpose: a ✅ on a message that is not the App’s proposal, a malformed id, the App’s own user, a bot’s event, another workspace, an event already seen, and a message Slack cannot return (no thread is known to answer in; logged and counted error).
The card
One forge.push wait is one card in the thread it was filed from, and the card’s two buttons are the only thing in a thread that decides anything (security has the route, the standings and the closed codes).
When a card is drawn. All four hold: the room was filed from Slack (so its thread is in the map), the channel has approvals: true and lists the wait’s repository, the class is forge.push, and the event carries an approval id and a branch inside the run pattern. Everything else keeps today’s text line, which sends a person to the room page: forge.pr, forge.other, mcp.write, shell.high, egress.new, and a forge.push without a branch. One approval, one message: the App reads the thread, finds the card whose tagged metadata names the same approval id, and rewrites it in place, so a webhook redelivery — or a restart that lost the in-memory delivery set — cannot double it. A thread too long to read posts the card anyway and counts too_long.
What it shows. The class prose the room page shows, the branch, the deadline as Slack’s own date token (the client renders it in the reader’s timezone, so the App holds neither a clock nor a zone in the message), the approval’s id, the buttons Allow the push and Deny, and Open the room. No agent text, no reason, no GitHub login, no other person’s name: invariant 7 holds over the card as over every line. A card drawn after its deadline is posted already inert — prose and room link, no buttons — because the store would refuse the press; the App’s clock decides only what is drawn, never what is decided.
A press. The buttons carry v1|forge.push|<approvalId>|<branch>, which is a hint and never authority: the broker re-reads the approval, the class, the run’s branch and the clicker’s standing, and a card that outlived the state it was drawn from decides nothing. Slack answers a press within 3 seconds, so the one door verifies the signature, deduplicates and enqueues, and a worker does the rest. The clicker alone is told what became of it, in one fixed sentence in the card’s thread (an ephemeral): Decided: the push goes out., Not decided: your GitHub account cannot write to this room's repository., and so on — one line per closed code, naming no repository, branch, login or approver, and never repeating a broker’s prose. Only a recorded decision takes the buttons off.
Teardown. Two chat.update writes, both best effort and both idempotent: the press’s own, which turns the card into its header, class, branch, approval and the clicker’s line; and the broker’s room.approval_closed, which rewrites the same card for any close — approved, denied, expired, superseded — whoever decided, the room page included. A press names no room, so the room link leaves the card on the first write and comes back on the second. A failed update is logged as card update failed and counted error, and it is never retried: the card is a view, the store’s single-decision fence is what refuses a stale press, and three given-up webhook deliveries would disable the subscriber.
A close with no card is silent. In a channel with approvals: true, a wait that drew only a text line (another class, or a forge.push without a branch) gets no close line either: the thread already told that wait’s story, and its decision lives where its wait pointed, on the room page. A channel with approvals off draws no cards at all, and if its notify lists room.approval_closed its close is the thread’s line, The approval closed: <decision>. Room: <url>. A channel removed from channels: after its card was posted takes that same text-line path: the card keeps its buttons, and a press there is ignored before any broker call: the App does not serve that channel, so nothing decides.
Self-serve link
The link routes answer Referrer-Policy: same-origin (the rest of the rooms UI is no-referrer): under no-referrer a browser sends the form POST’s Origin: null, which the broker’s origin check refuses.
A Slack user links themselves instead of waiting for an onBehalfOf.slack entry in git (design):
@factory linkin a served channel. The App calls the broker’sslack_link_codewith its team and user id (and handle and display name, withusers:read) and answers in a direct message from the bot (only that user sees it; the first line is the labelled link and the bare URL follows on its own line; it says never to send it to anyone; the thread gets a one-line pointer, never the URL; if the DM fails, an ephemeral in the channel, not in the thread, is the fallback, and the Slack error is logged) withhttps://rooms.<domain>/link/slack?code=<code>: single use, 10 minutes, replacing their earlier code.- The user opens it, signs in to the rooms UI (your identity provider), and sees
Link Slack user @handle (<id>) in workspace <team> to your account (GitHub: @login)?, the display name below it marked as set by that user, and “never confirm a link someone sent you”. Link posts the form, from the web UI’s session only (a maku or MCP token is refused); the broker recordsslack(team/user) → the account. - From then on their ✅ files sponsored by that account’s current GitHub login, still held to the repository’s maintainers: a link grants nothing a maintainer did not have.
@factory unlink removes the user’s self-serve link (never a config entry); the page, opened without a code, lists the account’s links with an Unlink button each. Refusals on the page: the code expired or was used, the code is for another workspace, the account has no GitHub link (with the broker’s GitHub account link on, the page sends them to /link/github), it holds 5 Slack users already, or the Slack user is linked to another account (it unlinks first: a link never moves silently). With the broker’s human.slackLink off, both commands answer that self-serve linking is not turned on. link and unlink are the whole mention; a draft whose title holds the word is a draft.
Both sides must opt in: the broker’s human.slackLink (principal, team, repository; integration) and the factory’s onBehalfOf.slackLinks (The factory). A user in onBehalfOf.slack keeps that entry whatever they link: the config wins.
Follow and the end line
The broker’s webhooks name a room; the App finds its thread in the map and posts under three notification classes:
| Class | Mention | Shape |
|---|---|---|
needs_you | Yes, the one person who can act (author for needs_author, otherwise filer) | What is asked, one recommended action (button, reply, command, or room link), and what happens if nothing is done (If nothing is done, it stops in 7 days., from escalatedHours, If nothing is done, it stays parked., or If nothing is done, it stays parked until the deadline.) |
changed | No | One line in the thread (room.task_triaged, room.run_started, room.pr_opened, room.stepped_up, room.verdict_posted, room.budget_reached, room.approval_closed) |
done | Yes, once | The end line (room.ended when not escalated, room.merged, room.reverted) |
By default, the App posts five transitions (room.task_triaged, room.waiting_for_human, room.pr_opened, room.stepped_up, room.ended):
room.task_triaged(changed):Started #<issue>. Room: <url>(after onetaskread for the issue number, orStarted. Room: <url>), with no mention.room.waiting_for_human(needs_you): the card forforge.pushwhenapprovals: true; when the task was bounced with a scoper question (needs_author),<@author> The scoper asks: <question>. Reply to answer. If nothing is done, it stops in 7 days.(falling back toNeeds youwhen no question text is recorded), never an end line; otherwise<@filer> Needs you (<reason>)— carrying the merge gate’s decision (waits for a human: policy <name> is in shadow here,waits for a human: touches a protected file, …) when the task waits on a merge — plus the room link and what happens if nothing is done.room.pr_opened(changed):Pull request #<pr> opened., with no mention.room.stepped_up(changed):Stepped up from <from> to <to> (<reason>) · new ceiling $<ceiling>., with no mention.room.ended: one end line per thread, stored underendTSinfactory-slack-threads: outcome (Merged #<pr>,Ended: done,Ended: stopped,Ended: escalated (out of budget),Reverted #<pr>), spend against budget ($0.16 of $2.00, markedso faruntilspendFinal), duration from the first run’sstartedAtto the last run’sendedAt, and the merge gate’s decision (merged automatically by policy <name>,merged on @<login>'s approval,waits for a human: touches a protected file). An escalatedroom.ended(state: failed) isneeds_you: it mentions the filer, offersRetryandRun again deeperbuttons (or/factory retrywhenretryis off inintentActions), and saysIf nothing is done, it stops in 7 days.(fromescalatedHours). A terminalroom.ended,room.merged, orroom.revertedisdone: it mentions the filer once (recorded indoneMentioned) and laterroom.mergedorroom.revertedevents editendTSin place (chat.update) without mentioning again (listingroom.revertedinnotifyalso posts a separate line without a second mention); ifroom.mergedarrives beforeroom.ended, it posts the end line with the one mention first androom.endedupdates it without mentioning again.
Upkeep channel and weekly scorecard
Channels with upkeep set receive scheduled routine activity without needing @factory proposal settings on the parent channel (repositories and maxCostUSD are optional on dedicated upkeep channels):
- Silent by default:
room.task_received,room.task_triaged,room.endedwithreason: "no_op", and non-escalated endings on rooms without an existing thread post nothing. - Top-level threads: the first qualifying event (
room.pr_opened,room.waiting_for_human, or escalatedroom.ended) opens a top-level channel message and records the room infactory-slack-threads, so subsequentroom.mergedorroom.revertedtransitions update the thread in place and interactive thread replies work as on interactive tasks. - Breaker alerts:
routine.pausedposts a channel alert naming the repository, routine, and breaker reason, with a direct link to.github/agent-factory/upkeep/<name>.mdon the default branch. - Weekly scorecard (
upkeep.digest.cron): when the 5-field UTC cron matches, the App calls<brokerURL>/api/routines/digest?window=7dover its existingbrokerURLconnection (zero new NetworkPolicy egress) and postsWeekly upkeep scorecard (7d):summarizing runs, merge rate, spend, and paused state per active routine, skipping weeks where all counts are zero.
State
- The thread map is the ConfigMap
factory-slack-threads, the only object the App’s Role names (channel,ts,at,author,filer,endTS,doneMentioned,coordination). Entries older than 30 days are pruned on write, and the encoded map is bounded near 900 KiB (a ConfigMap holds 1 MiB). - One replica. Slack events (on
event_id), button presses (on the approval, the user, the action id and the action’s ownaction_ts, so Slack’s retry of one press is a duplicate) and webhooks (onwebhook-id) are deduplicated in an in-memory LRU, so a restart can post one duplicate line. Two concurrent redeliveries of one id can both pass the check before either finishes (known race): the worst case is one duplicate thread line, and for a press the store’s single-decision fence still records one decision. - The message metadata is tagged. Every message the App posts carries
event_typeand its payload:factory_proposal(id,hash,author,rev,repo),factory_filed(repo, theroomit started, andcancelledon a Cancel’s),factory_approval(approvalId,class,branch) on a card, andfactory_act(action,room,presser,expires, plustexton ananswer, rewritten tofactory_act_closedonce resolved) on a stop, retry or answer confirmation. The tag is what finds a card again — a webhook redelivery rewrites it instead of posting a second one, androom.approval_closedreads the branch back from it — so a card posted without its tag would be doubled. - Two switches, both off by default, and they do different things. The broker’s
human.slackDecideis the authority: without it the decide route is the mux’s404, and a press says the factory could not be reached. The channel’sapprovalsis who gets the affordance: without it a wait is a text line and a press never reaches the broker. The broker’s switch must be on before any card offers a button, and Slack’s interactivity URL must be set before the first card with one is posted. - A webhook key the App cannot read answers
503 no_key. That is not a hold: the broker retries a receiver’s non-2xx after 10s, 1m and 5m, then counts a failure, and three given-up deliveries disable the subscriber until itsgenerationis bumped. A rotated or missing key, or a Slack outage that makes the App answer502, therefore loses those events and can disable the subscriber. Recovery: fix the key (or wait for Slack), bumpgenerationon the broker’swebhooksentry and restart the broker (awebhookschange applies only at restart); the events of the disabled window are not replayed, and a room’s page still shows its state. A failed card update is never one of these: it is logged and counted, and the close it was rewriting is answered200. - Series:
maku_slack_intents_total{tier, intent, outcome}counts what tier 1 read (tieris1,intentone of the nine,outcomeshadowed,refusedornot_enableduntil the read intents are served); the thread’s own question counter,maku_slack_thread_answers_total, keeps counting tier 0.maku_slack_app_requests_total{route, outcome}(events,webhooks,interactions; the closed list isnot_linked,repo_not_allowed,repo_not_served,repo_served_elsewhere,no_write(a first mention refused for that cause, see the flows),drafted,edited,proposed,asked,updated,reposted,multi_issue,answered,refused,filed,posted,card_posted,card_updated,card_closed,decided,ignored,not_enabled,not_supported,duplicate,link,unlinked,ok,bad_request,bad_signature,no_key,too_large,too_long,busyanderror).busyis an event or a press answered 503 because the App’s 8 workers and its 64 queued items are all taken, or it is shutting down: Slack retries it. A press’s own words aredecided(a decision was recorded),duplicate(the fence had already closed it),not_supported(the class is notforge.push),refused(any other closed code the broker answered) anderror(the broker, Slack or the clicker’s line failed). maku_slack_proposal_updates_total{action}counts the proposal’s actions (mention,reply,confirm,cancel,repost), andmaku_slack_thread_answers_total{question}the filed thread’s answers by question (status,needs,changes,pr,stop,retry,unknown): both on the broker’s metric set, served undermaku_.- Every refusal is one structured
Infoline withreason(the broker’s closed code, never the request’s text),channelanduser:proposal refusedfor a mention or a re-plan,check mark refusedfor a ✅. With the three outcomes above,kubectl logsand the counter say which cause hit. - A refusal said once is remembered in memory (at most 4096): a restart can say it once more.
maku_slack_app_build_info{version}: the running build, constant 1.
What it never does
- Answer anything but a
forge.pushapproval, and only from a card’s button — or stop, retry or answer a task’s question only from its confirmation’s button. A signed press on the card the App itself posted decides that approval, forforge.pushonly, as the linked human the broker resolves — one class, no reason (the decision carries an empty one), and no steering; and a signed press on afactory_actconfirmation by the person it names stops a queued or running task, retries an escalated one, or answers an open scoper question as the linked human. Everything below still holds everywhere else. - Answer an approval, steer a run, or execute a command directly from a thread reply. A reply is an edit before filing (the author’s, re-planning a proposal), one of the closed questions after (where
stop,retryandanswer, when listed inintentActions, post a confirmation card and never act by themselves), and never a way to steer a run. A reply that is only a ✅, from anyone, files the latest proposal as a reaction does (the same checks, the same lines); any other reply in a proposal’s thread from anyone else is dropped unread, and one in a filed proposal’s thread is answered and acts on nothing — sayingapprove,denyor/factory retryin the thread of a card does nothing at all, and neither does a ✅ on the card. - Decide any other class, from any surface it owns:
forge.pr,forge.other,mcp.write,shell.highandegress.newstay on the room page, and a press on a card for another class isnot_supported. - Merge. A card’s approval releases one push; merging stays a review of the current head on GitHub.
- Take a reason, or show one. A press sends a decision and nothing a model could read as a sentence, and no card carries agent text.
- Post a link code where anyone but its user sees it, or trust a GitHub login from Slack.
- Post room text or anything an agent wrote.
- Answer a slash command.
- Serve another workspace, an unlisted channel or a proposal it did not post.
- Hand its Slack token or its identity-provider client secret to the broker or a run.
What a live run shows
Offline, internal/slackapp and internal/app cover the proposal, the file, the card and the teardown; the two switches’ live behaviour is the design’s eight proofs, L1–L8, run on one channel with approvals: true. On the cluster, also confirm two things about Slack itself: conversations.replies with the reply’s ts and limit=1 returns the reply (not the thread’s parent), and a bot’s messages carry user=<the bot's U-id>. The check-mark filter relies on both. The App reads its own message metadata through conversations.replies, so metadata.message:read is not needed; confirm that too, and that the manifest’s bot scopes suffice.