Docs menu

Guide

Standard checks

The standard checks are a set of tests for the bugs apps and agents commonly have on each platform: answering twice, answering in the wrong place, answering themselves, mishandling a retry. This page shows how to add them to your suite, what each check catches, and how to leave one out.

Add the checks#

import {
  discordChecks,
  githubChecks,
  googleChecks,
  linearChecks,
  notionChecks,
  resendChecks,
  slackChecks,
} from "channelstack/checks";

slackChecks({
  app: "my-agent",
  streamPrompt: "write a long report on Q3",
  approval: { prompt: "@my-agent deploy web to staging", button: "Approve" },
});
githubChecks({ app: "my-agent" });
linearChecks({ app: "my-agent" });
notionChecks({ app: "my-agent", prompt: "@my-agent summarize this page" });
resendChecks({ app: "my-agent", prompt: "Where is my refund?" });
googleChecks({ app: "my-agent", prompt: "Where is my refund?" });
discordChecks({ app: "my-agent", command: "/deploy web", longPrompt: "write a long report on Q3" });

Each call registers ordinary Vitest tests in the file it's called from, on the fixtures and matchers of channelstack/vitest, so the plugin must be set up. The tests are grouped in a describe named after the platform and the app (slack checks: my-agent), and each test name ends in the check's id:

✓ slack checks: my-agent > replies once to a DM [slack.dm-once]
✓ slack checks: my-agent > survives Slack's retry after 3 seconds [slack.retry]
✓ github checks: my-agent > every check run it starts reaches a conclusion [github.check-run]

A check you skip, or one whose option you didn't give, isn't registered at all, so it doesn't show up in the report.

Call only the functions for the platforms your app is on. The checks are written against the public test API, the same one your own tests use, so a failing check reads like one of your tests failing: the matcher's message says what a person would have seen.

Options#

OptionDefaultWhat it's for
apprequiredThe app's name as people mention it: my-agent, or any app's. For another name the checks make that app (createApp({ name })) and run against the agent driving it, so slackChecks({ app: "coder" }) checks a second agent (several apps)
prompt@<app> helloText that makes the app answer. For Linear it's the title of the issue that gets delegated, default Look into this
streamPromptnoneText that makes the app stream a longer answer in a DM. Without it, the two stream checks are left out
approvalnone{ prompt, button }: text that makes the app ask for an approval, and the label of the button it shows. Only a workspace admin may press it. Without it, the two click checks are left out
commandnoneDiscord: a slash command the app answers, as a person types it (/deploy web). Without it, the two interaction checks are left out
longPromptnoneDiscord: text that makes the app answer with more than one message may hold (2000 characters). Without it, the long-answer check is left out
modelnone"openai": the app's model is the fake OpenAI. Every check that scripts nothing itself answers each model call with a plain answer, the stream and Stop checks script a long stream and need no streamPrompt, and the Slack model checks are added (below)
skip[]Check ids to leave out, for example ["slack.stream-stop"]. An id that no check has throws, with the list of ids
timeoutthe plugin's timeoutHow long each check waits for the app
loopTurns3How many times the app may answer another app that answers everything, with no person between them, before <platform>.no-reply-loop fails. An app built to hand off to another sets it higher, or skips the check

Pick prompts your app answers quickly and in a single message. With a real model, a short, plain prompt keeps the checks fast. With a framework's fake model, use one your script already handles. On the fake OpenAI, pass model: "openai" and the checks script the model themselves.

Slack checks#

