Skip to content

Feat/multi model sqlite state - #13

Open
zelvinator wants to merge 10 commits into
mainfrom
feat/multi-model-sqlite-state
Open

Feat/multi model sqlite state#13
zelvinator wants to merge 10 commits into
mainfrom
feat/multi-model-sqlite-state

Conversation

@zelvinator

Copy link
Copy Markdown
Owner

No description provided.

zelvinator and others added 2 commits July 24, 2026 01:32
The previous 1500-character truncation was too aggressive and could
lose important context from issue/PR descriptions (which have a
65,536 character limit). Increasing to 5000 chars provides a much
better preview while still keeping the payload manageable.

Closes #10
Redesign from single-model cron to two-model pipeline:

- Qwen 3.6 worker (every 5 min): discovery, triage, simple fixes,
  implementation from GLM plans, file-level review, stale reset
- GLM 5.2 planner (every 15 min): architectural planning, complex
  review, takeover after 2 failed Qwen attempts

Replaces flat-file tracker (.zelvinator-processed.txt) with SQLite
state database at ~/.hermes/zelvinator-bot/state.db — outside git
working directory, immune to git stash/checkout/reset.

Key improvements:
- Claim-on-complete instead of claim-on-discover: items stay in
  their current state if cron session dies, get retried next cycle
- Validated state transitions with 10-state machine
- Attempt tracking with auto-increment on implementation cycles
- Stale detection (implementing >20 min → reset to planned)
- Structured JSON plan format as GLM→Qwen contract
- New CLI commands: queue, state, plan, stale, stats, reset

Tested: 18/18 state machine tests pass, end-to-end find discovers
23 real items from GitHub API with correct dedup on re-run.
Comment thread README.md
plan TEXT, -- JSON plan from GLM
review_feedback TEXT, -- GLM's review notes
pr_url TEXT,
attempts INTEGER DEFAULT 0,

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@zelvinator Could there be guard against it going to negative?

Super User and others added 8 commits July 28, 2026 01:19
Items that GLM planned must always go through GLM review (needs_review),
not be self-approved by Qwen. Updated Phase 3 review triage to distinguish
between direct items (Qwen can self-approve) and planned items (must
escalate to GLM).
Comment triggers requesting a code review ('review', 'code review',
'review this') now go to needs_review for GLM instead of being
handled directly by Qwen. Only quick questions/actions stay with Qwen.
Qwen does a fast first-pass review (bugs, tests, style) and posts findings
as a comment, then escalates to GLM. GLM reads Qwen's review and amends
it with architectural analysis instead of starting from scratch.

Applies to both code review requests (comment triggers) and planned item
implementations.
Add /command parsing to trigger comments. Commands replace natural
language triage with deterministic dispatch:

  /review        — Qwen fast review + GLM amend
  /quick-review  — Qwen only
  /fix           — apply review fixes, GLM reviews
  /quick-fix     — apply fixes, self-approve
  /plan          — GLM plans only
  /implement     — Qwen implements, GLM reviews
  /quick-implement — Qwen implements, self-approve
  /status        — report pipeline state
  (empty)        — conversational reply
  (unknown)      — show /help

Bot can self-trigger: GLM posts @zelvinator /fix after review, Qwen
posts @zelvinator /review after implementing. zelvinator user added
to whitelist for slash commands only (not natural language).

Go changes:
- command column added to SQLite schema (with migration for existing DBs)
- ParseCommand/IsKnownCommand/IsQuickCommand in state package
- find.go: zelvinator user can trigger via slash commands only
- Unit tests for command parsing
…hedule

- /help: Go binary posts cheatsheet directly, no LLM invocation needed
- Worker model: qwen36-coding (temp 0.6, better for code work)
- Worker schedule: every minute (most cycles are SILENT)
All implementation paths (body/assignment, /implement, /quick-implement,
Phase 2 planned items) now comment on the original issue with the PR link
and summary before transitioning state.
All implementation paths now post @zelvinator /review on the PR after
opening it. Next cycle Qwen discovers the self-trigger, does fast
first-pass review, escalates to GLM for architectural amend.

Flow: implement → post PR link → post @zelvinator /review →
next cycle: Qwen fast review → GLM amends → done (or /fix loop)

/quick-* variants skip the self-trigger (self-approve, no review).
find only returns NEW items. Items discovered in a previous run that
weren't processed (e.g. session timed out) sat in discovered state
forever. Now Phase 1 also runs queue --state=discovered to pick up
all unprocessed items.
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