Skip to content

refactor: share active run state precedence - #157168

Merged
steipete merged 1 commit into
mainfrom
fix/agent-run-registry-state-projection-20260924
Sep 24, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/agent-run-registry-state-projection-20260924

Conversation

@steipete

@steipete steipete commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The agent run registry exceeds the existing lint size limit, blocking repository checks.

User Impact

No user-visible behavior change. Running work still takes precedence over queued work, which takes precedence over capacity waits.

Why This Change Was Made

The projection builder and registry resolver separately implemented the same precedence rule. Both now use the existing projection owner’s shared merge operation. This brings the registry from 704 to 699 counted lines without changing its 700-line limit, lifecycle ownership, or version tracking.

Evidence

The exact failing lint check passes after the change. All 108 existing tests across seven affected files, core types, and fresh independent P0–P2 review pass. No new tests, dependencies, suppressions, or budget changes.

Exact-head CI passed at 34e5fc19a6fc51d9fd491fc4e81af39a07d31358. ClawSweeper completed that revision with no findings, and final native preparation with OPENCLAW_TESTBOX=1 passed.

Related: #157161.

Use the projection owner to merge running, queued and capacity-wait states for both index construction and session resolution. This removes duplicate precedence rules and brings the registry below the unchanged line limit while preserving lifecycle, authority and version handling.
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete steipete self-assigned this Sep 24, 2026
@steipete
steipete marked this pull request as ready for review September 24, 2026 09:17
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 6:00 AM ET / 10:00 UTC (Revision 2).

ClawSweeper review

What this changes

The branch gives active run indexing and session progress resolution one shared priority rule: running, then queued, then waiting for capacity.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still exceeds the registry’s lint limit. The reviewed head passes CI, and the source review found no actionable defect.

Priority: P3
Reviewed head: 34e5fc19a6fc51d9fd491fc4e81af39a07d31358

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A small, coherent repair has supporting tests and passing exact-head CI, with no actionable source-review finding.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This member-authored internal refactor is exempt from contributor real-behavior proof. Exact-head CI supports the lint outcome, existing Gateway tests cover status transitions, and the diff changes no stored-data contract.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored internal refactor is exempt from contributor real-behavior proof. Exact-head CI supports the lint outcome, existing Gateway tests cover status transitions, and the diff changes no stored-data contract.
Evidence reviewed 8 items Introduced change: The pinned merge-base-to-head diff adds the shared state-priority operation and uses it in both index construction and session progress resolution.
Current main remains unfixed: Current main retains the separate running, queued, and capacity-wait checks in session progress resolution.
Lint contract: The production TypeScript max-lines rule is 700 counted lines, skipping blank lines and comments; the PR reports the registry falling from 704 to 699 counted lines.
Findings None None.
Security None None.

How this fits together

The process-local agent run registry tracks live work and builds session status indexes. Gateway session and task views use those indexes to report whether work is running, queued, or waiting for capacity.

flowchart LR
A[Live run contexts] --> B[Shared status priority]
B --> C[Projection index]
C --> D[Session status lookup]
B --> D
D --> E[Gateway and task views]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +7. Total +7 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 15 8 +7
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 15 8 +7

Review metrics

Metric Value Why it matters
Registry lint count 704 to 699 counted lines; limit 700 The PR reports clearing the unchanged lint limit, and exact-head CI passed.

Technical review

Best possible solution:

Keep one projection-owned status priority rule while preserving existing run lifecycle and index invalidation behavior.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main retains the oversized registry and the 700-counted-line lint rule; the PR reports 704 counted lines before the change. This read-only review did not execute lint.

Is this the best way to solve the issue?

Yes. Sharing the existing projection owner’s priority rule is a narrow repair, and the three states retain their previous ordering.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 20590155d1bf.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is a focused internal lint repair with no claimed user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored internal refactor is exempt from contributor real-behavior proof. Exact-head CI supports the lint outcome, existing Gateway tests cover status transitions, and the diff changes no stored-data contract.

Evidence

What I checked:

  • Introduced change: The pinned merge-base-to-head diff adds the shared state-priority operation and uses it in both index construction and session progress resolution. (src/infra/agent-run-projection.ts:31, 34e5fc19a6fc)
  • Current main remains unfixed: Current main retains the separate running, queued, and capacity-wait checks in session progress resolution. (src/infra/agent-run-registry.ts:631, 20590155d1bf)
  • Lint contract: The production TypeScript max-lines rule is 700 counted lines, skipping blank lines and comments; the PR reports the registry falling from 704 to 699 counted lines. (.oxlintrc.json:328, 20590155d1bf)
  • Existing behavior coverage: Gateway projection tests exercise queued-to-running transitions and replacement after a stale queue release. (src/gateway/session-row-projection-context.test.ts:116, 34e5fc19a6fc)
  • Merge-result ownership: The verified test merge against its pinned main parent changes only the two introduced projection and registry files. (a933f53e550d)
  • Review and check context: The captured exact-head CI gate succeeded; the prior ClawSweeper review of the same SHA retained no findings or rank-up moves. (34e5fc19a6fc)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-24T09:26:01.538Z sha 34e5fc1 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 24, 2026
@steipete
steipete merged commit 92635da into main Sep 24, 2026
282 checks passed
@steipete
steipete deleted the fix/agent-run-registry-state-projection-20260924 branch September 24, 2026 10:08
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
Use the projection owner to merge running, queued and capacity-wait states for both index construction and session resolution. This removes duplicate precedence rules and brings the registry below the unchanged line limit while preserving lifecycle, authority and version handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant