Skip to content

refactor(channels): persist feedback through transcript workers - #165764

Merged
steipete merged 2 commits into
mainfrom
dbasync/w4mirrors3-feedback
Oct 5, 2026
Merged

steipete merged 2 commits into
mainfrom
dbasync/w4mirrors3-feedback

Conversation

@steipete

@steipete steipete commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Recording channel feedback still reads the session and appends its transcript event on the Gateway thread, even though the entry point is asynchronous.

Why This Change Was Made

Retain the physical session reader through a synchronous append transaction in the existing agent writer. The transaction rereads the session identity, uses the existing event kernel, and returns an acknowledged projection receipt. Host authority is checked at transaction and commit; the existing FIFO and settlement owner retain accepted writes. Projection reconciliation starts after acknowledgment.

User Impact

Removes caller-thread SQLite from durable channel feedback without changing event bytes, schema, retention, or accepted SDK argument types. Missing sessions still return false. Maintenance and process-held incognito retain their native adapter, which first-party SQLite test helpers also reuse.

This is W4-01 reslice 1. The independent strict-turn harness sibling is #165793. The complete locked/Codex/delivery-mirror cutover is parked because its dependency closure exceeds the agreed size cap. Related predecessor: #165541. Overlap is permitted with #162433, #165710, and the concurrent database/session-authority lanes; whichever lands second merges main and adapts.

Evidence

  • Real feedback entry point: MAIN SQL 32 → 0, with persisted-event and missing-session assertions. The baseline was a33accd27f3d; the affected source is byte-identical to this PR's 4d94a9fac61f2 base. The older parked draft's 36 count is not reused as current evidence.
  • Static worker inventory: T1 858 → 858; ratchet passed against the pinned base in 37.91 s. Shared native/SDK kernels remain conservatively classified.
  • Production: 3 files, +140 / −24 / net +116; 164 changed lines. Seven files total, including docs and tests/routing. Zero new OPENCLAW_* names.
  • Focused proof: 45 tests across 7 files passed, pnpm test … --maxWorkers=1, 632.34 s wall. Includes the real feedback boundary, bounded-history indirect caller, message rewrite siblings, runtime-process build graph, reply import closure, and reconcile import closure. The new worker test took 15.08 s; it needs real transport/admission to detect caller-thread SQL. The existing dispatch tests took 0.48 s. Five MS Teams feedback authorization tests also passed in a separate 140.56 s wall run. PR CI timing is not yet available.
  • Core types passed (28.41 s), SDK surface budget passed (27.65 s), madge 0 cycles (169.21 s), and independent Codex review through P2 was scoped-clean, including a final review after the documentation correction (105.42 s; initial review 287.90 s).

The committed SDK API diff completed successfully (1581.07 s) and reports one representational signature change for channel-inbound.recordChannelFeedbackEvent: Parameters<typeof appendTranscriptEvent>[1] becomes the same TranscriptEvent type (unknown); no SDK export is added or removed and no surface budget is raised.

check-changed ran for 1595.02 s and stopped at inherited unused exports: resolveBrowserOpenCommand in src/commands/onboard-helpers.ts and src/infra/browser-open.ts, plus normalizeMediaUnderstandingChatType in src/media-understanding/scope.ts. The unchanged pinned base reproduces all three (198.09 s). All 10 remaining owner-selected checks passed in a separate 1139.02 s run, including core/script lint, schema/storage guards, runtime import cycles, and webhook/pairing guards. No full green check-changed claim is made.

Published-driver update proof: 2026.9.8 → exact candidate tree 1fc3dbcbbabeb210f9cc95e49246978b8db9e872 passed, readiness HTTP 200, durable state retained and incognito restart behavior checked. Candidate package integrity passed; tarball SHA-256 f83fbdeddc26e44d7a17c95fd978a83d968984c97edd62d9045c208c761462e9. Cell wall 260.60 s; package + cell command 1159.98 s. Testbox run, lease tbx_01m46rd2zqh7r02vf3hpj66msm, exited 0 and stopped after success. Its backing Actions step may show cancelled because the external lease was stopped.

The final follow-up commit only corrects documentation about the private testing helper. Runtime, SDK, and package proof above bind runtime commit 4d6e7978c139; production bytes are unchanged by that documentation correction.

Final-head validation: gateway runtime build passed (141.45 s), isolated MS Teams cold-import profile qualified with no gaps (2.26 s; child process group verified closed), and the edited documentation passed its MDX and diff checks.

Landing review at c2ae375cb2b6db3548431462e2fbdf69fb8144db: compared the released channel-inbound feedback contract against v2026.10.1-beta.1 and stable v2026.9.8. The function remains asynchronous with the same parameters and Promise<boolean> result; TranscriptEvent remains unknown. No released export or callback contract is removed, so no deprecation adapter is needed. The new append helper is internal.

CI attempt 1 (run 37366899278) completed its executed test and typecheck lanes successfully. Eight CI jobs were abandoned before any step executed during the GitHub Actions outage; the aggregate gate failed solely on those abandoned lanes. This is infrastructure failure, not passing coverage. GitHub reported Actions operational at 2026-10-05 21:54 UTC; the abandoned CI and analysis lanes were rerun once after that recovery was verified. All selected CI lanes passed in attempt 2 on the unchanged approved head. CodeQL security and critical quality, Node runtime conformance, and platform-scope checks also passed on their single recovery rerun. ClawSweeper completed an exact-head review at 2026-10-05 20:48 UTC with no actionable findings.

The PR-context check identified the original Problem heading as missing the required What Problem This Solves section. The heading now matches the repository template; the problem statement and runtime code are unchanged.

@clawsweeper

clawsweeper Bot commented Oct 5, 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.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Oct 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 5:30 PM ET / 21:30 UTC (Revision 2).

ClawSweeper review

What this changes

Moves durable channel feedback persistence into the existing transcript workers while preserving missing-session results and native maintenance and incognito adapters.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main still performs feedback persistence on the caller thread, and the merged predecessor explicitly left this work outstanding. No actionable introduced defect was found.

Priority: P2
Reviewed head: c2ae375cb2b6db3548431462e2fbdf69fb8144db

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-supported refactor with no actionable findings; incomplete CI remains a native merge gate.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Submitted real-entry evidence exercises feedback recording through the actual database reader and worker writer, observes persisted feedback and missing-session refusal, and reports caller-thread SQL falling to zero. Published-driver upgrade evidence binds the verified runtime tree; no stored-data contract changes require migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Submitted real-entry evidence exercises feedback recording through the actual database reader and worker writer, observes persisted feedback and missing-session refusal, and reports caller-thread SQL falling to zero. Published-driver upgrade evidence binds the verified runtime tree; no stored-data contract changes require migration.
Evidence reviewed 8 items Pinned introduction and merge result: Reviewed the complete seven-file introduced delta. The raw test-merge record has the pinned base followed by the exact PR head as parents; its feedback changes match the introduced implementation.
Current main still needs the change: Fetched main retains loadSessionEntryReadOnly followed by appendTranscriptEvent in feedback recording; it does not contain this worker cutover.
Transaction and acknowledgement safeguards: The worker rereads the session identity before appending through the existing event kernel. The retained writer admission checks source currentness at transaction and commit, and projection reconciliation follows acknowledged persistence.
Findings None None.
Security None None.

How this fits together

Channel feedback recording accepts feedback events from channel plugins and saves them in the agent’s session transcript. The Gateway retains the selected session source while the existing database writer commits the event and acknowledges any projection work.

flowchart TD
  A[Channel feedback event] --> B[Retained session reader]
  B --> C{Session exists}
  C -->|No| D[Return false]
  C -->|Yes| E[Existing transcript writer]
  E --> F[Validate source and append event]
  F --> G[Acknowledge committed result]
  G --> H[Reconcile projection if needed]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +116, Tests +10, Docs +9. Total +135 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 3 140 24 +116
Tests 3 52 42 +10
Docs 1 10 1 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 202 67 +135

Review metrics

Metric Value Why it matters
Feedback caller-thread SQL 32 → 0 The reported real-entry measurement directly demonstrates the intended removal of Gateway-thread database work.
Production and test growth production +140/−24, tests +50/−42 Production growth supplies worker dispatch and acknowledged publication while replacing mocked persistence coverage with a real boundary regression.

Technical review

Best possible solution:

Keep feedback persistence under the existing reader, writer, and settlement owners with the released SDK contract preserved.

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

Yes, source establishes current main’s caller-thread session read and append, and the submitted real-entry measurement records that SQL. This read-only review did not execute tests.

Is this the best way to solve the issue?

Yes, reusing the canonical writer and event kernel is a focused solution; the inspected path preserves native adapters and avoids a competing persistence owner.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded runtime persistence improvement without evidence of an urgent user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Submitted real-entry evidence exercises feedback recording through the actual database reader and worker writer, observes persisted feedback and missing-session refusal, and reports caller-thread SQL falling to zero. Published-driver upgrade evidence binds the verified runtime tree; no stored-data contract changes require migration.
  • proof: sufficient: Contributor real behavior proof is sufficient. Submitted real-entry evidence exercises feedback recording through the actual database reader and worker writer, observes persisted feedback and missing-session refusal, and reports caller-thread SQL falling to zero. Published-driver upgrade evidence binds the verified runtime tree; no stored-data contract changes require migration.

Evidence

What I checked:

  • Pinned introduction and merge result: Reviewed the complete seven-file introduced delta. The raw test-merge record has the pinned base followed by the exact PR head as parents; its feedback changes match the introduced implementation. (c2ae375cb2b6)
  • Current main still needs the change: Fetched main retains loadSessionEntryReadOnly followed by appendTranscriptEvent in feedback recording; it does not contain this worker cutover. (src/channels/feedback-reflection.ts:17, 0e54386a4634)
  • Transaction and acknowledgement safeguards: The worker rereads the session identity before appending through the existing event kernel. The retained writer admission checks source currentness at transaction and commit, and projection reconciliation follows acknowledged persistence. (src/config/sessions/session-message-rewrite.worker.ts:172, c2ae375cb2b6)
  • Production-boundary proof: The captured PR body reports caller-thread SQL decreasing from 32 to zero through the real feedback entry, with persisted-event and missing-session assertions. The inspected worker regression uses real database and worker owners rather than mocked persistence. (src/channels/feedback-reflection.worker.test.ts:9, c2ae375cb2b6)
  • Upgrade proof identity: The captured body reports a successful published-driver 2026.9.8 upgrade retaining durable state and checking incognito restart behavior. Its candidate tree 1fc3dbcbbabeb210f9cc95e49246978b8db9e872 exactly matches the runtime commit; the final documentation commit leaves all three changed production files byte-identical. The linked Actions wrapper is cancelled, consistent with the disclosed external lease shutdown, and is not independently treated as a passing CI run. (4d6e7978c139)
  • Released feedback contract: Stable v2026.9.8 exposes the same asynchronous feedback parameters and Promise<boolean> result. The head’s TranscriptEvent alias remains unknown; the new worker helper is internal. No stored schema or serialized-format migration is introduced. (src/channels/feedback-reflection.ts:17, fc23bc864e45)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • joshavant: 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-10-05T20:48:57.576Z sha c2ae375 :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M labels Oct 5, 2026
@steipete
steipete merged commit 7d605cc into main Oct 5, 2026
248 of 276 checks passed
@steipete
steipete deleted the dbasync/w4mirrors3-feedback branch October 5, 2026 22:09
@steipete

steipete commented Oct 5, 2026

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

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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