IdWhat the test doesWhat it catches
slack.dm-onceAna DMs the prompt; expects exactly one replyTwo answers to one DM
slack.mention-onceAna mentions the app in a channel; expects exactly one replyAnswering both the app_mention and the message event for the same message
slack.in-threadA mention in a channel; expects a reply in the thread, and no message in the channel itselfAnswers that land in the channel instead of the thread
slack.retryRetries the mention's event after 3 seconds, as Slack does; expects one replyAnswering again on Slack's retry
slack.redeliveryAfter the reply, sends the same event again, unchanged; expects one replyAn app that only checks the retry headers, not the event_id
slack.ignores-botsAnother bot mentions the app; expects no replyBot-to-bot loops
slack.bad-signatureResends a DM's event with a wrong signature; expects a 4xxTurned-off or broken signature checks. Over Socket Mode there's no signature, and the check passes without sending anything
slack.ackA DM; expects the delivery acknowledged within 3 secondsWork done before the acknowledgement
slack.msg-too-longSlack refuses the app's next chat.postMessage once with msg_too_long; expects exactly one reply in the endAn app that gives up, or crashes, when a message is too long
slack.stream-stopNeeds streamPrompt. Expects a streaming reply that ends completed, and the thread idleA stream that is never stopped, leaving "Thinking…" up
slack.stopNeeds streamPrompt. Ana presses Stop during the stream; expects the thread stopped and exactly one replyWriting on after Stop
slack.click-unauthorizedNeeds approval. A non-admin presses the button; expects the thread to still hold only the askActing on, or answering publicly, a click from someone who may not act
slack.double-clickNeeds approval. An admin presses the button twice at once; expects exactly one new message in the threadActing twice on a double click
slack.no-reply-loopAnother app in the channel answers every reply of the app's, mentioning it; expects the thread to go quiet, the app answering it at most loopTurns timesTwo agents answering each other without end. Ignoring bot messages only by subtype: "bot_message" misses a modern app's, which carry bot_id and no subtype

slack.double-click counts messages: the app should answer one approval with exactly one new message in the thread. Replacing the question as well is fine, and so is removing the button once it has acted. An app that answers only by editing the question, or with several messages, should skip this check.

slack.msg-too-long injects a fault, which applies to the whole workspace while it lasts. Run the Slack checks where no other test posts at the same moment, or skip that check in a parallel suite.

On the fake OpenAI#

With model: "openai", slackChecks adds one check for each bug a model's timing and failures cause. Each scripts the model itself:

slackChecks({ app: "my-agent", model: "openai" });
IdWhat the test doesWhat it catches
slack.slow-modelThe model's first token takes 5 seconds, and Slack retries the DM's event after 3; expects exactly one replyA slow model that makes the app answer Slack's retry too
slack.model-errorEvery model call fails with overloaded; expects a reply, no stream left open, and the thread idleAn app that says nothing, or leaves "Thinking…" up, when the model fails
slack.model-retryThe first two calls fail with overloaded, the third answers; expects that answer, onceA retried model call that posts twice, or not at all
slack.stream-breaksThe model's stream is cut after three chunks; expects a reply, no stream left open, and the thread idleA stream that breaks halfway and is never stopped
slack.stop-cancels-modelThe model's stream is held after three chunks and Ana presses Stop; expects the thread stopped and the model call abortedAn app that stops posting but leaves the model running
slack.no-secrets-to-modelA DM; expects no token, signing secret or key in anything the app sent the modelA token, signing secret or key in the prompt

The ids are exported as SLACK_MODEL_CHECKS. Only Slack has model checks so far; the other platforms' are #120. With model: "openai", their checks still answer each model call, so an agent on the fake OpenAI passes them.

GitHub checks#

Each check works in a fresh repository with the App installed and Ana as a collaborator.

IdWhat the test doesWhat it catches
github.ignores-own-commentsAna mentions the app in an issue; expects exactly one comment from itAn app that answers its own comment, again and again
github.one-commentAna mentions it twice, waiting for each answer; expects exactly two commentsMore than one comment per trigger
github.review-threadAna mentions the app in a comment on a pull request's diff; expects one reply, from the app, in that threadAnswers that go to the pull request's conversation instead of the review thread, or nowhere
github.redeliveryRedelivers the comment's webhook with the same GUID; expects one commentHandling a redelivery from the App's settings as a new event
github.check-runOpens a pull request; once the app is quiet, expects every check run to be completedCheck runs left queued or in_progress, which block merging
github.bad-signatureResends the webhook with a wrong signature; expects a 4xxTurned-off webhook verification
github.no-reply-loopAnother App on the repository mentions the app after each of its comments; expects at most loopTurns answers to itAn App that answers every issue_comment, a bot's included: GitHub sends an App the other Apps' comments, and nothing stops the loop

