Skip to content

fix(tlon): bound pending approval queue - #160679

Merged
eleqtrizit merged 1 commit into
openclaw:mainfrom
eleqtrizit:1077
Sep 29, 2026
Merged

eleqtrizit merged 1 commit into
openclaw:mainfrom
eleqtrizit:1077

Conversation

@eleqtrizit

@eleqtrizit eleqtrizit commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Tlon pending approval records could grow without a bound because every unique request appended durable state and rewrote the full queue. This change caps new admissions at 100 while preserving every pre-upgrade pending decision, notifying the owner with bounded delivery retries when saturated, and keeping rejected invite snapshots retryable; no related implementation PR overlaps this queue boundary.

What Problem This Solves

  1. extensions/tlon/src/monitor/approval-runtime.ts appended every new unique approval and rewrote the complete persisted array for each append.
  2. Existing deployments can already have more than 100 pending approvals, and bare owner replies target the newest record, so an upgrade must not reorder or discard that durable authorization context.
  3. Silent rejection at capacity left owners unaware and caused DM/group invite snapshots to be acknowledged even though no approval was queued.

The net effect was unbounded durable state and increasing serialization work under sustained unique approval traffic.

Why this design

  • Enforce one shared admission limit at the queue owner so all approval-producing paths receive the same protection.
  • Check capacity after duplicate matching so existing pending decisions can still refresh normally.
  • Preserve every valid legacy approval so bare and ID-specific replies keep targeting the same requester after upgrade.
  • Retry a failed owner-visible saturation notice at most three times per full-queue episode, stop after delivery succeeds, and reset that episode after capacity admits a new request.
  • Maintainer decision (@eleqtrizit): accept bounded rejection for new unique requests above 100 pending entries and the three-attempt notice limit while preserving every legacy/existing approval; rejected requesters retry after capacity is available.
  • Mark DM/group invite snapshots processed only when admission succeeds, without adding a config surface or changing authorization defaults.

Evidence

Path Mode Outcome
Registered monitor upgrade Load 101 pending DM approvals, then receive bare owner approve The 101st/newest requester is allowlisted; the 100th is not, and the other 100 records remain persisted
Registered monitor saturation Deliver the same DM invite twice at 100 pending entries No approval write occurs, the invite retries twice, and the owner receives one actionable saturation notice
Runtime enqueue Submit two new unique requests at 100 pending entries Both are rejected, the queue is unchanged, and one successfully delivered owner notification is sent
Runtime notice failure Submit four new unique requests at 100 pending entries while owner delivery fails All are rejected, the queue is unchanged, and notification delivery stops after three failed attempts
Runtime duplicate 100 pending entries plus an update for an existing request Existing entry updates and normal persistence/notification behavior remains
Persisted settings 101 valid stored approvals All 101 valid records are preserved across load

The sink-level assertions observe final allowlist writes, remaining persisted approvals, queue contents, owner notifications, retry attempts, and parsed settings output.

Testing

  • Added registered-monitor tests for upgrade-safe bare approval and owner-visible, retryable saturation.
  • Added focused runtime tests for unique overflow, successful notification suppression, bounded failed-delivery retries, and duplicate updates at capacity.
  • Added settings/tracker regressions for preserving oversized state and conditional invite acknowledgment.
  • Passed 30 monitor tests, 4 tracker tests, and 5 queue/settings tests.
  • Measured with pnpm test <file> --maxWorkers=1: approval-runtime.test.ts 8.65s wall, index.test.ts 19.79s, tracking.test.ts 9.42s, and settings.test.ts 1.98s. In exact-head CI run 36485214183, index.test.ts used a 76.64s Vitest shard and the other three files shared a 33.47s Vitest shard.
  • Passed pnpm tsgo and all changed-files extension/docs gates, including production/test types, lint, dead-export scans, and import-cycle checks.
  • Passed branch autoreview with no actionable findings at 0.95 confidence.

@clawsweeper

clawsweeper Bot commented Sep 28, 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.

@openclaw-barnacle openclaw-barnacle Bot added channel: tlon Channel integration: tlon size: S labels Sep 28, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 5:46 PM ET / 21:46 UTC (Revision 4).

ClawSweeper review

What this changes

The Tlon plugin caps new pending owner approvals at 100, notifies the owner when full, preserves older approvals, and leaves rejected invite snapshots eligible for another attempt.

Merge readiness

✅ Ready for maintainer review

Current main still admits an unlimited number of distinct Tlon approval requests. This PR remains useful, and the current head addresses both findings from the previous review. The documented rejection and notice limits are an explicitly stated tradeoff by the author, whose repository maintain permission was verified.

Priority: P2
Reviewed head: 66451c5e816ea62c18ee000eb9eadab16133b3cf

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused patch and boundary tests address the earlier findings and preserve oversized legacy queues.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies the author as MEMBER, so contributor real-setup proof is exempt. Registered-monitor tests exercise legacy approval selection and saturation through mocked Urbit I/O; the stored JSON format is unchanged, and the 101-record upgrade case supports existing-state compatibility.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies the author as MEMBER, so contributor real-setup proof is exempt. Registered-monitor tests exercise legacy approval selection and saturation through mocked Urbit I/O; the stored JSON format is unchanged, and the 101-record upgrade case supports existing-state compatibility.
Evidence reviewed 6 items Current-main necessity: Current main appends each distinct approval and persists the resulting array without an admission limit.
Introduced admission boundary: The pinned PR checks for an existing request before rejecting a new distinct request when the queue has at least 100 entries.
Upgrade compatibility: The stored approval format is unchanged. The added registered-monitor test loads 101 approvals and checks that a bare owner approval acts on the newest request while retaining the other 100.
Findings None None.
Security None None.

How this fits together

The Tlon monitor receives Urbit messages and invites that may need owner approval. It stores pending requests in Urbit settings; an owner reply can then allow a sender or join a group.

flowchart LR
 A[Urbit messages and invites] --> B[Tlon monitor]
 B --> C{Approval needed?}
 C -->|Yes| D{Queue has room?}
 D -->|Yes| E[Pending approvals in settings]
 D -->|No| F[Owner saturation notice]
 E --> G[Owner reply]
 G --> H[Allow sender or join group]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +27, Tests +240, Docs +9. Total +276 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 4 38 11 +27
Tests 4 241 1 +240
Docs 1 9 0 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 288 12 +276

Review metrics

Metric Value Why it matters
Production and test growth production +27, tests +240 net lines The production growth implements the admission and notice policy; tests cover capacity, upgrade behavior, and retry handling.

Technical review

Best possible solution:

Ship the documented bounded admission policy while retaining existing owner decisions and a clear retry path for rejected requests.

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

Yes from source: current main appends each distinct approval without a count check. This read-only review did not execute a live Urbit setup.

Is this the best way to solve the issue?

Yes. Admission is limited at the shared Tlon queue owner, while existing records and duplicate updates remain available.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Bounding an unbounded plugin approval queue is a focused reliability improvement with limited blast radius.
  • merge-risk: 🚨 compatibility: The accepted 100-entry limit changes what existing installations can admit when their queue is full.
  • merge-risk: 🚨 message-delivery: The accepted policy requires rejected message requesters to retry after capacity becomes available.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies the author as MEMBER, so contributor real-setup proof is exempt. Registered-monitor tests exercise legacy approval selection and saturation through mocked Urbit I/O; the stored JSON format is unchanged, and the 101-record upgrade case supports existing-state compatibility.

Evidence

What I checked:

  • Current-main necessity: Current main appends each distinct approval and persists the resulting array without an admission limit. (extensions/tlon/src/monitor/approval-runtime.ts:202, dba4c4f0e152)
  • Introduced admission boundary: The pinned PR checks for an existing request before rejecting a new distinct request when the queue has at least 100 entries. (extensions/tlon/src/monitor/approval-runtime.ts:212, 66451c5e816e)
  • Upgrade compatibility: The stored approval format is unchanged. The added registered-monitor test loads 101 approvals and checks that a bare owner approval acts on the newest request while retaining the other 100. (extensions/tlon/src/monitor/index.test.ts:239, 66451c5e816e)
  • Previous follow-ups addressed: The guide now describes notices per full-queue episode. The captured PR body reports per-file test wall times and available CI shard times. Public docs: docs/channels/tlon.md. (docs/channels/tlon.md:216, 66451c5e816e)
  • Accepted tradeoff: The captured PR body explicitly accepts rejection above 100 pending entries and three failed owner-notice attempts while preserving legacy approvals. A live repository permission read returned maintain access for the author.
  • Feature-history routing: Recent merged history on the approval, settings, and monitor paths includes Tlon durability and monitor work by Peter Steinberger and nearby Tlon work by Vincent Koc; unavailable parent blobs prevent a source-line introduction claim. (extensions/tlon/src/monitor/index.ts, dba4c4f0e152)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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 (3 earlier review cycles)
  • reviewed 2026-09-28T20:05:28.004Z sha 9369582b59b2571d8e2d5a0c2a2089948ef44870 :: needs real behavior proof before merge. :: [P1] Preserve existing approvals before applying the load cap | [P1] Give the owner an actionable outcome when the queue fills
  • reviewed 2026-09-28T21:06:03.967Z sha c75c8c44f59c7255f1865f4784cd3e78eca18b19 :: blocked before merge. :: [P2] Retry the owner notice when saturation delivery fails
  • reviewed 2026-09-28T21:28:20.536Z sha 4c0b72e5444858cef1a846d665ddbf44ccc8fe59 :: blocked before merge. :: [P3] Describe saturation notices per full-queue episode | [P3] Record the changed test files' measured cost

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M and removed size: S labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 28, 2026
@eleqtrizit

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@eleqtrizit

Copy link
Copy Markdown
Contributor Author

Merge record

Summary: This PR bounds new Tlon approval admissions at 100 pending entries while preserving legacy queue order and duplicate updates. It keeps rejected invite snapshots retryable, emits bounded owner-visible saturation warnings, and documents and tests full-queue behavior.

Decision Reason for Merge: Merged because exact-head CI passed, final compatibility and mergeability checks passed, and ClawSweeper reported no actionable findings and marked the PR ready for maintainer review.

Compatibility Checks Done: Exact-head CI passed, including production and test type checks, lint, dependency, boundary, source-contract, and focused Tlon test lanes. Final security compatibility review found no config, schema, default, authorization, or public API break; GitHub reports the PR mergeable and clean.

@eleqtrizit
eleqtrizit merged commit 4f412cd into openclaw:main Sep 29, 2026
101 of 103 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: tlon Channel integration: tlon docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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