Skip to content

feat(triage): read the trusted prior analysis in the pre-script - #2061

Closed
tpouyer wants to merge 106 commits into
fullsend-ai:mainfrom
tpouyer:triage-prior-script
Closed

tpouyer wants to merge 106 commits into
fullsend-ai:mainfrom
tpouyer:triage-prior-script

Conversation

@tpouyer

@tpouyer tpouyer commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #2053. Stacked on #2044: review only the commits after fcf1107. The last commit is an ours merge that only records this branch's pre-rebase history so the push stayed a fast-forward; it changes no files.

Step 2e of agents/triage.md asked the triage agent to do multi-request bookkeeping by hand: read every page of the comment listing and of a GraphQL editor query, join them by id, check each author and last editor against the triage account, date each comment by its last trusted edit, cut at the first Previous run fold, and pick the newest analysis. A missed page or a wrong join silently changes the baseline.

This moves that work into the triage pre-script, which already runs on the host with the tracker credentials. It writes a JSON result that the harness copies into the sandbox, and step 2e now works from that file. The agent's tools are unchanged: Bash(gh,curl,jq), Skill.

The result also restores what e6098e0 took out of the prompt: it lists causes that an older trusted analysis or a Previous run fold of the baseline names but the baseline's lists do not, so the agent can re-check them.

Changes

  • scripts/lib/prior-triage.lib.sh, bundled into scripts/pre-triage.sh. prior_triage_write reads every comment page and every editor page, applies the trust and dating rules, and writes the JSON. It never fails the pre-script: any error is written into the file.
    • GitHub: gh api --paginate plus a GraphQL cursor loop for lastEditedAt and editor. The trusted names are <owner>-triage, fullsend-ai-triage and ${FULLSEND_APP_SET}-triage, compared case-insensitively. These are the names review-ops.lib.sh trusts for the review App, with -triage.
    • GitLab: notes are read with page and X-Next-Page, and a full page without the header still asks for the next one. A GraphQL cursor loop reads lastEditedBy. Ownership is matched by account id from /api/v4/user, using the triage ops' _gitlab_api and trusted CI origin.
    • Jira: comments are read with startAt, advancing by the comments returned. Without a total in the response, a full page is never taken as the last. The loop stops with an error after 100 pages, the same cap fullsend's own Jira client uses. The marker comes from the fullsend.sticky-marker property, run status from the fullsend.agent-status property, ownership from /myself, and edits from updateAuthor. The ADF body is rendered as text and cut at the first Previous run expand node. It uses the triage ops' _jira_api, which strips trailing slashes from the base URL and selects the auth mode.
    • One selection program for all three trackers: it splits the folds, parses the Open causes and Ruled out lists, picks the baseline, and builds updates, untrusted_marked and dropped_cause_candidates.
  • scripts/pre-triage.src.sh: after the label reset, writes ${RUNNER_TEMP}/triage-workspace-${CI_JOB_ID}/prior-triage.json when RUNNER_TEMP is set. It removes any earlier directory, creates a new one private to the runner user, and checks every write: a failed mkdir, cp or write becomes a warning and never fails the pre-script. The log says whether the file was written, written with an error, or not written.
  • harness/triage.yaml: an optional host file copies it to /sandbox/workspace/prior-triage.json.
  • agents/triage.md step 2e: read that file with jq, field by field. The file is a snapshot taken before the run. The pagination, join, trust and dating prose is gone. What the pre-script does not cover stays: how to read the lists, the carry rules, and claims versus findings. The dropped-cause rule is back, driven by dropped_cause_candidates.
  • skills/gitlab-forge/SKILL.md, skills/jira-forge/SKILL.md: the paging rules the pre-script follows, for the by-hand fallback. On GitLab, a full page without X-Next-Page still has a next page. On Jira, keep going until a page is empty, the total is reached, or (with no total) a page is short, and stop after 100 pages.
  • docs/triage.md: describes the pre-script.
  • scripts/prior-triage-test.sh, wired into make script-test.

Output shape:

{"forge": "github", "error": null, "trust_error": null,
 "trusted_names": ["acme-triage", "fullsend-ai-triage"],
 "seen": {"comments": 12, "marked": 3},
 "analyses": [{"id": "1", "created": "…", "dated": "…", "edited": false, "text": "…", "folds": [{"title": "Previous run", "text": "…"}]}],
 "baseline": {"id": "1", "dated": "…", "has_lists": true, "text": "<text above the first fold>"},
 "updates": [{"id": "3", "dated": "…", "marker": "triage-in-progress", "text": "…"}],
 "earlier_results": [{"id": "0", "dated": "…", "marker": null, "text": "Duplicate of #12 …"}],
 "untrusted_marked": [{"id": "2", "created": "…", "marker": "triage-agent", "reason": "not posted by the triage account"}],
 "dropped_cause_candidates": [{"cause": "Stale token", "newest": "open", "open_in": ["1 Previous run"], "ruled_out_in": []}]}

