Skip to content

History search takes a bot pattern to search every agent - #373

Merged
lydakis merged 2 commits into
mainfrom
claude/project-thread-ys30cm
Oct 29, 2026
Merged

lydakis merged 2 commits into
mainfrom
claude/project-thread-ys30cm

Conversation

@lydakis

@lydakis lydakis commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

What

The history tool's search (query) can now take a GLOB as bot (*, proj.*, [ab]) to search every agent the pattern matches at once. Bot names can't contain *, ? or [, so a pattern is never mistaken for a name. This is the first of the two Delta-inspired pieces George picked; the second, forking a task with its files, follows in another PR.

  • Matches come back newest first across all the matched bots. Each one also carries its bot and its turn handle (turn:BOT/ID), so the agent can read that turn with history.
  • The bots' walks are merged by node ID. A node can't be newer than any of its descendants, so a node shared by several histories (a fork shares its source's) shows up in each of those walks at the same moment. It is searched once and credited to the oldest bot that has it. A node only one walk reaches (a later fork's own suffix) is credited to that bot, so the handle always reads the match.
  • Each search stops at the same limits as a single-bot search: 20 matches or 64 MiB scanned. next_before marks where the merge stopped, and passing it back as before continues from there.
  • The turn the search runs in is left out, as before.

There's no new op, table, CLI verb or migration. The single-bot path is untouched.

Daemon cost

This runs on a storage thread through store.read, never on the runtime thread, and never on a turn's path, since it's a tool call. Each walk is a SQL cursor that reads only node IDs and sizes. Memory is one cursor per matched bot plus at most 20 matches, and stays flat however long the histories are. There are no store writes. A continuation walks down from each head to before, the same way the single-bot search does.

Tests

  • history_search_of_a_pattern_searches_every_bot_it_matches_newest_first checks the order across bots, that a fork's shared turn is listed once under its source, that bots outside the pattern are left out, that the running turn is skipped, and the empty-pattern and empty-query cases.
  • history_search_of_a_pattern_credits_a_fork_with_what_only_it_has covers Codex's case: two forks cut the same turn at different points, and the source is outside the pattern.
  • history_search_of_a_pattern_goes_on_from_where_it_had_enough checks the 20-match stop and continuing with next_before.
  • cargo test -p agent-runtime passes locally, and clippy and fmt are clean.

🤖 Generated with Claude Code

A history call with query may now name bot as a GLOB (* ? [...]; no name
holds those): it walks each matching bot's lineage, meeting a node an
earlier walk has as the rest of a shared history, so a fork's prefix is
searched once under the older bot, and lists matches newest turn ID first
with each one's bot and turn handle. before and next_before are turn IDs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGFna3t1d4P7QjNa2CQ
@lydakis lydakis self-assigned this Oct 29, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 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-10-29T23:14:55.865970Z f56d74c New commits
🔒 Security Review ✅ Completed 2026-10-29T23:16:09.268122Z f56d74c New commits
ℹ️ 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: 4064689dd5

ℹ️ 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 src/store/db.rs Resolved
Comment thread src/store/db.rs Resolved
Collecting every matched bot's whole lineage before searching held memory
that grew with the store, and a fork's own nodes past an older fork's cut
were credited to the older fork, whose handle cannot read them. The walks
now run as cursors merged by node ID: a shared node comes up in each walk
that has it and is searched once, under the oldest such bot; a node only
one walk has is that bot's. Only each walk's place and the matches are
kept, the search stops at its match and byte bounds, and next_before is
the node the merge stopped at.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGFna3t1d4P7QjNa2CQ
@lydakis
lydakis merged commit 20701b1 into main Oct 29, 2026
5 checks passed
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.

2 participants