pi-mono/scripts/issues
Mario Zechner eba8497395 feat(durable): nested tool calls, structured output, callers; storage errors end the Session
Nested tool calls: ToolExecutionApi.executeTool() runs another tool as its own pi.tool task owned by the caller,
keyed for replay-safe reattachment. Results for programs live in the caller's NestedResultDoc until it settles;
pi.live.nestedTools shows each call with the arguments it runs with and a summary. TaskOptions.abandonOnRestart
aborts work its creator awaited only in memory before it runs again after a restart.

Structured output: structuredOutputSchema and structuredOutput, validated; a tool without a schema gives programs its
bounded output (one text as a string, one image as itself, else the list). ToolExecutionResult.content is now output.
callers and modelTools decide who may call a tool.

Storage errors: any error a Storage method throws fails the Session, which closes itself; later calls and waits reject
with SessionFailed, watches end with session_failed, and Session.closed settles. Nothing retries in the Harness.
StorageRejected is removed; StorageRequestError marks invalid reads that fail only their call. Listener and onReport
errors are contained and reported.

Also updates scripts/issues/triage.ts and the vacation experiment for the content -> output rename.
2026-10-09 17:13:34 +00:00
..
categories feat: add local issue triage tool in scripts/issues 2026-10-09 17:12:26 +00:00
.gitignore feat: add local issue triage tool in scripts/issues 2026-10-09 17:12:26 +00:00
github.ts feat: add local issue triage tool in scripts/issues 2026-10-09 17:12:26 +00:00
main.ts feat: add local issue triage tool in scripts/issues 2026-10-09 17:12:26 +00:00
prompt.md feat: add local issue triage tool in scripts/issues 2026-10-09 17:12:26 +00:00
README.md feat: add local issue triage tool in scripts/issues 2026-10-09 17:12:26 +00:00
register.mjs feat: add local issue triage tool in scripts/issues 2026-10-09 17:12:26 +00:00
run.sh feat: add local issue triage tool in scripts/issues 2026-10-09 17:12:26 +00:00
source-hooks.mjs feat: add local issue triage tool in scripts/issues 2026-10-09 17:12:26 +00:00
triage.ts feat(durable): nested tool calls, structured output, callers; storage errors end the Session 2026-10-09 17:13:34 +00:00
ui.html feat: add local issue triage tool in scripts/issues 2026-10-09 17:12:26 +00:00

Issue triage

A local tool for the daily issue review. It runs in this order:

  1. Sync. Keeps a local copy of the repository's issues in data/corpus.json with gh api. The first run fetches the last 120 days; after that it syncs every 20 minutes and only fetches what changed.
  2. Triage. Each new issue gets its own conversation with a pi-durable agent. The agent:
    • searches the local copy for duplicates and related issues (search_issues, read_issue)
    • picks a category from categories/*.md
    • writes a one-sentence summary and signals
    • suggests p0, p1, or none
  3. Review. A web UI lists the inbox: every issue created since the inbox start, grouped by the agent's suggestion. You set p0, p1, or none, and fix the category if needed. Each issue links to GitHub.

Decisions are stored locally only. Nothing is written to GitHub yet.

All state lives in data/ (gitignored):

  • corpus.json: the local copy of the issues
  • triage.sqlite: pi-durable storage with one conversation per triaged issue, the triage results, and your decisions in the triage.state document
  • token: the UI access token

Restarting the server resumes any triage runs that were in flight.

Files

  • categories/*.md: one file per category. The file name is the category label. The frontmatter owner is the GitHub user who owns the category.
  • prompt.md: the triage procedure and priority guidance given to the agent.
  • main.ts: sync loop and HTTP server.
  • triage.ts: the durable triage agent.
  • github.ts: the local copy of the issues and keyword search.
  • ui.html: the web UI.
  • source-hooks.mjs, register.mjs: run workspace packages from source, so no build is needed.

Run

./scripts/issues/run.sh   # http://127.0.0.1:7788

Open http://127.0.0.1:7788/?t=<token> once, with the token from scripts/issues/data/token. The server then sets a cookie, so later visits don't need the token.

The agent authenticates through ~/.pi/agent/auth.json, the same credentials pi uses.

Variable Default
TRIAGE_MODEL openai-codex/gpt-5.6-sol provider/model. Supported providers: openai-codex, anthropic.
TRIAGE_THINKING medium Thinking level
TRIAGE_CONCURRENCY 4 Parallel triage runs
TRIAGE_INBOX_DAYS 2 On the first run, the inbox starts this many days back
TRIAGE_CORPUS_DAYS 120 On the first run, fetch issues updated in this many days
TRIAGE_SYNC_MINUTES 20 Sync interval
TRIAGE_PORT 7788 Local port
TRIAGE_SOCKET Listen on this unix socket instead of the port, for a reverse proxy
TRIAGE_DATA scripts/issues/data State directory

UI keys

  • j/k: move between issues
  • 0, 1, n: set p0, p1, none
  • o: open the issue on GitHub