Repository navigation
feat: team comments from shared dbt docs in Claude's context and a /comments pane - #26
Conversation
…omments pane Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… double post, no stale refresh, comment text quoted as data Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Review-loop results for the P-14 commit (two independent reviewers, Fixed
Not changed
|
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Conflicts: # plugins/altimate-code/hooks/features/comments.tsx
…flight work on a new session, a resolved thread never comes back from an older list Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Review round 1 (independent
|
|
review-loop: APPROVED at af487e2 |
Code Review SummaryStatus: 3 Issues Found | Recommendation: Merge after follow-ups Incremental review of Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (4 files)
Reviewed statically (read-only run: no test suite executed). Previous Review Summaries (7 snapshots, latest commit 8d383ec)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 8d383ec)Status: 3 Issues Found | Recommendation: Merge after follow-ups Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (4 files)
Incremental review of Checked in the delta and found correct:
Reviewed statically (read-only run: no test suite executed; the failures above were traced from the harness, e.g. Fix these issues in Kilo Cloud Previous review (commit f9362fb)Status: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (5 files)
Incremental review of Checked in the delta and found correct:
Reviewed statically (read-only run: no test suite executed; each failure above was traced from the harness code, e.g. Fix these issues in Kilo Cloud Previous review (commit 5b86ba7)Status: 7 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (10 files)
Incremental review of Reviewed statically (read-only run: no test suite executed; each failure above was traced from the harness code, e.g. Fix these issues in Kilo Cloud Previous review (commit 72c401a)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (1 file)
Incremental review of Reviewed statically (read-only run: no test suite executed; the id-baseline behaviour was traced from the code, not run). Fix these issues in Kilo Cloud Previous review (commit 80054d3)Status: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (3 files)
Incremental review of Fix these issues in Kilo Cloud Reviewed statically (read-only run: no test suite executed; the timing/held-list behaviour was traced from the harness code, not run). Previous review (commit 416f82a)Status: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (2 files)
Incremental review of Fix these issues in Kilo Cloud Reviewed statically (read-only run: no test suite executed). Previous review (commit 51fe838)Status: 2 Issues Found | Recommendation: Merge with minor suggestions Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (4 files)
Incremental review of [Snapshot truncated.] Additional previous summary content was truncated to keep this comment within platform limits. Reviewed by deepseek-v4.1-flash-1017 · Input: 97.2K · Output: 22.9K · Cached: 1.3M |
…threads in one pass over the text Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Re-applies the team-comments feature on top of main's end-of-task impact summary: the band is the summary's, runTool/within come from altimate-cli, and the turn hooks run both the summary's and the features'. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eaves the real comments feature out Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
sahrizvi
left a comment
There was a problem hiding this comment.
Consensus review (Claude + Codex): changes requested: 5 majors and 3 minors inline, and the rest in the PR comment that follows.
| let current = await get($) | ||
| if (!current.root || current.needs) return null | ||
| // The first read can come before the first load is done: wait for it, briefly, so the review is seen before an edit. | ||
| if (current.loadedAt === null && current.error === null) { |
There was a problem hiding this comment.
Major — the "first-read" wait applies to every read and edit until the first list settles, not once.
loadedAt === null && error === null holds for the whole first load, and nothing records that a wait was already spent or checks that the file is a commented model first. With the list held, three Reads in a row (README.md, then a model twice) each waited the full FIRST_READ_WAIT_MS (3000 ms) in a scratch test using the PR's own harness. Against a backend that accepts connections but never answers, the CLI from altimate-code #1730 gives up after 15 s (about 23 s wall-clock with CLI startup), so every Read/Edit/Write in a dbt project in that window costs 3 s. This includes -p runs and sessions whose project has no shares. Suggest waiting once per session (or once per commented model after the list arrives) and skipping the wait for files that can't hold a thread.
There was a problem hiding this comment.
Fixed in 10240c0: the wait is spent once per session and only on files that can hold a thread (sql/yml/py/md/csv). Test: only the first read waits.
There was a problem hiding this comment.
Resolved at f9362fb. The wait is now spent once per session, and only on a file that can hold a thread. In the test kit with a list that never answers, the first model read waited exactly 3,000 ms (still waiting at 2,999 ms). Later reads of the model and of README.md did not wait. Mutation: removing firstWaitSpent = true fails "only the first read waits…". Left over, minor and monorepo only: each project switch resets the wait (inline at L363).
There was a problem hiding this comment.
Thanks. The per-project wait reset is the same monorepo follow-up as the thread below (state keyed by root); not in this PR.
| const threads = listed.threads.map(toThread).filter((one): one is CommentsThread => one !== null) | ||
| const now = await $.clock.now() | ||
| // A post may have finished while this answer was being applied: the fresh list that follows it decides. | ||
| await change($, current => (wrote !== writes ? { ...current, loading: false } : { ...current, threads, loadedAt: now, loading: false, error: null })) |
There was a problem hiding this comment.
Major — a list from an earlier session can still overwrite the new session's threads.
The generation check is at L342, but await $.clock.now() (L353) and the change at L355 come after it, and the updater checks only writes. If a /clear (sessionStart: generation++, state reset to INITIAL) lands during that await, the old answer writes its threads and loadedAt into the new session, and nothing corrects them until the next poll. Codex reproduced this with the transpiled feature and a controlled engine. Check mine === generation inside the final updater too (and in the error branches at L345/L349).
There was a problem hiding this comment.
Fixed in 10240c0: the final updater and the error branches now check the session generation before writing. I could not build a deterministic test for the window between the check and the clock read, so there is no regression test for this one.
There was a problem hiding this comment.
Resolved at f9362fb (by code reading). The final updater (L453) and the error branches now check the generation inside the state write, and attach and post check it too. A list released after a new session.start doesn't write into it. Left over, minor: no test guards L453 (mutating it leaves the suite green; inline there). Note that /clear fires no session.start in this engine, which leads to two new majors (inline at L224 and L233).
There was a problem hiding this comment.
Thanks. The updater check stays untested for the reason given on the test-coverage thread: the window is one awaited clock read with no deterministic hook in the kit. The /clear majors are fixed in 8d383ec.
|
|
||
| /** Finds the dbt project from a folder when none is known yet, and starts its first load and the poll. */ | ||
| async function attach($: EngineInterface, dir: string) { | ||
| if ((await get($)).root) return |
There was a problem hiding this comment.
Major — the first dbt project found shuts out every other one for the rest of the session.
attach returns as soon as root is set. In a monorepo (/mono/a, /mono/b), reading a/models/orders.sql and then b/models/orders.sql loads only a's threads: b is never listed, its reads get no block, and /comments keeps showing a. I confirmed it with a scratch test in the PR's harness (one list, only for the first project). State and loads need to follow the file's project, or be keyed by it.
There was a problem hiding this comment.
Fixed in 10240c0: a file outside the loaded project that belongs to another dbt project switches the state to that project, drops the in-flight list and loads it. Test: a read in a second project lists it.
There was a problem hiding this comment.
Resolved at f9362fb. A read in another dbt project switches the state to that project and loads it. Mutating attach back to "keep the first project" fails 9 tests. Left over, minors and monorepo only: the post lock is shared across projects (L496), and switching back and forth waits and lists again (L363).
There was a problem hiding this comment.
Thanks. The shared post lock and the wait reset on a project switch are the two monorepo follow-ups discussed on the new threads; not in this PR.
| ) | ||
| if (mine !== generation) return | ||
| const sent = out.ok && (out.metadata as { success?: boolean } | null)?.success !== false | ||
| if (!sent) { |
There was a problem hiding this comment.
Major — a post the service may have accepted doesn't reload, so a retry can post twice.
The CLI's own request timeout (15 s) fires well before POST_TIMEOUT_MS (45 s), and #1730 catches it and returns status: error / success: false with "…may already have been posted: run list to check before trying again". I replayed a resolve against a backend that never answers: exit 1 after 19 s with exactly that answer, and runTool doesn't throw. So this !sent branch runs, not the catch that reloads. The buttons come back, the draft is kept, and the list isn't reloaded, so pressing Reply again can post a duplicate reply under the person's name. The "reload uncertain posts" fix only covers a CLI that dies. Treat a CLI failure (anything other than an explicit refusal such as read_only or missing_text) as uncertain and reload, as the catch does.
There was a problem hiding this comment.
Fixed in 10240c0: only the tool's named refusals (read_only, missing_text, missing_ids) skip the reload; any other failure, a CLI timeout included, reloads before another press. Tests cover both.
There was a problem hiding this comment.
Partly resolved at f9362fb. The ordinary case now holds. Replaying the real #1730 output for a reply that timed out after 15 s:
- A second press posts nothing.
- The follow-up list that shows the new message frees the thread and clears the draft. Another user's older identical
Yesdoes not confirm it. - A reply that never landed stays locked (
Posting…) until a list at least 330 s later, and then posts once.
Still open, as new majors:
/cleardrops the lock, so a retry posts twice (inline at L233).- A pre-post check failure that the CLI reports as "Nothing was sent" locks the thread for about 5.5 minutes (inline at L528).
There was a problem hiding this comment.
Both remaining majors are fixed in 8d383ec: /clear keeps the lock, and a failed pre-post check ("Nothing was sent") no longer locks the thread. Replies on the inline threads.
| /** The threads that sit on this file (their path is relative to the project folder). */ | ||
| export function threadsOnFile(threads: CommentsThread[], root: string, path: string): CommentsThread[] { | ||
| const rel = relativePath(root, path) | ||
| return threads.filter(thread => thread.filePath !== undefined && slashes(thread.filePath).replace(/^\.\//, '') === rel) |
There was a problem hiding this comment.
Major — threads are matched by stored file path alone, ignoring which model they belong to.
A docs share for the project also holds package models, whose filePath is relative to the package. A thread on model.some_pkg.orders with file_path: "models/orders.sql" goes into Claude's context when it reads the root project's own models/orders.sql. In the other direction, a model moved from models/orders.sql to models/marts/orders.sql loses its threads even though its unique_id hasn't changed. uniqueId is already parsed (L456): check its package part against the project name, or resolve unique_id to a path through the manifest, before matching.
There was a problem hiding this comment.
Fixed in 10240c0: a thread whose unique_id names another package no longer matches the project's file with the same relative path. Resolving moved models by unique_id through the manifest is not done: a moved model loses its threads, kept as a documented limitation.
There was a problem hiding this comment.
Resolved at f9362fb (the package part). A thread whose unique_id names another package no longer lands on the project's own file. With a real list holding model.some_pkg.orders at models/orders.sql, that thread stayed out of the context block. Mutating the owner check fails the package test. A moved model losing its threads is documented as a limitation, which is fine as a follow-up (re-sharing the docs updates the stored path).
There was a problem hiding this comment.
Thanks. A moved model losing its threads stays a documented limitation; re-sharing the docs updates the stored path.
| return | ||
| } | ||
| await change($, current => ({ ...current, ...found })) | ||
| later($, () => load($)) |
There was a problem hiding this comment.
Minor — the first list can be requested twice.
attach schedules load with later() (L298), then readOrEditAfter starts its own load at once (L249) because loadRun is still null. When the scheduled callback runs, it finds loadRun set and sets loadAgain, so a second list follows the first. Codex reproduced two lists from one read when a nested project is discovered. The initial request should join the running one without asking for a refresh.
There was a problem hiding this comment.
Fixed in 10240c0: a read waiting on the first load takes it over, so the scheduled load no longer asks twice (the monorepo test asserts one list per project).
There was a problem hiding this comment.
Resolved at f9362fb. A read waiting on the first load takes over the scheduled load (pendingFor), so the scheduled one is skipped. Each session start in my replays made exactly one list call.
There was a problem hiding this comment.
Thanks, nothing further.
| await change($, current => ({ ...current, ...found })) | ||
| later($, () => load($)) | ||
| // A `-p` run or the SDK has nobody at a pane: it loads once and does not poll. | ||
| if (interactive && poll === null) poll = $.clock.every(pollSeconds * 1000, () => later($, () => load($))) |
There was a problem hiding this comment.
Minor — the poll keeps going when the answer can't change.
Only needs stops it (fetchThreads L336). A signed-out user (no credentials file), a 401, and a server without the route (I replayed 404 and 401 with the #1730 CLI: one error line in the pane, correct) are stored as error. Every commentsPollSeconds (900 s) after that starts the CLI and calls the backend again for as long as the session lasts, and the same happens in every session in a dbt project whose project has no shares. Suggest backing off or stopping after auth or route errors (a 401 or 404 is recognisable in the text), leaving the Refresh button and the /comments command as the way to retry.
There was a problem hiding this comment.
Fixed in 10240c0: a 401/403/404 or sign-in error stops the poll; Refresh and /comments remain the way to retry. No dedicated test for this one.
There was a problem hiding this comment.
Resolved at f9362fb. Replaying the real #1730 401 answer (…failed with status 401): one list, then no more over 2 × 900 s. A list that timed out keeps polling, which is correct since that is not a refusal. A Refresh that works starts the poll again (tested by the PR, and the mutation that drops the stop is caught). A project with no shares still polls every 900 s, which is acceptable. New and separate: after /clear the poll never restarts (inline at L224).
There was a problem hiding this comment.
Thanks. The poll after /clear is fixed in 8d383ec (the poll is no longer cancelled by /clear).
| expect(block).toContain('more open threads') | ||
| }) | ||
|
|
||
| test('the settings: the poll never runs more often than every 30 s, and commentsInContext off is honoured', () => { |
There was a problem hiding this comment.
Minor (test coverage) — commentsInContext: false is only tested through readOptions.
Mutation: with comments.tsx:244 changed to if (false && !inContext) return null, claude plugin test reports 0 failures, so a regression that sends teammates' comments to the model provider despite the switch would pass. A test with { options: { commentsInContext: false } } that reads the commented model and expects no context catches it (I checked: it fails on the mutant and passes at head).
There was a problem hiding this comment.
Not changed: I could not find how the test harness passes plugin options to a feature, so the end-to-end commentsInContext test is not added; readOptions stays the only coverage.
There was a problem hiding this comment.
Not resolved. The kit does pass plugin options: test(name, { options: { commentsInContext: false } }, body). It is in the plugin-authoring reference: "A test gives the plugin under test its userConfig values with test(name, { options }, body)". A test written that way passes at head and fails on the if (false && !inContext) mutant, which the PR's suite still lets through. The code is in the new inline comment on line 209.
There was a problem hiding this comment.
Fixed in 8d383ec: the end-to-end test with { options: { commentsInContext: false } } is added (see the reply on the new thread at the same line).
|
Consensus review (Claude + Codex): changes requested. Scope: this PR's own change only, What holds, checked by running it:
Blocking (inline): the first-read wait applies to every read until the first list settles (about 23 s of 3 s waits against an unresponsive service); a stale list can overwrite a new session; a second dbt project in a monorepo is never loaded; a timed-out post isn't reloaded, so a retry can post twice; threads are matched by file path regardless of model or package. Minors (inline): the first list is requested twice, the poll doesn't stop after auth or route errors, and the off switch has no end-to-end test. Not tied to a diff line:
Merge order: altimate-code #1730 first (the plugin needs its |
…oject, reload uncertain posts, match package models by unique id Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Consensus review: the five blocking items and two of the minors are fixed in 10240c0 (replies on each thread). Not done: CHANGELOG/version bump (left to the release PR), the |
…ed; a session end drops running work; project discovery decides against current state Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ject lookup spanning a session end is dropped; joined loads wait for the follow-up list Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… checks its session inside the state write; a second project's first load is not skipped Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…comments stub answer Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…firmed-post note clears with the lock Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d before the post; a reset session does not inherit the lock Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eature's session-start call is not counted Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and opening the pane keeps the project last read Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e, a collapsed highlight is still placed, and a project nested in the loaded one is found Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… per loaded project Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… be checked does not lock the other threads Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@sahrizvi, state of your CHANGES_REQUESTED review: every inline thread has a reply (fixes were in 10240c0, bafc0ea and the commits listed in the earlier comments). Since then, two independent codex reviews of the whole diff found further real defects, fixed with regression tests: polling restarts after a sign-in refusal (eb80914), opening /comments keeps the project last read (eb80914), a partial list is shown as partial and does not confirm a resolve, collapsed highlights are placed, nested dbt projects are found (2876c25), folders without a project are remembered per loaded project (a6a4cff), and a refusal for a thread that is not open does not lock other threads (f9362fb). comments.test.tsx now records only docs_share_comments calls, so it passes with or without health #33 and shared-fixes #34. review-loop: APPROVED at f9362fb (reviewers: gpt-6-astra high, gpt-6.1-sol high) |
sahrizvi
left a comment
There was a problem hiding this comment.
Consensus re-review, round 2 (Claude + Codex): changes requested.
Three majors are open, all on the post lock and polling path: a double post after /clear, a post the CLI reports as not sent still locks the thread for about 5.5 minutes, and polling stops for good after /clear. Each was reproduced in the PR's own test kit, replaying real output recorded from the altimate-code #1730 CLI against a local fake backend. Codex accepted all three as majors under the approval bar for this round. That bar blocks only on bugs an ordinary user would hit, double posts, waits on every session, crashes, or comment text or emails reaching Claude against the setting. The other inline items are minors (edge cases, monorepo layouts, or test coverage) and don't block on their own. The round-1 replies, the round-1 status and the items not tied to a diff line are in the PR comment.
| loadAgain = false | ||
| posting = false | ||
| pendingFor = null | ||
| uncertain = null |
There was a problem hiding this comment.
Major: /clear drops the post lock, so a retry can post twice.
In this engine /clear fires session.end and no session.start follows (SessionEndInput.reason: 'clear': "no session.start fires for it"). So after /clear the pane keeps its threads and the typed draft, but sessionEnd sets uncertain = null, posting = false and posting: null in state, which brings the buttons back.
Repro in the PR's test kit, replaying the real #1730 CLI output for a reply that timed out (…timed out after 15 s. The reply may already have been posted…): type a reply, press Reply, run session.end({ reason: 'clear' }), press Reply again. Result: two reply calls. The same happens to a post still running at /clear; the test at comments.test.tsx:404 asserts that second post on purpose.
Suggested fix: keep uncertain across session.end (it describes the shared docs, not the conversation). On session.end, turn a post still running into an uncertain one, so the next press is refused until a list confirms or denies it.
There was a problem hiding this comment.
Fixed in 8d383ec: session.end with reason clear is now a no-op (no session.start follows it), so the lock of a running or unconfirmed post survives. Tests: '/clear keeps the lock of a post still running...' and '/clear keeps the lock of a post that may have landed' (the old test that asserted the second post is replaced).
There was a problem hiding this comment.
Resolved (round 3). /clear now returns early, so the lock of a running or unconfirmed post survives. Checked with the real CLI's reply-timeout output: after /clear the Reply button stays hidden and only 1 reply goes out; once a list shows the reply, the lock frees and the draft clears. Removing the early return fails 4 tests. A related path is left: /resume still goes through the old reset. That's a new minor (edge case) at :226.
| const note = oneLine(out.text) || 'The comment service did not accept that.' | ||
| // Only a refusal the tool names (no write permission, no text, no ids, a thread that is not open or cannot be checked) is known not to have posted. | ||
| const code = (out.metadata as { error?: unknown } | null)?.error | ||
| if (typeof code === 'string' && REFUSALS.has(code)) { |
There was a problem hiding this comment.
Major: a post the CLI says was not sent still locks the thread for about 5.5 minutes.
Before posting, #1730 lists the project to check the thread. If that check fails (a timeout, being offline), it answers "Could not check the thread: … Nothing was sent.", but metadata.error is the raw message (for example "API GET /dbt/dbt_docs_share/all?projects=… timed out after 15 s"), not a code in REFUSALS. So this branch is skipped and the post is treated as one that may have landed.
Recorded with the real CLI against a fake backend whose list never answers, then replayed: the note reads "…Nothing was sent. The thread stays locked until the list shows the post…". After a successful Refresh 300 s later the thread still shows "Posting…" and can't be posted to. It frees only on a successful list at least 330 s after the press, and the 900 s poll doesn't run that soon, so in practice it needs a manual Refresh after 5.5 minutes. A short network blip is enough to cause this.
Suggested fix: have #1730 return a named code for "check failed, nothing sent" (and for no_project), and add it to REFUSALS.
There was a problem hiding this comment.
Fixed in 8d383ec: the post path also treats a failure whose text says "Nothing was sent" as a refusal (comments.tsx, next to REFUSALS), so the thread is not locked. I matched the text because the CLI's metadata.error is the raw message; a named code from altimate-code would be cleaner as a follow-up. Test: 'a post the CLI says was not sent because its pre-post check failed does not lock the thread'.
There was a problem hiding this comment.
Resolved (round 3). With the real CLI's pre-check failure output ("Could not check the thread: … timed out after 15 s. Nothing was sent."), the thread is free at once and a second press goes out. Removing the check fails 2 tests. The phrase can't appear in a failure after a post was attempted: the CLI's HTTP errors never include a response body. A named error code from the CLI would still be cleaner later.
|
|
||
| export async function sessionEnd($: EngineInterface, e: Args<'session.end'>) {} | ||
| export async function sessionEnd($: EngineInterface, e: Args<'session.end'>) { | ||
| poll?.cancel() |
There was a problem hiding this comment.
Major: after /clear the list is never fetched again.
sessionEnd cancels the poll and sets poll = null. Only two places start it again: attach (which returns early for any file inside the known project, L333) and a successful list (L443). Because /clear fires no session.start, neither runs.
Repro in the test kit: start, session.end({ reason: 'clear' }), then advance the clock 3 × 900 s. There is still only the one list call, and a Read of the model still adds the threads from before the /clear.
After any /clear (a common command), Claude's context and the band keep the threads from that moment for the rest of the process: a resolved thread stays "open", and a new one never appears unless the person opens /comments or presses Refresh.
Suggested fix: keep the poll on reason: 'clear', or start it again from attach or readOrEditAfter when a project is known and poll === null.
There was a problem hiding this comment.
Fixed in 8d383ec: same change as the /clear lock item. /clear no longer cancels the poll, bumps the generation or resets state, so the list keeps refreshing. Test: 'the list is still fetched every poll after /clear' (3 lists over two poll periods).
There was a problem hiding this comment.
Resolved (round 3). After /clear the poll keeps running, and a later Read puts the newer thread in Claude's context (replayed with real list output). Removing the early return fails the PR's poll test. /resume still stops the poll; that's the new minor at :226.
| current.root === pending.root && | ||
| // A thread missing from a partial list may only be one the list did not reach. | ||
| (pending.action === 'resolve' ? there === undefined && !partial : there?.messages.some(message => !pending.before.has(message.id) && sameText(message.text, pending.text)) === true) | ||
| const freed = pending !== null && (seen || now - pending.at >= LIST_LAG_MS) |
There was a problem hiding this comment.
Minor (edge case): the 330 s expiry frees the lock on any successful list, even a partial one or one from another project.
The age check ignores partial and pending.root. After 330 s, a list that lacks the post's share (incomplete) or a list of another project frees the lock and keeps the draft (seen is false). If a later full list shows the post did land, the draft can be sent again. This needs a partial list or a second project, so it doesn't block. Suggest applying the same !partial and current.root === pending.root conditions to the expiry branch.
There was a problem hiding this comment.
Fixed in 8d383ec: the 330 s expiry now frees the lock only for a list that is not partial and is of the post's own project (!partial && current.root === pending.root). Test: 'a partial list, however old, does not free a post that may have landed'; the existing cross-project test now expects the lock to hold until the post's own project is listed.
There was a problem hiding this comment.
Resolved (round 3). The age rule now frees only on a whole list of the post's own project, and the cache age is judged when the list was asked for. Dropping !partial, dropping the same-project check, or using the answer time each fails a test. The stricter rule has an edge of its own: a project whose list is always partial never frees the lock. That's a new minor at :471, with a suggested middle ground.
| if (full === '') return false | ||
| // A text the service may have cut is matched by its start; a short one only whole, so an older | ||
| // "Yes, agreed." does not confirm a reply of "Yes". | ||
| return full.length > 200 ? flat(listed).startsWith(full.slice(0, 200)) : flat(listed) === full |
There was a problem hiding this comment.
Minor (edge case): a teammate's identical message can confirm a reply that did not land.
The confirmation checks for a message that wasn't in the thread before and has the same text. It doesn't check who wrote it. If a teammate posts the same short text (Yes, LGTM) in that thread while your timed-out reply never reached the service, the lock frees and your draft is cleared. For texts over 200 characters, any new message with the same first 200 characters qualifies. The result is a lost reply, not a double post, and it needs an unlikely coincidence. #1730 lists user_id per message, so it could be matched against the signed-in user later.
There was a problem hiding this comment.
Declined, documented limitation: matching the author needs the signed-in user id, which the plugin does not have today. The failure mode is the one you describe (a lost draft, never a double post) and needs an identical short message in the same thread inside the window. Can be added once the CLI exposes the current user.
There was a problem hiding this comment.
Not resolved, and fine as a follow-up (minor, edge case). Author still isn't matched. The failure is a lost draft, never a double post, and it needs the CLI to expose the signed-in user. Agreed to defer.
| const inside = known && (slashes(dir) === slashes(known) || slashes(dir).startsWith(`${slashes(known).replace(/\/+$/, '')}/`)) | ||
| if (inside && (slashes(dir) === slashes(known!) || within.has(`${known}\n${dir}`))) return | ||
| // A file of an installed package belongs to that package's own project, not to the one being worked on. | ||
| if (searched.has(dir) || /[\\/](dbt_packages|dbt_modules|node_modules)[\\/]/.test(dir)) return |
There was a problem hiding this comment.
Minor (edge case): folders already searched are never looked at again in the session.
searched (and within at L333) are only cleared at session.start. If a dbt project is created mid-session in a folder already searched (or nested in a folder already checked), its models are never attached until a new session. A brand-new project has no shares yet, so this is low impact. Clearing both sets on Refresh or /comments would cover it.
There was a problem hiding this comment.
Fixed in 8d383ec: Refresh now clears searched and within before reloading, so a project created mid-session in an already-searched folder is found after a Refresh.
There was a problem hiding this comment.
Resolved (round 3). Refresh now clears searched and within, so a project created mid-session is found after a Refresh. There's no test for it: changing Refresh back to plain load($) passes the suite. That's a test-only minor at :187.
| // A post still running, or one that may have landed, keeps its lock across the switch: only a list of its own | ||
| // project that shows it, or the cache catching up, frees it, so a retry from here or after going back cannot double it. | ||
| // The first read of this project waits for its list, as the first project's did. | ||
| firstWaitSpent = false |
There was a problem hiding this comment.
Minor (monorepo): going back and forth between projects pays the first-read wait each time.
Each switch resets firstWaitSpent and drops the loaded list (INITIAL), so reading A → B → A with a slow list waits 3 s three times, and each switch lists again. For one project the round-1 issue is fixed: in the test kit with a list that never answers, the first model read waited exactly 3,000 ms (not done at 2,999 ms), and later reads of the model and of README.md didn't wait. Keeping each project's state keyed by root would fix this; it can be a follow-up.
There was a problem hiding this comment.
Declined for this PR, as you noted: monorepo-only, and keying state per root is a larger change than the finding warrants. Tracked as a follow-up.
There was a problem hiding this comment.
Not resolved, and fine as a follow-up (minor, edge case). It's monorepo-only: one 3 s wait and one list per switch.
| // A post may have finished while this answer was being applied: the fresh list that follows it decides. | ||
| await change($, current => { | ||
| // A new session may have begun while the clock was read: its state is not written to. | ||
| if (mine !== generation) return current |
There was a problem hiding this comment.
Minor (test coverage): the generation check inside the final list updater has no test.
Replacing if (mine !== generation) return current here with if (false) leaves the PR's suite green. By code reading the behaviour is right (round-1 item 2 is fixed), but nothing guards it. A held list released after a second session.start would pin it.
There was a problem hiding this comment.
Declined: the updater check at that line only covers the window of the $.clock.now() read after the earlier mine !== generation check at the start of the same block, which has no deterministic hook in the test kit (a session start has to land inside one awaited clock read). The earlier check is covered by the existing stale-list tests.
There was a problem hiding this comment.
Not resolved, accepted (test-only). The mutation still survives, but the reason (no deterministic hook for a session start inside one awaited clock read) is fair, and the check itself is correct.
| await ui.unmount() | ||
| }) | ||
|
|
||
| test('a reply is confirmed by its own text, not by another message in the thread', () => { |
There was a problem hiding this comment.
Minor (test coverage): the "message not in the thread before" rule (comments.tsx:466) is untested.
This test calls sameText only. Mutating !pending.before.has(message.id) && sameText(...) to sameText(...) leaves the suite green. A test that catches it: the first list holds another user's Yes (id 101). A reply Yes times out and doesn't land, so the follow-up list is the same. Then expect the thread to still show Posting…. I ran that test: it passes at head and fails on the mutant. ui.input({ key: '7:11-reply', text: 'Yes', kind: 'change' }) then ui.press({ key: '7:11-send' }) types and sends in the kit.
There was a problem hiding this comment.
Fixed in 8d383ec: added 'a reply is not confirmed by a message that was already in the thread before it was sent', following your outline (another user's Yes id 101, reply Yes times out, follow-up list unchanged, thread stays Posting…).
There was a problem hiding this comment.
Resolved (round 3). The new test 'a reply is not confirmed by a message that was already in the thread before it was sent' catches the mutation that drops pending.before.
| expect(block).toContain('more open threads') | ||
| }) | ||
|
|
||
| test('the settings: the poll never runs more often than every 30 s, and commentsInContext off is honoured', () => { |
There was a problem hiding this comment.
Minor (test coverage), round-1 item still open: commentsInContext: false has no end-to-end test.
if (false && !inContext) return null at comments.tsx:277 still leaves the suite green. The kit does pass options: test(name, { options: { commentsInContext: false } }, body) (from the plugin-authoring reference: "A test gives the plugin under test its userConfig values with test(name, { options }, body)"). This test passes at head and fails on the mutant:
test('commentsInContext off keeps the threads out of Claude’s context', { options: { commentsInContext: false } }, async ($, on) => {
const { clock, cli } = await start($, on)
const r: any = await $.tool.call({ tool: 'Read', file_path: FILE })
await clock.settle()
expect(cli.filter(c => c.args.action === 'list')).toHaveLength(1)
expect(r.context ?? []).toEqual([])
})There was a problem hiding this comment.
Fixed in 8d383ec: added 'commentsInContext off keeps the threads out of Claude’s context' using test(name, { options }, body). You were right that the kit passes options; sorry for the earlier miss.
There was a problem hiding this comment.
Resolved (round 3). The new { options: { commentsInContext: false } } test catches the mutation that ignores inContext in readOrEditAfter.
|
Consensus re-review, round 2 (Claude + Codex) of f9362fb: changes requested. Scope: this PR's own change only, Open, blocking (inline):
Round-1 status:
What holds, checked by running it:
Not tied to a diff line:
Merge order: altimate-code #1730 first (the Approve-worthy: NO. Three majors are open: a double post after |
… frees the thread, and an old list frees a lock only when whole and of the same project Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…n a slow answer arrives Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
review-loop: APPROVED at 68e292a (reviewers: gpt-6-astra high, gpt-6.1-sol high) |
|
Round-2 review, point by point (head 68e292a):
|
sahrizvi
left a comment
There was a problem hiding this comment.
Consensus re-review, round 3 (Claude + Codex) of 68e292a: approve.
Panel: Claude (lead) and Codex. Codex ran its own pass first, then a cross-check of the lead's findings. Both reach APPROVE under this round's bar. The three round-2 majors are fixed, and each fix was checked against real altimate-code CLI output (main, with docs_share_comments) from a local fake backend. Removing any one of the fixes makes the PR's own tests fail.
Remaining minors, none blocking (details inline and in the combined comment):
/resumeisn't exempted the way/clearis (:226): edge case (a timed-out post, then/resume, then a retry); safe to fix in a follow-up (a one-line change).- A list that is always partial never frees an unconfirmed post's lock (
:471): edge case (a large project plus a timed-out post); nothing is posted twice or lost. - Refresh clearing the no-project folder memory is untested (
:187): test-only. - Round-2 C3 (author not matched,
:469), C5 (one lock per process,:500), C7 (A→B→A reload,:364): edge cases; the author declined them as follow-ups. - Round-2 L5 (generation check in the final updater untested,
:456): test-only. plugin.jsonstill calls both comment settings "Not used yet", but the code reads both. That's wrong wording and must be fixed before release, but it's docs only (the switch works). No CHANGELOG entry or version bump: release bookkeeping. Both are in the combined comment.
| export async function sessionEnd($: EngineInterface, e: Args<'session.end'>) { | ||
| // /clear ends a session without starting another: the pane keeps its threads and drafts, so the poll goes on | ||
| // and a post still running or unconfirmed keeps its lock (it describes the shared docs, not the conversation). | ||
| if (e.reason === 'clear') return |
There was a problem hiding this comment.
Minor (edge case): /resume takes the path /clear used to take.
In Claude Code 2.1.327, session.end treats clear and resume the same way: plugins aren't torn down for either (e !== "clear" && e !== "resume"), and the event carries { reason, sessionId, resume }. Here only clear returns early. With reason: 'resume', this handler still cancels the poll, bumps the generation, and drops uncertain and posting, while the pane keeps its drafts. So after a post that timed out, /resume followed by Reply can post the reply twice (in a kit replay with the real CLI timeout output, the retry went out). Polling also stops until the next Refresh. I couldn't check live whether a session.start follows /resume, because the isolated session stops at the login screen. Suggest if (e.reason === 'clear' || e.reason === 'resume') return. This doesn't block: it needs a network blip, then /resume, then a retry, all within about 5.5 minutes.
| // A thread missing from a partial list may only be one the list did not reach. | ||
| (pending.action === 'resolve' ? there === undefined && !partial : there?.messages.some(message => !pending.before.has(message.id) && sameText(message.text, pending.text)) === true) | ||
| // An old enough list frees the lock only when it is a whole list of the post's own project. | ||
| const freed = pending !== null && (seen || (askedAt - pending.at >= LIST_LAG_MS && !partial && current.root === pending.root)) |
There was a problem hiding this comment.
Minor (edge case): a project whose list is always partial never frees an unconfirmed post's lock.
Both ways to free a resolve need !partial: seen for a resolve, and now the age rule too. For a reply that didn't land, the age rule is the only way out. #1730 marks a list partial when there are more shares than its first page, more than 200 open threads, a thread with more than 100 messages, or more than 100,000 characters. In such a project, one timed-out post keeps posting locked for every thread and project (the lock is process-wide, :500), through /clear, until a new session or a restart. In a kit replay, every list incomplete: still locked after 96 polls (24 h) and a Refresh, with every other post refused. Nothing is posted twice or lost, and the web page still works. A middle ground: when a partial list does contain the thread, let the age rule decide for that thread. After 330 s, a reply missing from a thread that is present, or a resolve whose thread is still present, didn't land.
| </Box> | ||
| ))} | ||
| <Box> | ||
| <Button key="refresh" label="Refresh" onPress={() => later($, () => { searched.clear(); within.clear(); return load($) })} /> |
There was a problem hiding this comment.
Minor (test-only): the Refresh change that clears searched/within has no test.
With Refresh changed back to later($, () => load($)), all 55 comments tests still pass. A test could create dbt_project.yml in an already-searched folder, press Refresh, and expect the new project's list.
| pending !== null && | ||
| current.root === pending.root && | ||
| // A thread missing from a partial list may only be one the list did not reach. | ||
| (pending.action === 'resolve' ? there === undefined && !partial : there?.messages.some(message => !pending.before.has(message.id) && sameText(message.text, pending.text)) === true) |
There was a problem hiding this comment.
Minor (edge case, round-2 C3, declined as a follow-up): still open. A teammate's new message with the same text still confirms a reply that didn't land, because author isn't checked. The before set now stops an older identical message from confirming it (mutation caught by the new test). What goes wrong is a lost draft, never a double post. That's fine as a follow-up once the CLI exposes the signed-in user.
| async function post($: EngineInterface, thread: CommentsThread, args: Record<string, unknown>, done: string) { | ||
| const key = `${thread.shareId}:${thread.groupId}` | ||
| // One post at a time, and none while an earlier one may have landed and is not yet checked. | ||
| if (posting || uncertain !== null) { |
There was a problem hiding this comment.
Minor (edge case, round-2 C5, declined as a follow-up): still open. One uncertain lock for the whole process: an unconfirmed post in project A blocks posts in B. It's deliberate and safe (no double post). It's monorepo-only, so a per-project lock can wait for a follow-up.
| // A post still running, or one that may have landed, keeps its lock across the switch: only a list of its own | ||
| // project that shows it, or the cache catching up, frees it, so a retry from here or after going back cannot double it. | ||
| // The first read of this project waits for its list, as the first project's did. | ||
| firstWaitSpent = false |
There was a problem hiding this comment.
Minor (edge case, round-2 C7, declined as a follow-up): still open. Going A → B → A resets firstWaitSpent and lists again on every switch. This is monorepo-only and costs one 3 s wait and one list per switch, so it's fine as a follow-up (state keyed by root).
| // A post may have finished while this answer was being applied: the fresh list that follows it decides. | ||
| await change($, current => { | ||
| // A new session may have begun while the clock was read: its state is not written to. | ||
| if (mine !== generation) return current |
There was a problem hiding this comment.
Minor (test-only, round-2 L5, declined): still open. Removing this check still passes the suite. The author's reason, that there's no deterministic hook for a session start inside one awaited clock read, is fair. The check itself is correct, so this is a coverage note only.
|
Consensus re-review, round 3 (Claude + Codex) of 68e292a: approve. Scope: Engine: altimate-code main (with Round-2 majors: all fixed. Round-2 majors: status and checks
New rule (cache age judged when a list is asked for): correct. A list asked for at 300 s that answers at 340 s doesn't free the lock; the next list does. Using the answer time instead fails 2 tests. Dropping Round-2 minors, test items and docs: status
What holds: only open threads of the model being read reach Claude. The CLI's list output has authors by first and last name and no email anywhere. Posts use Checks at head and on main (run one after the other)
The test-fake failures seen on another branch's head in round 2 don't happen here. Not tied to a diff line:
Live check: Approve-worthy: YES. No serious defect is left that an ordinary user would hit: the three round-2 majors are fixed and each fix is guarded by tests. What remains is edge cases ( |
What
Team comments (P-14). Open comment threads from the team's shared dbt docs reach Claude when it reads or edits that model, and the person can reply or resolve from a pane.
hooks/features/comments.tsx: loads the open threads atsession.startand everycommentsPollSeconds(default 900) with$.clock.every; skipped in non-interactive runs.readOrEditAfter: when the file belongs to a model with open threads, adds one context block naming each thread's line and text. A thread is placed by searching the file forhighlightfirst, then its storedrange. Capped at 8 threads / 600 chars per message.commentsInContext: falsekeeps comments out of Claude's context./commentspane: threads by model, anInputwith Reply, and Resolve. Posting goes throughrunTool(..., { write: true })(CLI with--allow-write); Claude never posts.💬 N open team commentswith an Open button when threads exist.docs_share_commentsshows one line (newer altimate-code than 0.12.10), no retry loop.types/index.d.ts:CommentsState,CommentsThread.hooks/comments.test.tsx(thread placement, context block, read adds context, poll, resolve with write permission, old CLI, refused post).The altimate-code side (AltimateAI/altimate-code#1730) and the shared fixes are already on main; this branch has main merged in. Besides the comments feature, it changes one line in the shared
hooks/features/docs.test.tsxso that test's fake CLI ignores the newdocs_share_commentscall.Changelog line: Team comments: open threads from shared dbt docs reach Claude's context; reply or resolve from
/comments.Checks
claude plugin test ./plugins/altimate-code: 584 pass, 0 fail.bash tests/*.sh: all pass.claude plugin validate --strict .: passes.claude plugin validate --strict ./plugins/altimate-code: no warning from this change; it still fails on warnings that exist without it (missing plugin icon, TS warnings inhooks/lineage.test.tsx).Not verified: that a key stored by altimate-code (
~/.altimate/altimate.json) is accepted by the docs-share endpoints.commentsInContextis off, a/clearwith a post or list in flight blocking later ones, and a resolved thread coming back from a list asked for before the post (each with a regression test that fails without the fix); each fix was gated by a fresh reviewer./clearno longer drops the post lock or stops the poll; a check that fails before anything is sent ("Nothing was sent") no longer locks the thread; an old list frees the post lock only if it is whole, from the same project, and judged by when it was asked for; Refresh clears the folders already searched. New tests covercommentsInContext: falseend to end and a reply not yet confirmed by a message in the thread.metadata.threadsfromtool run --json, which the CLI prints (src/cli/cmd/tool.ts:236) and the demo exercises.Demo video (hosted)
P-14.mp4 — watch on Notion (Altimate workspace; recorded from the approved head of this PR).
🤖 Generated with Claude Code