Relation to fullsend's specs

These are fullsend-ai/fullsend's ADR 0107 (bot identity), ADR 0133 (actor-attributed data) and ADR 0141 (entity-context staging), and the authorization v2 sections "Bot identity fields" and "Model-bound actor-attributed data admission".

  • Interim, agents-side. This pre-script is an interim subset of ADR 0141's entity-context snapshot and agent-run receipts. Step 2e moves to those when they ship.
  • Bot identity. The GitHub App-name list (<owner>-triage, fullsend-ai-triage, ${FULLSEND_APP_SET}-triage) is an interim naming convention. ADR 0107 does not accept App names as bot identity. The list is to be replaced by the mint's registered bot_role == "triage" once Let harness scripts resolve a bot's registered role (ADR 0107) fullsend#9602 exposes that lookup to harness scripts; today fullsend run withholds the mint's OIDC variables from child scripts. The GitLab and Jira own-account match (/api/v4/user id, /myself accountId) is an exact identity, pending confirmation in #9602.
  • Only trusted comments carry text (ADR 0133). The file stages text only for comments the pre-script trusts: the baseline, analyses, updates and earlier_results. Their Previous run folds are included, but a fold may hold text someone else edited before fullsend folded it, so step 2e reads fold text as claims. dropped_cause_candidates are drawn from those alone. untrusted_marked lists other marked comments by id, created, marker and reason only. Step 2e has the agent read those itself with its forge skill, as claims, as it did before this PR.
  • What the file still does not do:
    • No human role gate. Human comments are never staged with text, so none is needed for them. The file also does not check a human's current role.
    • Trusted text is not filtered on the host. I looked at fullsend scan input (internal/cli/scan.go). fullsend is on the pre-script's PATH: the Jira post-script already calls it, and the eval runs fullsend run. But the command does not fit:
      • It reads one GitHub event from EVENT_PAYLOAD and returns sanitized text only through the GITHUB_OUTPUT side channel, so each comment would have to be wrapped in a fake event.
      • Its SSRF stage runs on every *body field. It marks any localhost or private-IP URL critical and resolves every URL's host from the runner, so it would drop the many analyses that quote a local URL.
      • Its input pipeline (Unicode normalizer, injection scanner) has no secret redaction.
    • So I did not hand-roll a scanner. The trusted text goes in unfiltered. fullsend's sandbox PostToolUse chain (internal/security/hooks.go: every tool, on by default; Unicode, secret redaction, context suppression) sees it when the agent reads the file, as they see the agent's own gh reads. ADR 0141's filtered snapshot is where host-side filtering belongs.