github.check-run passes for an app that creates no check runs. Skip it if your App doesn't use them, to keep the report honest.

Linear checks#

Each check creates an issue titled with prompt and delegates it to the app, which opens an agent session.

IdWhat the test doesWhat it catches
linear.first-activityExpects some activity from the app within 10 secondsA slow first response; Linear shows the session as unresponsive after that
linear.ends-turnExpects the session to reach complete, awaitingInput or errorA session left active after the work is done
linear.stopAfter the first activity, Ana presses Stop; expects complete or errorIgnoring the stop signal
linear.redeliveryAfter the turn ends, redelivers the webhook that opened the session; expects at most one response activityStarting the work over on a redelivery
linear.staleResends that webhook with a webhookTimestamp two minutes old; expects a 4xxMissing replay protection: Linear's receivers should refuse webhooks more than a minute old
linear.bad-signatureResends it with a wrong signature; expects a 4xxTurned-off webhook verification
linear.no-reply-loopAfter the turn ends, another app comments on the issue after each of the app's comments; expects at most loopTurns answersAn app that answers every Comment webhook, another app's included

Notion checks#

Each check has Ana post prompt as a comment on a page connected to the integration.

IdWhat the test doesWhat it catches
notion.reply-in-discussionExpects a reply in Ana's discussion, and no other discussion on the pageAnswers posted as a new page comment, which the person doesn't see where they asked
notion.ignores-own-commentsExpects exactly one comment from the integrationAn integration that answers its own comment
notion.redeliverySends the comment's webhook again; expects one commentHandling Notion's retry as a new comment
notion.bad-signatureResends the webhook with a wrong signature; expects a 4xxTurned-off X-Notion-Signature checks
notion.no-reply-loopAnother integration on the page replies in the discussion after each of the integration's comments; expects at most loopTurns answersAn integration that answers every comment.created, another integration's included

Resend checks#

Each check has Ana email prompt (default hello) to the agent's address.

IdWhat the test doesWhat it catches
resend.reply-in-threadExpects the answer in Ana's mailbox, in the thread her email startedAn answer without In-Reply-To and References, which starts a new thread
resend.redeliverySends the email.received webhook again, as Resend retries; expects one answerHandling Resend's retry (the same svix-id) as a new email
resend.bad-signatureResends the webhook with a wrong signature; expects a 4xxTurned-off resend.webhooks.verify
resend.staleResends it signed more than five minutes ago; expects a 4xxMissing replay protection on svix-timestamp
resend.no-reply-loopAnother app emails the agent, marked Auto-Submitted: auto-replied, and answers each answer the same way; expects at most loopTurns answersAn agent that answers mail a program sent on its own: the oldest email loop. Mark answers with Auto-Submitted (RFC 3834) and leave mail so marked unanswered

Google checks#

Each check has Ana email prompt (default hello) to the agent's Gmail address. The agent must be watching its inbox (users.watch) for a push to reach it.

IdWhat the test doesWhat it catches
google.reply-in-threadExpects the answer in Ana's mailbox, in the thread her email startedAn answer without In-Reply-To and References, which starts a new thread
google.historyAna sends two emails at once, which one push tells of; expects one answer to eachAn agent that answers only the newest message instead of listing its history
google.redeliveryPushes the same Pub/Sub message again, as Pub/Sub delivers at least once; expects one answerAn agent that reads history from the start again, or answers a message twice
google.bad-signaturePushes it again with a token another key signed; expects a 4xxTurned-off verifyIdToken
google.wrong-audiencePushes it again with a token for another endpoint; expects a 4xxverifyIdToken without an audience
google.stalePushes it again with a token that has expired; expects a 4xxA signature check that skips the token's exp
google.no-reply-loopAs resend.no-reply-loop, to the agent's Gmail addressAnswering mail marked Auto-Submitted

Discord checks#

Each check has Ana mention the app with prompt in a channel with the bot, or DM it, as the check says. With app: "coder", the checks run against the bot of the app coder, and command is that app's command.

