Repository navigation
Discard conversation titles that arrive after deletion - #926
rudycelekli wants to merge 1 commit into
Conversation
Implemented and locally validated with OpenAI Codex assistance.
auditbenchai
left a comment
There was a problem hiding this comment.
🤖 Automated review by Audit Bench Ai, not a personal review. It was posted through the GitHub account connected to Audit Bench Ai. Install the Audit Bench Ai GitHub App to have reviews posted by a separate bot account.
Findings: 1, listed in the fix prompt below (they couldn't be placed as inline comments).
Merge risk: 🟢 Low · up to c0f3c57
The change adds a check for deleted channels within the existing summary transaction without altering existing queue or channel access boundaries.
Merge readiness: 🟡 Ready to merge, with notes
Pre-merge checks: ✅ 9 · ⚠️ 1
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| CI checks | No CI checks ran on this commit. | Add CI so every PR is built and tested. |
✅ Passed checks: 9 passed
| Check name | Status | Explanation |
|---|---|---|
| Merge conflicts | ✅ | Merges cleanly into main. |
| Secrets | ✅ | No keys, passwords or tokens in the changed code. |
| Blocking issues | ✅ | No critical or high-severity issues in the changed lines. |
| Tests | ✅ | Tests were changed alongside the code. |
| PR size | ✅ | 101 lines changed. |
| Title check | ✅ | The title clearly describes the bug fix and intended behavior. |
| Description check | ✅ | The description provides comprehensive details on the problem, solution, concurrency behavior, and proof. |
| Linked issues check | ✅ | No specific issue numbers are linked in the description. |
| Out of scope changes check | ✅ | All changes are directly scoped to handling channel deletions during the summary workflow. |
📝 Walkthrough
This PR prevents conversation summaries from being saved or announced if a channel is soft- or hard-deleted while an AI model call is in progress. The database update now verifies that the channel has not been deleted, distinguishing between existing channels updated by concurrent workers and channels that were removed. Queue items are still settled properly without emitting stale summary notifications.
| File | Changes |
|---|---|
server/src/channels/summary.ts |
Verifies channel deletion status during conditional updates and avoids emitting events if the channel was deleted. |
server/tests/channel-summary.integration.test.ts |
Adds integration tests verifying soft and hard deletions during asynchronous channel naming do not write summaries or emit events. |
ℹ️ Review info
- Commit:
c0f3c57 - Verdict: ✅ Pass
- Findings: 1 low
- Review: local checks plus AI review of the changed lines
- Scope: Reviewed 2/2 selected files (of 2 total): 2 reviewed by AI, 0 from cache, 0 passed local checks with nothing risky enough to send to AI. Found 1 finding(s), No secrets found.
🤖 Prompt to fix review comments
Verify each finding against the current code and only fix it if it still applies.
In `@server/src/channels/summary.ts` around line 114: High cyclomatic complexity: summariseClaimedChannels(). Complexity of 13 makes this function harder to test and reason about. Suggested fix: Split into smaller functions with single responsibilities.
💬 Reply to any inline comment and Audit Bench Ai will recheck that code and answer in the thread. Mention @auditbench in the conversation to ask about the whole PR.
🛠️ Open the full report and fix with AI
Thanks for using Audit Bench Ai! Free pull request reviews for open source: paste any public PR at auditbenchai.com/scan.
Reviewed by Audit Bench Ai · AI code review for security, logic and performance · Review any public PR free
What this changes
Conversation naming checks whether a channel was deleted before asking the model. If deletion happens while that model call is pending, the final write can still add a summary to the soft-deleted row and announce it to the channel's members. A hard-deleted channel is also reported as successfully named even though no row changed.
Recheck
deletedAtin the conditional write. If no row changes, distinguish a surviving channel another writer named from a channel that is gone. Both settle their queue item, while a deleted channel gets no new summary, timestamp, or summary announcement.Where it runs
Boundary and audit
Changelog
Proof
Base
743649efc3f21d7bf0badbe6af2bcd5daedd97ce, headc0f3c577ccbabe91d7d1f0740d4cfce1c62e265d.Two regressions pause the model with a promise barrier while the real worker holds a queue claim, perform a soft or hard deletion in Postgres, then release the title. Before: both fail. A real
LISTENconnection captures the late summary announcement after soft deletion; hard deletion is incorrectly listed as written. After: the deleted row is unchanged or absent, neither job reports a successful name, both jobs finish, and no summary announcement is emitted. A commit-orderedNOTIFYmarker confirms the listener observed the completed transaction; no timing sleeps or live model calls are used.The full channel-summary file passes 19 tests and 47 assertions. All 10 channel and work-queue files pass together: 206 tests, 503 assertions. Controls retain another writer's existing title, ordinary naming, concurrent claims, delayed transcripts, model-failure retries, and notification size limits.
Format, lint, workspace typecheck, the test-typecheck baseline guard, and build pass on this exact head.
The full suite was not run on this head. A separate routing candidate (
d428f669f10e21700b6d5eb1fb14e90c9cc59cfe) on the same base ran fulltest:ci: 11,017 passed, 210 skipped, two failed (routine-sweep concurrency expectation and recorder held-steps service-worker timing). Both passed when isolated on unchanged base and that routing candidate; full-suite order/timing causality remains unresolved.The tests use a dedicated disposable PostgreSQL 15 database (hosted CI uses 17), with no application data or live provider calls. PRs #917 and #918 change task-brief unwrapping in a different part of this file; they do not change this final write.
AI assistance: implemented and locally validated with OpenAI Codex. Hosted CI and maintainer review remain required.