Trade-offs

  • Host side, not in the sandbox. An earlier revision ran a script in the sandbox, which needed bash in the agent's Bash allowlist. That would let an agent reading untrusted issue text run any shell command. pi's enforced allowlist refuses bash anyway. The pre-script approach depends on these points in fullsend (as pinned in go.mod):
    • internal/cli/run.go runs the pre-script (runPreScript) before bootstrapEnv stages host_files.
    • An optional host file may be created by the pre-script (internal/harness/harness.go, the host-file check).
    • A ${VAR} src is expanded on the host at staging time. A relative src would instead be fetched from the base URL when the harness is composed (internal/harness/compose.go resolveBaseHostFiles), which is why the src uses ${RUNNER_TEMP}.
    • GitHub Actions sets RUNNER_TEMP. fullsend's GitLab job script exports it for exactly this use (internal/scaffold/fullsend-repo-gitlab/.gitlab/ci/scripts/run-agent-job.sh), and the scribe harness does the same.
    • Without RUNNER_TEMP there is no file, and step 2e falls back to reading the comments with the forge skill and trusting none of them.
  • Identifiers come from fullsend, as pinned in go.mod:
    • fold titles: internal/sticky/sticky.go BuildUpdatedBody;
    • the fullsend:agent-status: body marker: internal/tracker/tracker.go StatusMarkerPrefix;
    • the fullsend.agent-status and fullsend.sticky-marker Jira properties: internal/tracker/jira_client.go.
    • These sources are cited in the lib's header.
  • No harness slug in the trusted names. FULLSEND_SLUG exists only in the sandbox. The host side trusts the same names as the review pre-script, and the triage harness's slug is fullsend-ai-triage, which is in that list. fullsend's triage job exports FULLSEND_APP_SET since fix(#9568): export FULLSEND_APP_SET to the triage agent step fullsend#9575; an install on fullsend v0.56.1 or earlier whose custom App set is not named after the owner still matches none of the names. The output lists trusted_names. A Bot whose App name ends in -triage but is not one of them gets the reason App not in the trusted names, so the agent can say why in reasoning. Any other Bot is "not posted by the triage account".
  • Dropped causes go back where they were. Each candidate carries newest: the list its most recent source put it in. Step 2e puts an open one back in Open causes ending (unverified), unless the agent refutes it now. A ruled_out one goes back in Ruled out while its evidence still holds, and to Open causes only on reviving evidence. A cause an older source only ruled out is never revived just because the baseline dropped it.
  • Dropped causes are matched by exact name: case-insensitive, with collapsed whitespace and without (unverified). A cause written in other words cannot be matched deterministically, so it shows up as a candidate, and the prompt tells the agent to drop any candidate the baseline already lists in other words. That means false positives the agent filters out, never a silently missed cause. Folds carry no timestamps, so the sources come out in the most recent order the script can know: the baseline's folds in order, then older analyses newest first, each before its own folds. Fold rulings are never treated as established.
  • Conservative trust. A comment missing from the editor query, or edited by an account the query cannot name, counts as edited by someone else. Nothing is trusted (trust_error) when any of these happens:
    • the editor query fails;
    • it returns errors next to partial data;
    • it promises another page without a cursor;
    • the account lookup fails.
  • Fail closed on a planted directory. The harness copies whatever sits at the job's path, so a directory there that this user cannot remove, or a new one that is not a real directory this user owns (a symlink, or one another user made on a shared /tmp), fails the pre-script with an ::error::. The directory is checked again before and after the copy, because the network reads take seconds. Before the copy, it must still be a real directory this user owns. After the copy, the file must byte-compare equal to the one this run wrote and not be a symlink. A failed triage is better than a forged baseline. What remains is the instant between the last check and the harness copying the file, which no check in the pre-script can close. Every other write failure leaves nothing at the path, so it stays a warning and the run goes on without the file.
  • Edited during the read. The comment listing and the editor query are two requests. A triage-account edit whose editor time is later than the listing's updated_at (GitHub) or note updated_at (GitLab) means the listed body is an older one, possibly one someone else edited. Any later editor time counts, with no slack, and the comment is untrusted with the reason edited during the read. A false positive (the two APIs stamping one edit apart) only sends step 2e down the rebuild path. On GitLab, lastEditedAt falls back to the note's updated_at for notes edited before last_edited_at existed, and resolving a thread moves updated_at, so resolving such a note during the read reads as a race; that false positive is safe. Jira reads body and editor in one request. Reading the body from the GraphQL editor query instead would make the two consistent, but it would move author and App identity off the REST listing that the trust check is built on, so I kept the comparison. On Triage re-runs: carry the prior analysis and its refutations reliably across trackers #2042, the status comment fullsend edited shows REST updated_at and GraphQL lastEditedAt both at 2026-11-15T18:21:13Z, so the two APIs stamp the same edit identically.
  • Compacted Ruled out lines. The size fold's Also ruled out (see earlier analysis): a; b; c line, as a list item or a plain line, with the label bold or not, after a colon or a spaced dash, counts each ;-separated name as ruled out. A plain list item such as Alpha, Beta stays one name. The eval cause_lists judge at this base does not split the line; as test(eval): cover reviving, size folds, question refutations and fold-only causes #2062 changes it, the judge reads it the same way.
  • Overlapping runs. The file is a snapshot taken before the run. If the issue shows a triage-agent comment, or an edit of one, newer than baseline.dated, step 2e has the agent check it by hand with the same trust rules, and use it as the baseline only if it passes.
  • Dropped-cause candidates only for a baseline with lists. Without lists, the rebuild path reads every earlier analysis anyway.
  • Run-status comments are left out of updates and earlier_results. They are recognised by the body marker, or on Jira by the property.
  • Unmarked triage results are kept. A question, duplicate or not-planned result carries no marker (post-triage.sh posts it with tracker_post_comment). Those dated after the baseline are updates. Those dated before it, or all of them when there is no baseline, are earlier_results; triage-in-progress notes are left out of earlier_results. Step 2e counts them as triage results when they read as one, as the old prompt did.
  • A date that does not parse is untrusted (reason date unreadable), so it can never sort its way into being the baseline.
  • One file per job. fullsend's GitLab job script defaults RUNNER_TEMP to /tmp, which the jobs of a persistent runner share, so the path carries CI_JOB_ID. On GitHub CI_JOB_ID is unset: the pre-script and the host file both expand it to empty (internal/cli/run.go hostFileSource → safeExpandEnv, os.Expand), and each Actions job has its own RUNNER_TEMP. Nothing removes the file after the run. It holds issue comments only and is readable only by the runner user.
  • Eval. eval/scripts/run-fullsend.sh runs fullsend run triage, which runs the pre-script. The functional-test workflows run on GitHub-hosted runners, where RUNNER_TEMP is set, so the file is produced there. The seeded comments come from the eval account, not a triage App, so they are listed in untrusted_marked without text. The agent reads them with its forge skill, as before this PR, and cases 013–017 still take the no-trusted-baseline rebuild path they were written for. A local eval run without RUNNER_TEMP gets no file and the by-hand fallback. I have not re-run the eval cases.
  • GitLab folds after the rebase. At this base, GitLab triage posts a new note every run and never folds. main now folds GitLab notes itself, with nested <details> blocks all titled Previous run. The parser handles them: the baseline cut is right, and nested closing tags are stripped (tested). But fold labels repeat, and the Previous run (2) order the prompt describes does not hold there. That needs revisiting when this branch is rebased.

Testing

  • bash scripts/prior-triage-test.sh: 79 checks, passing against both the source and the bundled pre-triage.sh. They run the real pre-script against stubbed gh and curl.
    • GitHub:
      • forged marked comments, from a human and from another App, listed without their text or folds;
      • a bot comment last edited by a user or by another App, and one whose editor cannot be read;
      • a duplicate fullsend kept editing: the older comment, edited after the newer one was created, is dated by the edit;
      • a newer triage-in-progress note, an unmarked question, and a run-status comment;
      • two pages of comments and two pages of the editor query;
      • App-set and owner App names, and a -triage App outside them;
      • a failed editor query, and one that returns errors with partial data;
      • a failed copy (warning, no file, run continues);
      • a failed listing and an unparseable listing: the error is written, and the pre-script still succeeds;
      • an issue with no comments;
      • an analysis without lists, with no candidates although an older analysis has lists;
      • fold cut, with "Previous run" written in prose that is not a fold;
      • dropped-cause candidates: a cause dropped without a ruling, a ruling in a fold, a truncated fold, and a reworded cause next to a case-only change;
      • the stub checks that requests name the right issue;
      • unmarked results before the baseline, with an older triage-in-progress note left out, and with no baseline (earlier_results);
      • a date that does not parse;
      • an editor page without a cursor;
      • nested fold endings;
      • a triage-account edit after the listing (edited during the read), including one 3 s after the listing and a user-edited body the bot edited again 2 s later, while an unedited comment and an own edit the listing already shows stay trusted;
      • compacted Ruled out lines in a fold and in an older analysis, with each name's newest ruling.
    • GitLab:
      • own-account match by id when another account has the same username;
      • a foreign lastEditedBy;
      • lastEditedAt without lastEditedBy;
      • system notes;
      • a 100-note first page with and without X-Next-Page;
      • an own edit, and one made after the listing;
      • a trusted baseline that dropped causes from an older own note, with each candidate's newest list;
      • editor pages with errors, and a next page without a cursor;
      • a failed /user.
    • Jira:
      • the property marker, including a human comment that carries one;
      • a foreign updateAuthor;
      • an own edit with a +0200 offset;
      • three short pages, advanced by the comments returned;
      • ADF fold cut with a bold heading;
      • a candidate found only in a fold;
      • a status comment marked only by its fullsend.agent-status property;
      • Bearer auth;
      • a base URL with trailing slashes;
      • full pages without a total;
      • endless pages (error after 100);
      • a failed /myself.
    • Wiring:
      • with no RUNNER_TEMP, the pre-script writes nothing;
      • the harness src, expanded as fullsend expands it, is the file the pre-script wrote, both with and without CI_JOB_ID;
      • the file is optional and not world-readable;
      • a stale directory is replaced by a new private one, and the log reports the error rather than success;
      • an unwritable RUNNER_TEMP gives a warning, and the run continues;
      • a planted directory, or a symlink, that this user cannot remove fails the pre-script, and the planted file is never read;
      • the job directory swapped for a symlink while the comments are read (done from inside the gh stub) fails the pre-script, and the planted file is neither read nor overwritten;
      • the agent's tools stay Bash(gh,curl,jq), Skill.
  • scripts/pre-triage-test.sh (source and bundled) unsets RUNNER_TEMP so it stays about labels, and passes.
  • Also run, all passing:
    • scripts/harness-jira-test.sh
    • scripts/sandbox-credential-boundary-test.sh
    • scripts/skill-env-reachability-test.sh
    • make check-bundle
    • make lint
    • pre-commit run --from-ref fcf1107 --to-ref HEAD
  • Not run: a live triage run on GitHub, GitLab or Jira.

tpouyer and others added 30 commits November 14, 2026 16:31
The GitLab triage and prioritize doors found the bot's earlier note that
starts with the marker and edited it in place, folding the previous body
into a "Previous run" block. The newest result then sat above the
requests that asked for it. fullsend-ai/fullsend#9399 (still open) makes
the doors in that repo append a new comment per run; these two doors
live here.

tracker_post_sticky_comment (gitlab-triage-ops) and
forge_post_sticky_comment (gitlab-prioritize-ops) now POST one new note
per run, marker on the first line and the body below it, as before. This
covers the sufficient result, the in-progress status note and the
prioritize result. They no longer resolve the token owner, list notes or
PUT to /notes/:id, so the now-unused _gitlab_bot_username helpers go
too. Both require GITLAB_TOKEN and, on a failed POST, print a
::warning:: and return 1. The function names stay. The in-repo Jira door
posts through `fullsend issues post-comment` and would change with
#9399's CLI, not here.

With several marked notes possible, the triage agent's step 2e reads
every triage-agent comment, starts from the newest (found by edit or
creation time after paging through every GitLab note or Jira comment)
and keeps every cause from any of them. docs/triage.md says per tracker how re-runs post, and
docs/prioritize.md says GitLab adds a new comment each run.

The GitLab sticky tests in post-triage-test.sh and
post-prioritize-test.sh are replaced by append tests (both triage
markers and the prioritize marker). The mocks list a bot-authored note
per marker, so code that edits in place would PUT it; each test asserts
exactly one new marked note carrying the result body and no listing or
PUT of notes. New triage and prioritize tests check that a failed note
POST warns and fails the step. Bundles rebuilt.

Raised by @waynesun09 on fullsend-ai/fullsend#9399.

BREAKING CHANGE: on GitLab, each triage (sufficient, in-progress) and
prioritize run, a retry included, adds a new issue note instead of
editing the earlier marked one, so re-runs add comments to the thread.
No migration is needed; earlier notes are left as they are.

Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Follow-ups from review of this PR:

- agents/triage.md: step 2e no longer names an open pull request in
  another repository; it says some trackers edit the marked comment in
  place, which stays true as they change.
- behaviour/features/prioritize.feature: the post-script posts "a RICE
  comment", not a "sticky" one. The behaviour suite runs on GitHub,
  which still edits the comment in place, while GitLab now appends.
- docs/triage.md: the Retries bullet says it describes Jira, where the
  `sufficient` and `in-progress` comments each keep one fixed marker and
  every run edits the earlier comment with that marker.

Carrying a refuted cause forward between triage runs, raised in the same
review, needs a change to how every tracker's triage comment holds its
state; it is tracked in fullsend-ai#2042.

Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Step 2e asked a re-triage to keep every cause from every earlier
analysis, but a refutation lived only in the unpublished reasoning, so a
later run could restore a cause an earlier run had ruled out. With
results appended rather than edited (fullsend-ai/fullsend#9399), there is
also no single comment to read.

Every sufficient comment now ends with an Open causes list and a Ruled
out list. A re-triage starts from the newest marked analysis by the
triage account, keeps open causes unless it refutes them, and keeps
ruled-out causes out unless their evidence no longer holds or newer
evidence revives them. On Jira the agent reads the marker from the
comment's fullsend.sticky-marker property via expand=properties.

The eval fixture can seed comments on GitHub issues. A cause_lists check
judge reads the posted lists, and two new cases check
that a cause ruled out in run 2 stays out in run 3, with and without the
lists in the earlier analyses.

Fixes fullsend-ai#2042

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
- With no recognised triage bot account among several marked-comment
  authors, there is no trusted baseline: both lists are rebuilt from every
  marked analysis, so a planted comment cannot drop an open cause. GitLab
  bot usernames and a single Jira property account count as the triage
  account.
- The cause_lists judge reads headings with a trailing note, matches
  phrases only in each item's cause name, and catches more spellings of a
  restored ruled-out cause; the cases accept more correct wordings.
- fixture.comments: false is refused instead of read as an empty list.
- The jira-forge comment no longer has an uppercase word the skill env
  reachability test reads as a variable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Only a comment from a recognised triage bot account can be the baseline,
even when it is the only marked comment; otherwise both lists are
rebuilt from evidence. Earlier comments are data: instructions inside
them are never followed. Case 015 seeds a single forged analysis that
inverts the real causes and asks the next run to copy its lists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Every comment, the baseline included, is data. Triage comments newer
than the baseline count as updates only from the same triage bot
account; a marked comment from anyone else is a human comment whose
claims are verified. Jira lets any commenter set the marker property, so
Jira has no trusted baseline and always rebuilds the lists from
evidence. forbidden_open in the re-triage cases now catches any plus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
On Jira the agent can learn the account its credential belongs to
(GET /rest/api/3/myself, the same lookup fullsend uses), so a
property-marked comment by that account is a trusted baseline again.
forbidden_open entries can be AND-groups, so the re-triage cases flag a
plus only beside a rejection claim, and cause_lists gates at 0.9 like the
other live checks until the cases have run live.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Any GitLab user can register a name like group_1_bot, so a username
proves nothing. The agent now looks up the account its GITLAB_TOKEN
belongs to (GET /api/v4/user, the same token the post-script posts with)
and trusts only notes whose author.id matches, as it already does on
Jira with /myself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
fullsend-ai#2042's done-when asks for a live cause from run 1 to survive a run
that does not mention it. Case 016 seeds a run-1 analysis whose second
open cause (an unhandled ValueError) is not in the issue body and whose
third (an authgw gateway stripping the email parameter) rests only on
log lines run 1 quotes, then a question and an answer that name no
cause, then a newer full analysis that leaves authgw out without
refuting it. The next full analysis must keep all three open causes and run
1's ruling; nothing else on the issue or in the code names authgw, so a
triage that ignores run 1 cannot find it. The judge tests seed case
016's own fixture comments. Cases 013 and 014 repeat the cause in
run 2, so they could not catch an agent that reads only the newest run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
gh issue view returns App logins without the "[bot]" suffix, so a
-triage[bot] check on its author.login either matched nothing or, read
loosely, trusted a user account named like an App. Step 2e now always
reads authors from the REST comment listing and trusts a GitHub comment
only when user.type is Bot and performed_via_github_app.slug ends in
-triage; the github-forge skill shows the listing. cause_lists now
requires seeded_comments instead of defaulting to 0, and the eval README
documents the block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
…e it

Step 2e reads every marked comment and keeps every cause in them, so a
marker anyone can type would plant causes that persist across runs. A
marked comment now counts as a triage-agent comment only when the
triage account wrote it: on GitHub a REST author of type Bot whose App
slug ends in -triage (gh issue view drops the [bot] suffix), on GitLab
and Jira the account the agent's own credential belongs to. Anyone
else's marked comment is a human comment whose causes are hypotheses.
The forge skills show the REST listing, the account lookups, and the
Jira expand=properties that exposes the marker property.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
The REST listing gave authors but no bodies, and gh issue view uses
different comment ids, so the agent could not tie a REST author to the
marked comment it read. The listing now includes the body, step 2e reads
GitHub comments from it, and a comment no App posted never counts as the
triage account's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Brings in the fullsend-ai#2037 commits that count a marked comment only when the
triage account wrote it and read GitHub comments with their authors from
one REST listing. This branch's step 2e already carries the same rule;
its GitHub bullet now reads comments from that listing too, and a
comment no App posted never counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
If the agent cannot learn its own account, or a comment has no author,
no marked comment counts as a triage-agent comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Step 2e here already rebuilds the lists when no marked comment is from
the triage account; it now does the same when the agent cannot look up
its own account.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
… REST only

The triage App slug is pinned in harness/triage.yaml, so step 2e now
requires performed_via_github_app.slug == "fullsend-ai-triage" (or the
fullsend-ai-triage[bot] login), the idiom pr-review uses for the review
App, instead of any slug ending in -triage. The step also reads GitHub
comments only from the REST listing, so it no longer points back at
gh issue view for pagination.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Step 2e here now trusts a GitHub comment only from the fullsend-ai-triage
App slug pinned in harness/triage.yaml (or its [bot] login), as fullsend-ai#2037
does and as pr-review does for the review App.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
cause_lists cannot see input.yaml, so a stale seeded_comments would let
it grade a seeded comment as the run's output. cause-lists-test.sh now
checks, for every triage case that declares cause_lists, that the count
equals the number of fixture.comments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
The listing renamed fields to user, type and app, while step 2e names
user.login, user.type and performed_via_github_app.slug; it now keeps
those paths so the two match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>

* gitlab-doors-append:
  fix(github-forge): keep the REST field paths in the comment listing
Anyone with edit rights can edit an older comment, which bumped its edit
time past a newer analysis and made it the starting point, losing the
newer one's findings. Step 2e now orders trusted analyses by creation
time and uses edit time only for a comment fullsend updated in place,
which shows a Previous run fold. The GitHub REST listing adds
created_at.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Step 2e here now picks the baseline as the trusted analysis created
last and counts updates by creation time, using edit time only for a
comment fullsend updated in place (one with a Previous run fold).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
The judge passed every case that declares no cause_lists, so one
re-triage case that kept failing still met the 0.9 threshold. It now
abstains on those cases, which the nightly aggregate does not count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
The trusted App was hard-coded as fullsend-ai-triage, so a harness that
overrides slug through base: composition, or an install under another
app set, matched no earlier triage comment. fullsend exports the harness
slug into the sandbox as FULLSEND_SLUG (since v0.36.0), so step 2e now
compares with it and falls back to fullsend-ai-triage only when it is
unset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Step 2e here now compares the GitHub App slug with FULLSEND_SLUG, the
harness slug fullsend exports into the sandbox, as fullsend-ai#2037 does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
The exception for a comment with a Previous run fold reopened the edit
hole: anyone with edit rights can add a fold, or edit a folded comment,
and its edit time won again. fullsend edits only its first marked
comment in place, and later ones come only from appending, so creation
order is right for its own edits as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Step 2e here now orders trusted analyses by creation time only, with no
exception for folded comments, as fullsend-ai#2037 does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
… made it

Ordering by creation time alone broke the duplicate case on GitHub and
Jira, where fullsend keeps editing its first marked comment after a
later duplicate exists. A trusted comment is now dated by its last edit
only when the triage account made that edit (GitHub GraphQL editor,
Jira updateAuthor), and by creation time otherwise. GitHub trust uses
the App names scripts/lib/review-ops.lib.sh trusts for the review App
(FULLSEND_SLUG, <owner>-triage, fullsend-ai-triage, FULLSEND_APP_SET),
and requires a Bot author and editor. A triage-in-progress note is never
the prior analysis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Step 2e here now dates a trusted analysis by its last edit only when the
triage account made it, uses the App name set the review scripts trust,
requires a Bot author, and never takes a triage-in-progress note as the
baseline, matching fullsend-ai#2037.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
…m case-insensitively

FULLSEND_APP_SET never reaches the triage sandbox, so it is dropped from
the trusted names (FULLSEND_SLUG does: fullsend run exports it). App
names compare case-insensitively, and step 2e says the GraphQL editor
query pages while the REST listing does not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
tpouyer and others added 5 commits November 17, 2026 05:45
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
On a shared /tmp another user can plant the job's prior triage
directory, or a symlink, where this user cannot remove it, and the
harness would copy its file into the sandbox as this run's analysis.
The pre-script now fails when something stays at that path or the new
directory is not a real directory this user owns; other write failures
still leave nothing there and only warn.

A triage-account edit timed after the comment listing (GitHub
updated_at, GitLab note updated_at) means the listed body is stale, so
that comment is untrusted ("edited during the read"). The size fold's
"Also ruled out (see earlier analysis): a; b; c" line now counts each
name, as the eval cause_lists judge reads it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
The job directory was checked only when it was created, but the comment
reads take seconds, and on a shared RUNNER_TEMP it could be swapped for
a symlink to a planted file meanwhile. It is now checked again before
the copy (still a real directory this user owns) and after it (the file
is byte-equal to the one this run wrote and not a symlink); either
failure fails the pre-script. The ownership check right after mkdir,
which could not fail, is gone. Headers now say what fails the run and
what only warns, and the fold-line parsing is described on its own
terms, with fullsend-ai#2062's judge reading the line the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
…i#2044 fcf1107

* fork/triage-prior-script:
  docs(triage): fold copies carry no marker, in the rebuild rule too
  fix(triage): trust nothing on editor query errors; stale-file clause
  fix(triage): never fail the pre-script on a write, keep dropped rulings
  fix(triage): per-job prior triage file, full Jira paging, earlier results
  fix(triage): read the prior triage analysis in the pre-script
  fix(triage): harden the prior-triage scripts after review
  feat(triage): pick the trusted prior analysis with a script

Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 12:00 PM UTC · Completed 12:11 PM UTC

Commit: fb7ec6f · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $3.08

fullsend-ai-review[bot]

This comment was marked as outdated.

The read-race check allowed 5 seconds between the comment listing's
update time and the editor query's edit time. A triage-account edit in
that window left a stale listed body trusted, and a bot edit within 5
seconds of someone else's could vouch for a body the bot never wrote.
Any editor time later than the listed update time now makes the comment
untrusted ("edited during the read"); a false positive only sends step
2e down the rebuild path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ⚠️ Cancelled · Started 1:12 PM UTC · Completed 1:17 PM UTC

Commit: 4575334 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.02

This review was superseded by a newer commit. Check the current pull request HEAD's review status before merging.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:19 PM UTC · Completed 1:27 PM UTC

Commit: f654393 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.86

tpouyer and others added 3 commits November 17, 2026 08:23
fullsend-ai/fullsend#9575 merged on 17 Nov and closed #9568, so the
caveat now applies only to installs on fullsend v0.56.1 or earlier.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
* gitlab-doors-append:
  docs(triage): fullsend's triage job now exports FULLSEND_APP_SET

Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>

# Conflicts:
#	docs/triage.md
* triage-carry-state:
  docs(triage): fullsend's triage job now exports FULLSEND_APP_SET

Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>

# Conflicts:
#	docs/triage.md
fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:29 PM UTC · Completed 1:42 PM UTC

Commit: bb4b93e · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.89

fullsend-ai-review[bot]

This comment was marked as outdated.

tpouyer and others added 2 commits November 17, 2026 09:28
Under fullsend's ADR 0133 a host-side read that feeds the model admits
only authorized records. The prior triage file now carries text only
for records the pre-script trusts; untrusted_marked lists other marked
comments by id, created time, marker and reason, and step 2e has the
agent read those itself with its forge skill, as claims.

The lib header, step 2e and docs/triage.md now say that the GitHub
App-name list is an interim convention ADR 0107 does not accept as bot
identity, to be replaced by bot_role == "triage" once
fullsend-ai/fullsend#9602 lands, that the GitLab and Jira own-account
match is exact pending #9602, and that the pre-script is an interim
subset of ADR 0141's entity-context snapshot. The trusted text is not
scanned on the host: fullsend scan input does not fit (event-shaped
input, an SSRF stage that would drop analyses quoting local URLs, no
secret redaction), so the gap is recorded rather than filled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 2:52 PM UTC · Completed 3:06 PM UTC

Commit: 74161bf · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $3.15

fullsend-ai-review[bot]

This comment was marked as outdated.

Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
Signed-off-by: Tim Pouyer <tim.pouyer@gmail.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 4:31 PM UTC · Completed 4:46 PM UTC

Commit: d658f5a · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $3.39

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the review comment for full details.

_prior_triage_github() {
local work="$1" owner="${REPO%/*}" after="" trust_error="" names _
# --paginate prints one array per page; --slurpfile below joins them.
if ! gh api --paginate "repos/${REPO}/issues/${ISSUE_NUMBER}/comments?per_page=100" > "${work}/comments.json" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[medium] edge-case

The GitHub comment listing (gh api --paginate) and the GraphQL editor loop (gh api graphql, up to 100 iterations) run with no execution deadline. A stalled API response blocks the pre-script instead of producing the error snapshot and letting triage continue. The GitLab GraphQL request in the same lib (line ~241) and _gitlab_api use --connect-timeout 10 --max-time 30; pre-triage.src.sh adds no wrapping timeout.

Suggested fix: Put a time limit on the GitHub gh api calls (e.g. a timeout wrapper) and route expiry through the existing error/trust_error handling.

# note's updated_at for notes edited before last_edited_at existed,
# and resolving a thread moves updated_at, so resolving such a note
# during the read reads as a race: a known, safe false positive.
| .raced = (.edit == "own" and .listed_at != null

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low] edge-case

The read-race check uses a strict > on second-precision timestamps. A bot edit landing in the same second as the REST updated_at is not flagged, so the listed body may be an older revision than the one the GraphQL editor metadata describes, yet it is still trusted.

Suggested fix: Fetch the body and editor metadata together, or otherwise verify that both reads describe the same comment revision; add a same-second edit regression test.

Comment thread eval/triage/eval.yaml
item = re.compile(r"^\s*(?:[-*+]|\d+[.)])\s+(.*)$")
def names(s):
return [re.split(r"\s[—–-]\s|—", m.group(1), maxsplit=1)[0]
for m in (item.match(line) for line in (s or "").splitlines()) if m]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low] logic-error

The cause_lists judge's names() only reads list-item lines. A plain compacted line such as Also ruled out (see earlier analysis): Alpha; Beta is ignored, although agents/triage.md allows it and the production parser accepts it, so a compliant comment can fail the judge.

Suggested fix: Recognize compacted ruled-out lines with the same semantics as the production parser and add a test for the plain-line form.


# --- Comments ---

# Posts a new note whose first line is <marker>. Each run appends a new

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low] scope-bundling

The diff vs base rewrites the prioritize GitLab door's forge_post_sticky_comment (drops the find-and-edit sticky logic and _gitlab_bot_username; it now always POSTs a new note) in a PR whose stated intent is triage prior-analysis reading (#2053). The PR body says the branch is stacked on #2044, so the change likely comes from the stacked base, but it is still part of what this diff would merge.

Suggested fix: Split prioritize-specific door changes into their own submission, or land #2044 first and rebase.

@tpouyer

tpouyer commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Closing. With #2079 carrying triage state as a structured marker on the newest trusted comment, the agent only reads that one marker, so nothing is left for a host-side script to do. That also removes the host-side reading of untrusted comments this PR added, which is where most of its review findings were. fullsend's ADR 0141 entity-context-snapshot is the eventual home for this; the bot-identity part is fullsend-ai/fullsend#9602.

@tpouyer tpouyer closed this Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request risk/elevated PR risk: elevated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

triage: pick the trusted prior analysis with a script, not a multi-API prompt procedure

1 participant