the PRs created by threadide are missing useful PR descriptions

merged…
nlaz48d ago

PRs should discuss what the PR is doing, does it accomplish its intent, how did it approach the task, and should include ASCII diagrams to help a reviewer visualize and contextualize the PR. It should optimize for human-review attention and reviewability.

3 repliesoldestnewest
Osebotopus-5-548d ago

Right now lib/agent/finish.ts writes a hardcoded two-line body when it opens a PR ("Opened by Thread IDE… link"). Here's the plan:

  1. The agent writes the PR body itself. It's the only part of the system that knows what changed and why. I'll add a new runner tool pr_description({repo, body}) in lib/agent/runner.mjs and add a system-prompt section in lib/context.ts that says what goes in the body: summary, whether the intent was met, approach, ASCII diagram, review guide, risks and testing.
  2. finish.ts uses that body when it opens the PR. If a PR already exists for the branch (a later run on the same thread), it PATCHes the PR body, so the description doesn't go stale.
  3. Fallback when the agent skips the tool: build a structured body from the thread instead: the task, Claude's final done/diff post, commits, and the compare link. Either way the thread link goes in the footer.
osebo48d ago

@niko I’m surprised you’re using opus lol

Osebotopus-5-548d agothreadide@f45581e

Claude now writes each PR's description itself. If it skips that step, the PR gets a structured description built from the thread instead of the old two-line stub. Typecheck passes and the runner file parses. I rendered the fallback description once with a script and it looks right. I haven't done a real run end to end, so the new tool hasn't been exercised yet.

How it works

Claude, in the sandbox                    server, when the run ends
──────────────────────                    ─────────────────────────
pr_description({repo, body}) ─┐
  (new tool, lib/agent/runner.mjs;
   kept in memory until the run ends)
                              ▼
          POST /finish { commits, prDescriptions }
                              │
                              ▼
               finish.ts openPullRequests()
                              │  for each repo with commits
                              ▼
               pr-body.ts buildPrBody()
               ├─ Claude wrote one?  use it
               └─ no?  fallback: task + Claude's last done/diff post
                       + files touched + compare/commit links
                       (+ thread link on both)
                              │
                              ▼
               github.ts ensurePullRequest()
               ├─ no open PR       → open one with this body
               └─ PR already open  → replace the body, only if Claude
                                     wrote a new one this run

What Claude is told to put in a PR description (new section in lib/context.ts):

  • Summary: what the PR does and why.
  • Intent check: what was asked, and whether the PR fully does it. Anything partial or deferred has to be stated.
  • Approach: key decisions, and the alternatives it rejected.
  • Diagram: at least one ASCII diagram (data flow, before → after, module boundaries, state machine or UI sketch), labelled with real file and function names.
  • Review guide: which files to read in what order, where the risky logic is, and what can be skimmed.
  • Risk & testing: what was verified, what couldn't be, and any migrations, env or config the deploy needs.
  • For changes across several repos, each PR explains how it fits with the others.

Decisions you might want to change

  • A later run only rewrites a PR's description if Claude writes a new one. The fallback never overwrites an open PR's description, so edits people made on GitHub are safe from that. A new description from Claude does replace the whole body, including any GitHub edits.
  • The fallback has no diagram. I tried an auto-drawn "branch → main" box and dropped it as noise. The fallback says plainly that it was assembled from the thread.
  • Descriptions are capped at 60k characters, under GitHub's 65,536 limit.

Files changed: lib/agent/runner.mjs, lib/agent/pr-body.ts (new), lib/agent/finish.ts, lib/agent/github.ts, the /finish route schema, lib/context.ts, components/agent-activity.tsx (label "Writing PR description"), plus the README and architecture notes.

This run started on the old runner, so this thread's own PR will still get the old two-line description. The new behaviour starts with the first run after this is merged and deployed.