Skip to content

refactor(agent): derive recovery state from record queries - #7784

Open
christianklotz wants to merge 9 commits into
mainfrom
refactor/agent-recovery-record-queries
Open

refactor(agent): derive recovery state from record queries#7784
christianklotz wants to merge 9 commits into
mainfrom
refactor/agent-recovery-record-queries

Conversation

@christianklotz

@christianklotz christianklotz commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • remove recovery-specific query APIs, e.g. findOpenOperations(), and derive recovery state through bounded findRecords() calls
  • retain write-side open-operation enforcement and reject invalid replay transitions
  • remove SQLite operation-kind query paths and indexes
  • constrain EntryQuery.customType to custom entries and align the harness design

Testing

  • npm run check
  • agent session tests: 100 passed
  • SQLite conformance and migration tests: 30 passed
  • ./test.sh: 15 unrelated coding-agent failures from the missing TuiMainScreen export, plus one footer watcher timeout

@christianklotz
christianklotz requested a review from vegarsti August 7, 2026 14:39
@christianklotz
christianklotz marked this pull request as ready for review August 7, 2026 15:24
@christianklotz
christianklotz marked this pull request as draft August 7, 2026 15:31
Comment thread packages/agent/docs/harness-v2.md Outdated
@christianklotz
christianklotz marked this pull request as ready for review August 7, 2026 15:42
Comment thread packages/agent/docs/harness-v2.md Outdated
Comment thread packages/agent/docs/harness-v2.md Outdated
Comment thread packages/agent/docs/harness-v2.md Outdated
Comment thread packages/agent/docs/harness-v2.md Outdated
Reduction may additionally perform point lookups for provisioned entry ids and bounded branch lookups for effective model, thinking, and active-tool configuration at the operation anchor. These are indexed lookups, not extra history scans. Every scan is bounded by the open operation or the still-relevant idle queue, not by total session history or another lane's activity.
**Potential lookup-efficiency gap:** finding the latest run is linear in the number of consecutive non-run operation starts after it. Geometric limits return fewer than twice that many starts, and normal histories have only a few intervening compaction or navigation operations. The worst case remains a lane with many non-run operations and no recent run; backends may optimize that case internally if measurements justify it.

Reduction may additionally perform point lookups for provisioned entry ids and bounded branch lookups for effective model, thinking, and active-tool configuration at the operation anchor. After discovery identifies the recovery boundary, these reads are bounded by the open operation or the still-relevant idle queue, not by another lane's activity.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this is no longer needed, as config (model, thinking level, active tools) have moved into lanes. reduction is literally only entry id look ups now. will push new harness-v2.md in a bit, so you can review.

Comment thread packages/agent/docs/harness-v2.md
Comment thread packages/agent/docs/harness-v2.md
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.

3 participants