The try report¶
agent-kourier try --json prints one JSON object, schema try/v1. The text report is written from the same object, so
every value the text shows is here, whole where the text cuts it at 80 characters. How to run try is
in Try a sample before you go live, and its flags and exit codes are in
Command line and environment.
A section that does not apply is null, never left out. A list that is empty is [], unless its row says when it
is null. A field may be added to try/v1; a field renamed or removed would be try/v2.
A run that cannot be made as the command line asks (a wrong flag, config, input or secrets file, exit code 2) is a
report too: problems holds every problem found, notes is [], and every other section is null. An error in a
flag given before --json is text on standard error instead, since --json was not read yet.
Top level¶
| Field | Type | Meaning |
|---|---|---|
schema |
string | Always try/v1. |
binding |
string | The Binding tried, namespace/name. On a report of problems, the Binding the broker refuses, when that is the problem; else empty. |
connection |
string | The Binding's ChatConnection, namespace/name. Empty on a report of problems. |
platform |
string | The ChatConnection's spec.platform: slack or webhook. Empty on a report of problems. |
input |
object | What was tried (below). null on a report of problems. |
signatureChecked |
bool | Always false: try reads a file, which carries no signature to verify. |
problems |
array | Why the run could not be made (below). [] on a report of a run. |
message |
object | The message, for a message input (below). null for a webhook input. |
decode |
object | What the webhook connection made of a webhook input (below). null for a message input. |
verdict |
object | What the Binding's triggers made of the input (below). null when no trigger saw it: a webhook event the connection dropped, or one of another channel. |
firstTurn |
object | The first turn, or why there is none (below). null when no trigger took the input, and for a close (verdict.thread.closes), whose prompt the broker never renders. |
outcome |
object | What the input came to: one word, the one an expect is compared with (below). null on a report of problems. |
agent |
object | The agent check (below). null without --agent. |
expect |
object | The expect, and whether it held (below). null when the input carries none and no --expect was given. |
notes |
array of strings | Lines that hold for the whole run: that the signature was not checked (a webhook input), that a signature header was given and ignored, that the message was edited. |
input¶
| Field | Meaning |
|---|---|
kind |
message or webhook. |
format |
case (a case file, --input) or slack-json (a message as Slack's API returns it, --body) for a message; json for a webhook body. |
source |
The input as the command line named it: a file name, stdin, or a sample's name. |
problems¶
Each entry:
| Field | Meaning |
|---|---|
part |
What the problem is in: config, binding (the choice of the Binding, or the broker's refusal of it), input, workspaceURL, agentURL or secrets. |
file |
The config file, for a problem of one; else empty. |
document |
The YAML document in file, counted from 1; 0 when the problem is of the file itself, or there is no file. |
path |
The field the problem is about, as the loader names it, such as spec.chat.triggers[0].match.evnt; empty when there is none. |
message |
What is wrong. It never holds a secret. |
reason |
The broker's reason for refusing the Binding, such as UnsupportedOnPlatform; empty for any other problem. |
secretFile |
For a problem of secrets that is about one Secret, the Secret's file under --secrets, <namespace>/<name>/<key>; empty for any other problem. |
message¶
The message as the Slack adapter hands it on: the fields a botMessage trigger reads.
| Field | Meaning |
|---|---|
sender |
bot <bot_id>, whether or not the adapter drops the message. Empty for a dropped message that has no bot_id. |
title |
The first attachment's title. |
link |
The first attachment's title_link. |
fallback |
The first attachment's fallback. |
footer |
The first attachment's footer. |
body |
The first attachment's text. |
text |
The message's own text. |
inThread |
The message is a reply inside a thread. |
permalink |
The message's permalink, what a template reads as .Link. Empty without --workspace-url, as it is live when the adapter knows no workspace address. |
unread |
What the adapter's conversion of a Slack message does not read, as paths of the message: attachments[1] and each attachment after it, blocks, and the first attachment's attachments[0].pretext, attachments[0].fields and attachments[0].blocks. [] when it reads everything, and null for a case file, which holds only what is read. |
decode¶
What the webhook connection made of the body and its headers: its steps after the signature, which try skips.
| Field | Meaning |
|---|---|
outcome |
accepted, or the step that dropped the event: malformed, unmapped, self or ignored. |
reason |
The drop's reason: schema, depth, duplicate_key, no_channel, no_actor, bad_id or no_thread. Empty for accepted and self. |
droppedOn |
What the step that dropped the event reads, as the connection names it: the JSON Pointers of channel.from (no_channel) or actor.from (no_actor), in order, or the name of the thread's field (no_thread and bad_id). null for any other reason, and when the event was not dropped. |
channel |
The event's channel, once the connection found one. |
bindingChannel |
The Binding's chat.channel. |
channelMatched |
channel is bindingChannel, so the Binding's triggers see the event. |
thread |
The thread the connection derived. Empty when the event was dropped or the connection names no thread. |
actor |
Who caused the event. |
actorFrom |
The JSON Pointer the actor came from. On self, the one whose value is the identity. |
identity |
The connection's spec.webhook.identity. |
delivery |
The delivery ID. The broker only logs and traces it. |
deliveryHeader |
The header the delivery ID is read from. Empty when the connection reads none. |
deliveryAbsent |
The delivery header has no value in the input. |
deliveryInvalid |
The delivery header's value failed the id check. |
fields |
Every field of the connection, in its order (below). null when the event was dropped before the fields were read. |
Each entry of fields:
| Field | Meaning |
|---|---|
name |
The field's name. |
kind |
id or text. |
from |
Where the value came from: header:<Name> for a header field, else the JSON Pointer of the value the field took, or, for an invalid field, the first that resolved. Empty when no pointer resolved. |
value |
The value, whole. Empty when the field is absent or invalid. |
invalid |
The id field had values, and none passed the id check. tried lists them. |
absentHeader |
The field reads a header that the input does not have. |
tried |
Each value of an id field that failed the id check, in order, and was passed over for value or, when invalid, for none (below). [] when there is none. |
Each entry of tried:
| Field | Meaning |
|---|---|
from |
Where the value came from, as the field's from names it. |
raw |
The value, whole. It is untrusted text. |
problem |
The check it failed: too_long or character. |
verdict¶
What the Binding's triggers made of the input: the trigger that took it, or why none did. What the input came to is the
report's outcome.
| Field | Meaning |
|---|---|
reason |
Why a message is ignored: thread_reply (a bot's reply inside a thread, on which no botMessage trigger is tried) or dropped (the Slack adapter drops it before any trigger sees it: a subtype it does not read, or nothing to read). Empty for any other outcome. |
triggerCount |
How many triggers of the input's type the Binding has, tried in order, the first match winning: botMessage for a message, webhookEvent for an event. 0 for a Binding with no botMessage trigger, whose outcome for a bot's message is other_bot. |
trigger |
The index in chat.triggers of the trigger that took the input, whether or not a turn would start. null when none did. |
type |
That trigger's type. null when no trigger took the input. |
fields |
The values the trigger extracted, by name. {} when it extracts none; null when no trigger took the input. |
thread |
The thread the turn would belong to (below). null when no trigger took the input. |
notEvaluated |
What try cannot know offline, when a turn would start: own post (for a Slack message's JSON, which may be Agent Kourier's own), cooldown (a message trigger with thread.by), rate limits, daily cap and session state. null when no turn would start. |
why |
For unmatched and excluded, where each trigger turned the input away, in trigger order (below). [] otherwise. |
thread:
| Field | Meaning |
|---|---|
by |
connection for a webhook event (the connection's thread), key for a message trigger with thread.by: key, and message for one without, whose message opens a thread of its own. |
prefix |
The connection's thread prefix, for connection. |
field |
The connection's thread field, for connection. |
key |
The key the trigger extracted, for key. |
value |
The thread: the connection's prefix and the field's value (the event's own ID when the connection names no thread), the key, or the message's ts. |
closeWhen |
The trigger's thread.closeWhen, for key; null otherwise, and when it has none. |
closes |
The message is a close: its extracted fields satisfy closeWhen. The broker starts no turn for it, whatever the state of the key's thread. If that thread is open and its turn started, the broker posts "Resolved at <time>." in it and closes it; otherwise, and for an empty key, it posts nothing. try cannot know which. Always false for a webhook event. |
Each entry of why, the first rule of one trigger that turned the input away:
| Field | Meaning |
|---|---|
trigger |
The trigger's index in chat.triggers. |
step |
sender, match, exclude or extract. |
detail |
The field of a match or exclude regex, or the name of an extract entry. For sender, kind when the sender has the trigger's ID and is of another kind. |
pattern |
The rule's regex as the Binding writes it. Empty for sender. |
value |
What the regex was tested against, whole: the message's field, or the event's (empty when absent or invalid). |
absentHeader |
The header that the rule's webhook field reads and the input does not have; empty otherwise. |
firstTurn¶
| Field | Meaning |
|---|---|
text |
The text the agent would get, whole: the template's output, then the untrusted block. Empty when refused. |
truncated |
The template's output was cut at 4000 UTF-16 units, as it is live. |
refused |
Why no turn starts (below). null when one does. |
refused:
| Field | Meaning |
|---|---|
ref |
The value the template reads that was refused, such as Fields.headSHA; or template, for a template that failed to run. |
reason |
Why: invalid, too_long, characters or not_link for a value, and render_error for template. |
outcome¶
| Field | Meaning |
|---|---|
word |
What the input came to, one of the words below. |
trigger |
The index in chat.triggers of the trigger that took the input, for matched, closed and refused. null for any other word. |
The words are those of --expect:
| Word | The input |
|---|---|
matched |
A trigger took it, and a turn would start. |
closed |
A trigger took it and it is a close (verdict.thread.closes), so no turn starts. Only a message can be one. |
refused |
A trigger took it and its first turn was refused (firstTurn.refused), so no turn starts. |
unmatched |
Each trigger that was tried turned it away, and none by its exclude. |
excluded |
Each trigger that was tried turned it away, and at least one by its exclude. |
other_bot |
A message of a bot that no botMessage trigger names. |
ignored |
A message the Slack adapter drops, or a bot's reply inside a thread (verdict.reason says which); or a webhook event that the connection drops for its actor (decode.reason no_actor). |
self |
A webhook event whose actor is the connection's identity, which the connection drops. |
unmapped |
A webhook event that the connection drops for its channel or its thread (decode.reason). |
malformed |
A webhook body that the connection cannot read (decode.reason). |
other_channel |
A webhook event that the connection takes, in a channel other than the Binding's. |
agent¶
| Field | Meaning |
|---|---|
checked |
Always true: the check ran. |
turnSent |
Always false: the check sends the agent no turn and no message. |
url |
The URL the check used: --agent-url, or the AgentBackend's. |
urlReplaced |
--agent-url replaced the AgentBackend's URL. |
backendURL |
The AgentBackend's URL, as the config names it. |
tokenFile |
Where the Binding's token Secret is read under --secrets, <namespace>/<name>/<key>. null for a Binding with no identity.tokenSecretRef. |
unreadableFile |
On CredentialsUnreadable, the file of the Secret that could not be read, laid out as tokenFile: the token's, or an AgentBackend header's. null on any other reason, and when what failed is no Secret. |
reason |
The reason the Binding's BackendReachable condition will have: OK, or one such as CredentialsRejected, CredentialsUnreadable, Unreachable or StreamingUnsupported (Binding status). |
message |
The condition's message, word for word, less the clause "; the operator's log has the cause" that ends some of them: cause has it. |
cause |
The cause behind a failure, redacted, which the condition leaves out. Empty when there is none. |
card |
The card fetched, on OK (below). null otherwise. |
card:
| Field | Meaning |
|---|---|
name |
The card's name. |
url |
The agent's endpoint the card was fetched under. |
expect¶
| Field | Meaning |
|---|---|
want |
The expect: --expect's, else the input's own (below). |
from |
Where the expect came from: sample (a built-in sample's), case (a case file's) or flag (--expect's). |
held |
The input came to the outcome expected, and, where the expect names them, to the trigger and the fields. With an expect, it decides the exit code (Command line). |
mismatches |
Each difference: the outcome (outcome: want matched, got refused), or else the trigger (trigger: want 1, got 0) and one line for each field that differs (field state: want "FIRING", got "RESOLVED", with none for a field that is not there), in the order of their names. [] when it held. |
The outcome and the trigger compared are the report's outcome, so matched holds only when a turn would
start. The fields compared are those that have a value in
decode.fields for a webhook event, whatever the outcome, and verdict.fields for a message that a trigger took.
want:
| Field | Meaning |
|---|---|
outcome |
The outcome expected. |
trigger |
The trigger expected to take the input, for matched, closed and refused. null when the expect names none. |
fields |
The fields expected, by name. null when the expect names none, as --expect never does. |
An example¶
The GitHub sample's body, run without its event header:
$ agent-kourier try --config examples/recipes/webhook-github/kourier/ --binding acme-webhooks/github-reviews --body pr.json --json
{
"schema": "try/v1",
"binding": "acme-webhooks/github-reviews",
"connection": "acme-webhooks/github",
"platform": "webhook",
"input": {
"kind": "webhook",
"format": "json",
"source": "pr.json"
},
"signatureChecked": false,
"problems": [],
"message": null,
"decode": {
"outcome": "accepted",
"reason": "",
"droppedOn": null,
"channel": "acme/widgets",
"bindingChannel": "acme/widgets",
"channelMatched": true,
"thread": "pr-42",
"actor": "octocat",
"actorFrom": "/sender/login",
"identity": "acme-review-agent",
"delivery": "",
"deliveryHeader": "X-GitHub-Delivery",
"deliveryAbsent": true,
"deliveryInvalid": false,
"fields": [
{
"name": "event",
"kind": "id",
"from": "header:X-GitHub-Event",
"value": "",
"invalid": false,
"absentHeader": true,
"tried": []
},
{
"name": "action",
"kind": "id",
"from": "/action",
"value": "opened",
"invalid": false,
"absentHeader": false,
"tried": []
},
{
"name": "number",
"kind": "id",
"from": "/pull_request/number",
"value": "42",
"invalid": false,
"absentHeader": false,
"tried": []
},
{
"name": "prNumber",
"kind": "id",
"from": "/pull_request/number",
"value": "42",
"invalid": false,
"absentHeader": false,
"tried": []
},
{
"name": "draft",
"kind": "id",
"from": "/pull_request/draft",
"value": "false",
"invalid": false,
"absentHeader": false,
"tried": []
},
{
"name": "repo",
"kind": "id",
"from": "/repository/full_name",
"value": "acme/widgets",
"invalid": false,
"absentHeader": false,
"tried": []
},
{
"name": "headSHA",
"kind": "id",
"from": "/pull_request/head/sha",
"value": "9f1c2ab",
"invalid": false,
"absentHeader": false,
"tried": []
},
{
"name": "baseSHA",
"kind": "id",
"from": "/pull_request/base/sha",
"value": "3e4d5f6",
"invalid": false,
"absentHeader": false,
"tried": []
},
{
"name": "title",
"kind": "text",
"from": "/pull_request/title",
"value": "Retry Slack posts on 429",
"invalid": false,
"absentHeader": false,
"tried": []
},
{
"name": "body",
"kind": "text",
"from": "/pull_request/body",
"value": "Adds backoff.",
"invalid": false,
"absentHeader": false,
"tried": []
},
{
"name": "headRef",
"kind": "text",
"from": "/pull_request/head/ref",
"value": "retry-429",
"invalid": false,
"absentHeader": false,
"tried": []
},
{
"name": "url",
"kind": "text",
"from": "/pull_request/html_url",
"value": "https://github.com/acme/widgets/pull/42",
"invalid": false,
"absentHeader": false,
"tried": []
},
{
"name": "comment",
"kind": "text",
"from": "",
"value": "",
"invalid": false,
"absentHeader": false,
"tried": []
}
]
},
"verdict": {
"reason": "",
"triggerCount": 2,
"trigger": null,
"type": null,
"fields": null,
"thread": null,
"notEvaluated": null,
"why": [
{
"trigger": 0,
"step": "match",
"detail": "event",
"pattern": "^pull_request$",
"value": "",
"absentHeader": "X-GitHub-Event"
},
{
"trigger": 1,
"step": "match",
"detail": "action",
"pattern": "^created$",
"value": "opened",
"absentHeader": ""
}
]
},
"firstTurn": null,
"outcome": {
"word": "unmatched",
"trigger": null
},
"agent": null,
"expect": null,
"notes": [
"signature not checked: try reads a file, not a signed request"
]
}
$ echo $?
5
--samples --json¶
agent-kourier try --samples --json prints the built-in samples as one JSON array, not a try/v1 report. Each entry:
| Field | Meaning |
|---|---|
name |
<integration>/<event>, the name --sample takes. |
integration |
The part of the name before the slash. |
platform |
The platform of the connection the sample is tried on: slack for a message, webhook for an event's body. |
recipe |
The recipe under examples/recipes it is for. |
binding |
That recipe's Binding, namespace/name. |
summary |
What the sample shows, in one line. |
expect |
What the recipe's Binding makes of it (below). |
case |
A message sample's case file, as --print-sample writes it (below). null for a webhook sample. |
headers |
A webhook sample's headers, as its service sends them (below). null for a message sample. |
Each expect, the sample's and its case's:
| Field | Meaning |
|---|---|
outcome |
The outcome. |
trigger |
The trigger that takes it. null when the expect names none. |
fields |
The fields, by name: what the trigger extracts from a message, or what a webhook body decodes. |
case, whose keys are left out when empty:
| Field | Meaning |
|---|---|
name |
What the case is. |
binding |
The Binding, namespace/name. |
message |
The message (below). |
expect |
The expect, as above. |
message, a bot's message as the Slack adapter hands it on:
| Field | Meaning |
|---|---|
bot |
The bot ID. |
user |
A person's ID. Never set: try refuses a person's message. |
text |
The message's own text. |
title |
The first attachment's title. |
link |
The first attachment's title_link. |
fallback |
The first attachment's fallback. |
footer |
The first attachment's footer. |
body |
The first attachment's text. |
inThread |
The message is a reply inside a thread. |
Each entry of headers:
| Field | Meaning |
|---|---|
name |
The header's name. |
value |
Its value. |
read |
true for a header that a field of the connection reads, which a run of the body needs. |
The list has no body: --print-sample <name> writes a webhook sample's body.