IdWhat the test doesWhat it catches
discord.mention-onceAna mentions the app in a channel; expects exactly one replyAnswering both a mention and the message it is in, or answering twice
discord.dm-onceAna DMs the prompt; expects exactly one replyTwo answers to one DM
discord.ignores-botsAnother bot writes the prompt; expects no replyA bot that answers bots (author.bot), and the loops that follow
discord.no-reply-loopAnother app in the channel replies to each of the app's answers, mentioning it; expects at most loopTurns answers to itTwo bots answering each other without end: Discord sends a bot the other bots' messages, mentions included, with author.bot
discord.resumeDrops the Gateway connection just before Ana's DM; expects one reply once the bot resumesA bot that identifies anew instead of resuming, and loses or repeats what it missed
discord.long-answerAna sends longPrompt; expects the answer split over several messages, and no 50035 refusalAn answer over 2000 characters, which Discord refuses, or one cut short
discord.interaction-3sAna runs command; expects the answer within 3 seconds, and no "This interaction failed"An interaction answered late, after Discord has given up on it
discord.bad-signatureOver HTTP, sends the interaction again signed with another key; expects a 401An interactions endpoint that doesn't check X-Signature-Ed25519

Skipping a check#

List the ids in skip:

slackChecks({ app: "my-agent", skip: ["slack.msg-too-long"] });
githubChecks({ app: "my-agent", skip: ["github.check-run"] });

A check that needs an option you didn't give (streamPrompt, approval) is left out on its own, as if it were in skip. Leave a check out only when it doesn't apply to your app; when a check fails for a real bug, fix the app.

To run a single check while you work on its bug, filter by its id, which is part of the test name:

npx vitest run test/checks.test.ts -t "slack.retry"

The id lists are exported too, as SLACK_CHECKS, SLACK_MODEL_CHECKS, GITHUB_CHECKS, LINEAR_CHECKS, NOTION_CHECKS, RESEND_CHECKS, GOOGLE_CHECKS and DISCORD_CHECKS, for a script that builds skip from them.

In live mode#

Most checks are about delivery: retries, redeliveries, forged signatures, acknowledgement times. Live, the real platform delivers to your app, so a message or comment has no delivery to retry or forge. Every check that needs one skips, before it waits for anything, with the reason in the report (live: Slack delivers to the agent itself, so delivery checks are fake-only). Nothing needs to go in skip for a live run. A fake run whose agent has no webhook URL (CHANNELSTACK_<CHANNEL>_WEBHOOK_URL) has no deliveries either, so these checks skip there too, with the same note. That run is still red: every check that waits for a reply fails.

ChecksLive
slack.retry, slack.redelivery, slack.bad-signature, slack.ack, slack.slow-model; github.redelivery, github.bad-signature; linear.redelivery, linear.stale, linear.bad-signature; notion.redelivery, notion.bad-signature; resend.redelivery, resend.bad-signature, resend.stale; google.redelivery, google.bad-signature, google.wrong-audience, google.staleSkip, with the delivery reason
google.historySkips at its exact count, because waiting for quiet needs proxy mode live (Live mode)
slack.msg-too-long, slack.stop and the others that use a fault, Stop or an exact countSkip, with the reason
slack.in-thread, slack.ignores-bots, slack.stream-stopSkip, with the reason: they wait for quiet, read the status line or create a bot user, which live mode can't do yet
github.review-thread, github.check-runSkip, with the reason: they open a pull request, and pull requests aren't built live yet
<platform>.no-reply-loopSkip, with the reason: they make a second app, or wait for quiet, which live mode can't do yet
discord.dm-once, discord.resume, discord.long-answer, discord.ignores-bots, discord.interaction-3s, discord.bad-signatureSkip, with the reason: live, a person is a bot of their own, and Discord lets no bot DM another bot or run another app's command; another bot to ignore isn't built live; and the dropped connection is a fault

Six run against the real platform: linear.first-activity, linear.ends-turn, notion.reply-in-discussion, resend.reply-in-thread, google.reply-in-thread and discord.mention-once. The fake run on every pull request runs them all.

Suggest changes to this page