Skip to content

Quota fallback of a writer inherits the first worker's worktree state; agent-run inspect - #8

Merged
tomastaker merged 2 commits into
mainfrom
fix/fallback-worktree
Sep 1, 2026
Merged

Quota fallback of a writer inherits the first worker's worktree state; agent-run inspect#8
tomastaker merged 2 commits into
mainfrom
fix/fallback-worktree

Conversation

@tomastaker

Copy link
Copy Markdown
Owner

Stacked on #7.

Problem

On a usage limit agent-run reran the same brief on the other family in the same worktree. A limit that hits mid-write leaves commits and uncommitted edits behind, and the second worker started blind — redoing or breaking finished work. --effort ultra (Codex only) also failed validation when the rerun landed on Claude.

Change

  • The fallback rerun of a writer gets a PREVIOUS ATTEMPT note at the top of the brief: commits since base (delegate-kit.base written by agent-wt create) and uncommitted files, with the instruction to read and continue rather than restart. ultra maps to xhigh on Claude.
  • agent-run inspect [<worktree>] prints the same snapshot (base, commits, dirty, partial, note) — the command behind the long-standing "read the worktree before rerunning" advice in external.md.
  • tests/inspect.sh: 12 checks (clean worktree, commit + dirty file, missing base, non-git dir). CI step added.

Checks

inspect.sh 12/12, gate.sh 24/24, route.sh 48/48, caps.sh 43/43, delivery.sh 25/25, node --check.

Not verified

The fallback path itself needs a real quota error from a CLI; the note builder it calls is what inspect exercises.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 542fc5df-3687-4e40-9c3a-e2c5260f1252

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T22:13:08.204037Z a8c11a8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a8c11a8f00

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread skills/delegate-kit/scripts/agent-run Outdated
if (!g) return { cwd, git: false, base: null, commits: [], dirty: [], partial: false, note: null };
let base = null; try { base = fs.readFileSync(path.join(g, "delegate-kit.base"), "utf8").trim() || null; } catch {}
const commits = base ? (sh("git", ["log", "--format=%h%x09%s", `${base}..HEAD`], { cwd }).stdout || "").split("\n").filter(Boolean).map((l) => { const [sha, ...rest] = l.split("\t"); return { sha, subject: rest.join("\t") }; }) : [];
const dirty = (sh("git", ["status", "--porcelain"], { cwd }).stdout || "").split("\n").filter(Boolean).map((l) => ({ status: l.slice(0, 2).trim(), path: l.slice(3) }));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enumerate files inside untracked directories

When the interrupted writer creates files beneath a new directory, this default porcelain invocation collapses them into one entry such as ?? src/new/, so dirty, the reported file count, and the fallback note omit every actual file. I confirmed this behavior locally; git status -h documents the --untracked-files=all mode, which reports each nested file individually. This matters because the note directs the fallback worker to inspect git diff, which also omits untracked contents, allowing substantial partial work to remain effectively invisible; request all untracked files when building the snapshot.

Useful? React with 👍 / 👎.

…а inspect

Quota fallback перезапускал тот же бриф в том же worktree вслепую, хотя лимит
мог сработать после коммитов и правок первого воркера. Теперь перезапуск
писателя получает в начале брифа PREVIOUS ATTEMPT: коммиты после базы
(delegate-kit.base от agent-wt create) и незакоммиченные файлы — с указанием
прочитать и продолжить, а не переделывать. `ultra` при переезде на Claude
становится xhigh вместо отказа валидации.

`agent-run inspect <worktree>` печатает тот же снимок — команда под давнее
«read the worktree before rerunning» из документации. tests/inspect.sh — 12
проверок, шаг в CI.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
По ревью PR #8 (Codex P2): --porcelain без --untracked-files=all давал одну
запись «?? dir/», и заметка fallback-воркеру скрывала всю работу в новом
каталоге.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@tomastaker
tomastaker changed the base branch from fix/gate-depth to main September 1, 2026 22:29
@tomastaker
tomastaker merged commit 4540a63 into main Sep 1, 2026
5 checks passed
@tomastaker
tomastaker deleted the fix/fallback-worktree branch September 1, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant