Skip to content

fix(feishu): wait for accepted replay work during shutdown - #150094

Merged
steipete merged 6 commits into
mainfrom
codex/feishu-replay-settlement-prerequisite-20260916
Sep 20, 2026
Merged

steipete merged 6 commits into
mainfrom
codex/feishu-replay-settlement-prerequisite-20260916

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Related: #150135

What Problem This Solves

Feishu account shutdown could finish while accepted synthetic events or deferred message and broadcast replay work still owned pending writes, including handlers whose five-minute per-chat ordering slot had already expired.

User Impact

Shutdown closes new event admission and waits for accepted handlers and replay writes to settle before releasing account resources. Pending work can therefore extend account cleanup. Menu/card acknowledgments, card-token behavior, VC auto-join defaults, and the five-minute queue limit remain unchanged. No configuration or migration is required.

Why This Change Was Made

The account lifecycle tracks accepted handlers through deferred settlement, while the existing durable ingress owner continues to drain message admission. Broadcast settlement starts at fanout creation, joins admitted lane commits through failure, and retires late adoption. Transport adoption still precedes logical replay commits.

The persistence backend now runs in SQLite workers, so this change also incorporates the remaining fixture preparation from #150135: route all fourteen current Feishu persistence test roots through the worker lane, join accepted fixture work before database close, and preserve shutdown and close failures. Restart checks close and reopen SQLite before testing replay suppression.

Evidence

594 tests across 20 files passed: 303 Feishu database-worker tests, 61 ordinary Feishu tests, 193 test-routing checks, and 37 shared ingress-monitor checks. These exercise real SQLite restart persistence, registered message/card/menu/meeting shutdown, deferred broadcast commits, original handlers after queue-slot eviction, and loopback webhook behavior.

Production and test type checks, scoped lint, formatting, line-cap, max-lines, and assertion-safety checks passed. Independent P2 review and the maintainer ownership audit completed with no accepted finding. The changed-check plan was inspected and proportional checks ran; the full local check:changed orchestration was not run.

This establishes isolated SQLite and channel-boundary behavior. It does not claim live Feishu provider validation.

Join accepted synthetic events, active message handlers and deferred logical replay settlement through the existing account task owner. Preserve queue-first adoption, the five-minute queue limit and accepted card actions across cancellation. Retire failed broadcasts without dropping admitted lane commits.
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check could not safely complete for this revision.

ClawSweeper will not retry this unchanged revision.

Next step: No contributor action is requested. Maintainers should inspect the linked workflow run.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: L maintainer Maintainer-authored PR labels Sep 16, 2026
@steipete
steipete marked this pull request as ready for review September 16, 2026 13:55
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 20, 2026, 5:44 AM ET / 09:44 UTC (Revision 6).

ClawSweeper review

What this changes

The Feishu plugin waits for accepted handlers and replay writes before finishing account shutdown, with matching lifecycle tests, SQLite-worker test routing, and documentation.

Merge readiness

✅ Ready for maintainer review

This remains useful work: neither current main nor the latest release contains the complete shutdown repair. No introduced blocking defect was found, and the earlier card-fixture concern is addressed.

Priority: P2
Reviewed head: 88969d4190a71667a49335904ad57664e9e30a27

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused lifecycle repair with meaningful regression coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Reported registered-handler and SQLite tests cover the changed account and replay owners; they do not establish live Feishu behavior, and this review did not rerun them.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Reported registered-handler and SQLite tests cover the changed account and replay owners; they do not establish live Feishu behavior, and this review did not rerun them.
Evidence reviewed 9 items Introduced scope: Reviewed the verified merge-base-to-head changes rather than endpoint drift. Production changes are confined to Feishu; unrelated base-branch changes and broad labels were excluded from attribution.
Shutdown ownership: The account closes handler admission, stops durable ingress, repeatedly joins tracked tasks, and only then stops thread bindings. Tracking includes original message handlers and detached replay settlement.
Settlement ordering: Transport adoption remains authoritative and precedes logical replay commits; the complete adoption promise is now tracked. Broadcast settlement also joins already-started lane commits after failure.
Findings None None.
Security None None.

How this fits together

The Feishu plugin receives messages and interaction events, dispatches agent work, and records replay protection. Its account lifecycle coordinates transport shutdown with pending work before releasing account resources.

flowchart TD
  A[Feishu messages and interactions] --> B[Account admission check]
  B --> C[Durable message ingress]
  B --> D[Interaction handlers]
  C --> E[Agent dispatch and replay writes]
  D --> E
  E --> F[Account task tracking]
  G[Shutdown request] --> B
  G --> F
  F --> H[Release account resources]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +126, Tests +789, Docs +2. Total +917 across 35 files.

View PR surface stats
Area Files Added Removed Net
Source 9 187 61 +126
Tests 25 920 131 +789
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 35 1109 192 +917

Review metrics

Metric Value Why it matters
Production versus regression coverage Net production +126 lines; tests/support +781; test routing +8 Production growth is justified by retaining handler and settlement lifetimes, while most growth supplies regression coverage and worker-safe teardown.

Technical review

Best possible solution:

Keep accepted work owned by the existing account lifecycle through final settlement, preserving durable-ingress ordering and existing interaction authorization.

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

Yes, from source: defer a logical replay commit until after transport adoption, then stop the account; current main can release account resources before that commit settles. No runtime reproduction was executed during this review.

Is this the best way to solve the issue?

Yes. Extending account task ownership covers detached settlement without duplicating durable ingress, changing stored data, or expanding the public plugin API.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e71ac748fccb.

Labels

Label justifications:

  • P2: This repairs a bounded Feishu shutdown race involving accepted handlers and replay writes.
  • 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 maintainer-authored PR is exempt from the external-contributor proof gate. Reported registered-handler and SQLite tests cover the changed account and replay owners; they do not establish live Feishu behavior, and this review did not rerun them.

Evidence

What I checked:

  • Introduced scope: Reviewed the verified merge-base-to-head changes rather than endpoint drift. Production changes are confined to Feishu; unrelated base-branch changes and broad labels were excluded from attribution. (88969d4190a7)
  • Shutdown ownership: The account closes handler admission, stops durable ingress, repeatedly joins tracked tasks, and only then stops thread bindings. Tracking includes original message handlers and detached replay settlement. (extensions/feishu/src/monitor.account.ts:612, 88969d4190a7)
  • Settlement ordering: Transport adoption remains authoritative and precedes logical replay commits; the complete adoption promise is now tracked. Broadcast settlement also joins already-started lane commits after failure. (extensions/feishu/src/feishu-ingress.ts:280, 88969d4190a7)
  • Still necessary on main: Current main stops durable ingress and immediately releases thread bindings without the added account-level pending-task drain. The central repair is therefore still absent. (extensions/feishu/src/monitor.account.ts:589, e71ac748fccb)
  • Latest release comparison: The same shutdown path in v2026.9.5 lacks the account-level task drain. Release source was successfully inspected through GitHub after the local historical blob was unavailable. (extensions/feishu/src/monitor.account.ts, ec9c1a13db89)
  • Regression coverage and validation limits: Inspected registered-handler tests covering deferred message/broadcast commits, queue-slot expiry, accepted card/meeting work, menu claim/commit/forget phases, and late-event rejection. The captured PR body reports 594 passing tests and explicitly limits its claims to isolated SQLite and channel-boundary behavior. This read-only review did not execute tests; git diff --check passed. (extensions/feishu/src/monitor.dedupe-lifecycle.test.ts:94, 88969d4190a7)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • edenfunf: 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 (5 earlier review cycles)
  • reviewed 2026-09-16T14:02:37.732Z sha 34ceaf4 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T14:14:57.965Z sha b560975 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T14:46:29.406Z sha 80b1984 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T21:54:01.557Z sha 7d745ad :: needs maintainer review before merge. :: none
  • reviewed 2026-09-17T01:19:42.178Z sha 86339b4 :: needs maintainer review before merge. :: none

@steipete
steipete requested review from a team as code owners September 20, 2026 07:14
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams labels Sep 20, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: ios App: ios app: linux app: macos App: macos app: wearos App: wearos channel: a2a channel: buzz channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: irc channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: nostr Channel integration: nostr channel: qa-channel Channel integration: qa-channel channel: qqbot channel: raft Channel integration: Raft channel: reef Channel integration: reef channel: signal Channel integration: signal channel: slack Channel integration: slack channel: sms Channel integration: sms channel: synology-chat channel: telegram Channel integration: telegram channel: zalo Channel integration: zalo docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: acpx extensions: active-memory extensions: admin-http-rpc extensions: anthropic extensions: arcee extensions: baseten Extension: baseten extensions: byteplus extensions: cerebras extensions: clawrouter Extension: clawrouter extensions: clickclack extensions: cloudflare-ai-gateway extensions: cohere extensions: comfy extensions: copilot-proxy Extension: copilot-proxy extensions: crabbox extensions: deepgram extensions: deepinfra extensions: deepseek extensions: device-pair extensions: diagnostics-otel Extension: diagnostics-otel extensions: diagnostics-prometheus extensions: document-extract extensions: duckduckgo extensions: featherless extensions: fish-audio Extension: fish-audio extensions: gmi extensions: huggingface extensions: image-generation-core extensions: inworld Extension: inworld extensions: kilocode extensions: litellm extensions: llama-cpp extensions: llm-task Extension: llm-task extensions: lmstudio extensions: lobster Extension: lobster extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb extensions: memory-wiki extensions: oc-path extensions: onepassword 1Password plugin extensions: openai extensions: policy extensions: qa-lab extensions: stepfun fleet gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. plugin: azure-speech Azure Speech plugin plugin: beam Beam session sharing plugin plugin: bonjour Plugin integration: bonjour plugin: cua-computer plugin: facetime FaceTime plugin plugin: file-transfer plugin: geolocation Geolocation plugin (IP to coarse city) plugin: google-meet plugin: imap plugin: linux-node plugin: logbook Logbook automatic work journal plugin plugin: migrate-claude plugin: migrate-hermes plugin: mxc plugin: pixverse plugin: session-share plugin: team-reports plugin: teams-meetings Teams Meetings plugin plugin: typesafe rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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.

2 participants