Repository navigation
switchboard v0.5.0
go install github.com/go-steer/switchboard/cmd/switchboard@v0.5.0docker pull ghcr.io/go-steer/switchboard:0.5.0The module version keeps its v and the image tag does not.
The image is multi-arch (amd64 + arm64), distroless
(gcr.io/distroless/static-debian12:nonroot, no shell, no package manager)
and signed with Sigstore keyless:
cosign verify ghcr.io/go-steer/switchboard:0.5.0 \
--certificate-identity-regexp '^https://github.com/go-steer/switchboard' \
--certificate-oidc-issuer https://token.actions.githubusercontent.comA release about what survives. Until now a restart cost every thread its
session, a Google Chat room could not answer a permission prompt at all, and
nothing recorded who in chat had told the daemon what. Each of those is now
something a deployment can rely on rather than work around.
Conversations outlive the process (#86, #87). With --state-dir, the
routing table — each thread's session, the identity its relay subscribes as,
its delivery watermarks — is written to disk, so the next message after a
restart lands in the session the thread already had, and an answer produced
during the outage is still delivered. Answers are keyed and the attempt is
recorded before the post, so across a restart each one reaches the thread
effectively once: Google Chat drops a repeat natively, and Slack checks only
the answers actually in doubt (the Slack side was verified live). With durable
state on, an idle thread's daemon streams are released after
--session-idle-ttl (12h by default) and re-attach on its next message.
Without --state-dir threads are held in memory as before and the banner says
so; answers still carry their key (a Chat requestId, Slack message metadata),
which changes nothing visible.
Google Chat can approve (#29). A second ingress, --googlechat-ingress http, receives events over a verified HTTPS endpoint instead of Pub/Sub, and on
it cards carry buttons: a permission prompt becomes a card with an answer per
button, a press arrives as the person who clicked, --approvers applies as it
does on Slack, and the click's own response carries the edit that records how
the question ended. Pub/Sub stays the default and stays inert — no click reaches an add-on there. Every request is
checked against a Google-signed ID token, this endpoint as the audience, and a
required, pinned --googlechat-service-account. Broad answers have no
"are you sure" step on Chat yet (#92).
Approvals are narrower and more honest. --standing-approvers (#85) names
who may press allow-always, the one answer that outlives the room it was
pressed in. An answer to a mast write-gate park waits up to fifteen minutes for
the resume turn it releases, and is no longer reported as lost when it was not
— the respond half of #84; the change-set card and edit are still open.
A thread whose session the daemon lost recovers on the next message whoever
opened the session, and an ACL refusal is no longer mistaken for a lost
session (#88).
--audit-log records every turn and press (#89): one JSON line joining the
platform's message ID, the asserted caller, the session and the outcome —
never the message text. Switchboard is the only component that sees both ends
of that link.
Upgrading needs no configuration change: no new feature is on by default, and
--standing-approvers defaults to channel, no tighter than --approvers.
The fixes do change default behaviour — a mast park press waits longer, a lost
session is dropped with a notice instead of failing every turn, and
approval.Client.Respond now honours the caller's deadline rather than capping
it at 30 seconds. With approvals on, the banner now states on every start
whether a standing grant needs more than any other answer.
google.golang.org/grpc moves to v1.83.1 for GO-2026-6348.
Added
-
deploy/slack/app-manifest.yaml: the Slack app as a manifest — Socket Mode,
app_mention, interactivity, the/switchboardcommand, and the bot scopes
the adapter's API calls need, including the optional*:historyscopes for
restart verification. Paste it to create the app or to update an existing
one, so its configuration lives next to the code that depends on it instead
of only in the console. -
Answers are delivered effectively once across a restart. With
--state-dir, each answer is keyed by its session and seq and the attempt
is written to the state file before the post, so a restarted gateway knows
exactly which answers may already be in the thread. Google Chat drops a
repeat natively (the key becomes the messagerequestId). On Slack the key
rides in message metadata and only a possibly-posted answer is checked
against the thread first — which needs the optional*:historyscopes;
without them, or for a message Slack has not yet returned, the worst case is
one duplicate.chat.ReplygainsKeyandVerify. -
--state-dirmakes conversations survive a restart (#86). The
conversation → session routing table — each thread's session, the identity
its relay subscribes as, its delivery watermarks, plus ingress bindings and
progressoverrides — is snapshotted tostate.json(debounced; written
to a temp file, synced and renamed; once more at shutdown). After a restart
the next message in a thread goes to the session it had instead of a new
one; recently active threads re-attach at boot so an answer produced during
the outage is still delivered, older ones on their next message or on a
press. Delivery is at-least-once across a crash and exact across a clean
shutdown; questions on screen are not asked again; a frozen placeholder is
taken down. An unparseable file is moved aside with an error; an unwritable
directory stops the run at startup. Threads untouched for 30 days are
forgotten. Also$SWITCHBOARD_STATE_DIRandstate_dirin the config
file, and adeploy/components/durable-statekustomize component adding
the volume. Without it nothing changes, and the banner says threads are in
memory. -
--session-idle-ttlreleases an idle conversation's daemon streams
(#87): with--state-dir, a thread with no traffic for the TTL (default
12h,0= never) closes its relay and prompt streams and re-attaches on
its next message, instead of holding both open until a restart. Turns in
flight and outbound-ingress-bound threads are never reaped. A TTL without
--state-diris refused. Also$SWITCHBOARD_SESSION_IDLE_TTLand
session_idle_ttlin the config file. -
--audit-logwrites an ingress audit record (#89): one JSON line per
turn and per approval press, joining the chat message (the platform's own
message ID), the asserted caller, theapp/sidsession and the outcome —
the link between "who said it in chat" and "what the daemon was told", which
switchboard is the only component able to see and previously wrote nowhere.
Never the message text.stdoutkeeps it apart from the operational log on
stderr; a file is appended to, created0640, and a run that cannot open it
does not start. Also$SWITCHBOARD_AUDIT_LOGandaudit_login the config
file.chat.MessagegainsMessageID, filled by both adapters. -
Google Chat cards carry buttons on the HTTP ingress (#29), which puts
Google Chat on the approval gate: a permission prompt renders as a card with
a button per answer, a press reaches the router as the person who clicked,
and--approversnarrows it exactly as it does on Slack. The welcome and the
progressack get back the row of mode buttons #52 removed. Over Pub/Sub
nothing changes — no click reaches an add-on there (#28), so every card
stays inert and a question still arrives as prose.A click is answered in its own response: the edit recording how the
question ended goes back as an add-onupdateMessageAction, so the card
changes the moment it is pressed — and the same edit is sent over REST right
after, because nothing confirms the response landed or that Chat accepted
the card in it. A press slower than ten seconds is acknowledged with{}
and its edit follows over REST; a refused or stale
press leaves the question alone and says why beside it. A legacy-dialect
click is acknowledged and answered over REST.Each button sends its click to the endpoint's full URL — Chat's add-on
runtime fails a bare function name without sending anything — so the gateway
uses--googlechat-endpoint-url, or learns the URL from the first verified
event; until then a card that would carry buttons goes as text. A run with
approvals on whose Chat answers cannot be buttons (Pub/Sub, or cards off)
says so at startup. Broad
answers get no "are you sure" step on Chat yet, unlike Slack: Chat has no
native confirmation. -
--standing-approversgates the one answer whose reach is not bounded by the
room it was pressed in (#85):allow-always, which saves a grant to the
daemon that outlives the session. Under the default--approvers channel,
anyone who could post in a room could also write that standing grant; now a
run can let the room approve calls while naming who may make one permanent.
A standing press must pass both lists, so this only narrows, and someone it
refuses is told Not a standing approver and can still answer for the
request. Also$SWITCHBOARD_STANDING_APPROVERS(an empty value is refused,
like$SWITCHBOARD_APPROVERS) andstanding_approversin the config file,
per channel too.nobodyturns permanent grants from chat off and keeps
one-shot approvals. Defaults tochannel— no tighter than--approvers—
so nothing changes on upgrade, and the approvals banner now says on every
start whether a standing grant needs more than any other answer, and warns
when no approver is also a standing approver. -
Google Chat can receive over HTTP instead of Pub/Sub (#29):
--googlechat-ingress httpservesPOST /chaton--googlechat-listen, and
the Chat app's connection settings name that URL instead of a topic. Same
events, same decoder, same egress — nothing below the adapter can tell which
transport a turn arrived on. Pub/Sub stays the default, because it exposes no
inbound surface; this one is a public endpoint, and what it buys is everything
needing a synchronous response: the card clicks this release adds, and the
dialogs #29 may add later.Every request is verified before its payload is read: a Google-signed ID
token, taken from theAuthorizationheader or the body's
authorizationEventObject.systemIdToken(Chat sends both, so a proxy that
strips the header does not break delivery), checked against this endpoint's
URL as the audience and against--googlechat-service-accountas the caller.
That last one is required and has no unpinned mode — every Workspace add-on's
traffic is signed by an address of the same
service-<project number>@gcp-sa-gsuiteaddons.iam.gserviceaccount.comshape,
so a check that stops at "Google signed it" accepts every add-on on the
platform as this one.--googlechat-endpoint-urlpins the audience for
deployments behind something that rewritesHost.A verified request is answered
200 {}at once and the turn runs behind it:
Chat allows the endpoint ~30 seconds and a turn is routinely longer, so the
answer arrives in the thread over REST as it always has. An event the gateway
cannot act on is answered200too, for the reason Pub/Sub events are always
acked — a retry would be a duplicate turn rather than a second chance.
Shutdown drains the turns already in flight.deploy/README.mdcovers the
port, the NetworkPolicy rule and the certificate this needs in-cluster;
docs/googlechat-setup.mdcovers the console side. -
docs/googlechat-setup.mddocuments the Chat service identity step
(gcloud beta services identity create --service=chat.googleapis.com).
Enabling the Chat API is not sufficient and the omission is invisible: both
registrations resolve to the same service account, so every IAM check passes
while Chat drops all deliveries upstream of anything observable — no requests,
no audit entries, no errors, over Pub/Sub or HTTP. The console's "Service
account email" field is the one marker. Also lists what has been ruled out
empirically as causing the same symptom, so the two days it cost in a sibling
project are not spent again. -
docs/DESIGN.md§3.4 designs the Google Chat HTTP interaction endpoint (#29)
ahead of building it: ingress as a per-deployment choice with Pub/Sub still
the default, request authentication (the part with no Pub/Sub analogue, where
authorization was the subscription's IAM), the ~30-second response budget, and
what gating buttons on the ingress requires of the card builder. Records that
HTTP delivery serializes numbers as proto-JSON floats where Pub/Sub sends
ints — which thecommandIDdecoder then rejected into a silent zero (fixed
below), so an HTTP deployment would have dropped every command while the
fixtures stayed green.
Fixed
-
An answer to a mast write-gate park is no longer cut off by a slow
resume turn and then reported as undelivered (#84). mast serves its durable
parks on/permsascontrol_plane_writeprompts and replies to
/perms/respondonly after the turn the answer releases has run, on the
request itself; switchboard capped every respond at 30 seconds, so a longer
turn was cancelled mid-run and the thread was told "that answer didn't reach
the agent — try pressing again" about an answer that had. A press on that
kind now waits up to fifteen minutes, one that still runs out (or is cut by
shutdown) is reported as possibly in force rather than as worth retrying,
andapproval.Client.Respondhonours a caller's own deadline instead of
capping it. The question for that kind also says that, where the gate takes
an edited call — mast's does, and no button offers it — that answer is given
at the agent. -
Bumped
google.golang.org/grpcto v1.83.1 (GO-2026-6348, heap exhaustion
via HTTP/2 DATA frame fragmentation, reachable through the Pub/Sub
subscriber;govulncheckwas failing the build against v1.83.0). -
A thread whose session the daemon has lost recovers on the next message,
whoever opened the session (#88). The discard-and-notice path ran only for a
session adopted through the ingress, so a session switchboard created itself
— the common case — that came back404/410left its dead entry in the
map, and every later turn in that thread failed the same way until the
process restarted. Its relay, likewise, reconnected forever to a stream that
could never return. Both paths now drop the entry, unbind only if it was a
binding, and tell the thread; the wording still distinguishes a session the
thread was following from one opened for it, and a turn left waiting on a
lost stream has its "Working…" placeholder taken down.A 404 on inject is no longer taken at its word. Under ACL enforcement
core-agent refuses a caller with the same 404 a missing session gets, so
the second person to reply in someone else's thread looks exactly like a
lost session — for adopted sessions this was already misread. The router
now confirms by probing the session as the identity its relay subscribes
as, and keeps the entry unless that probe is refused too; the refused
caller gets the ordinary failed-turn notice. -
The Google Chat decoder reads a command ID spelled as a whole-number float
("appCommandId": 100.0), which is how proto-JSON — and so the HTTP ingress
— serializes the integer Pub/Sub delivers as100.
strconv.ParseIntrejects that spelling, and the decoder deliberately never
errors, so the ID became0, matched no configured command, and the command
was dropped with nothing in the logs. Pub/Sub never sends that spelling;
the HTTP ingress in this release does, and this fix landed ahead of it so
that every command on it was not silently dropped. A value that is not
actually an integer (1.5) or does not fit (1e20) still decodes to0.
Changed
- The Google Chat adapter's event handling is split from its Pub/Sub envelope:
dispatchnow owns only the ack, andhandleEventtakes the raw payload. No
behaviour change — groundwork for the second ingress (#29), whose equivalent
of "always ack" is "always answer 200".
Full diff: v0.4.0...v0.5.0