Skip to content

feat: team comments from shared dbt docs in Claude's context and a /comments pane - #26

Merged
hkaltai merged 36 commits into
mainfrom
feat/team-comments
Nov 18, 2026
Merged

hkaltai merged 36 commits into
mainfrom
feat/team-comments

Conversation

@hkaltai

@hkaltai hkaltai commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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 at session.start and every commentsPollSeconds (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 for highlight first, then its stored range. Capped at 8 threads / 600 chars per message. commentsInContext: false keeps comments out of Claude's context.
  • /comments pane: threads by model, an Input with Reply, and Resolve. Posting goes through runTool(..., { write: true }) (CLI with --allow-write); Claude never posts.
  • Band line: 💬 N open team comments with an Open button when threads exist.
  • A CLI without docs_share_comments shows one line (newer altimate-code than 0.12.10), no retry loop.
  • types/index.d.ts: CommentsState, CommentsThread.
  • Tests: 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.tsx so that test's fake CLI ignores the new docs_share_comments call.

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 in hooks/lineage.test.tsx).

Not verified: that a key stored by altimate-code (~/.altimate/altimate.json) is accepted by the docs-share endpoints.

  • Peer review (claude + codex as independent reviewers): fixed a nested project never found when commentsInContext is off, a /clear with 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.
  • Review round on the latest head (each with a regression test): /clear no 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 cover commentsInContext: false end to end and a reply not yet confirmed by a message in the thread.
  • Reviewer finding rebutted: "the plugin cannot read the CLI's list output". It reads metadata.threads from tool run --json, which the CLI prints (src/cli/cmd/tool.ts:236) and the demo exercises.
  • Deferred minor points: the first read of any file waits up to 8 s while the first list is still running; the same block is added to context on every read of a commented model (capped at 6 KB each).

Demo video (hosted)

P-14.mp4 — watch on Notion (Altimate workspace; recorded from the approved head of this PR).

🤖 Generated with Claude Code

hkaltai and others added 2 commits November 13, 2026 17:01
…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>
@hkaltai

hkaltai commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Review-loop results for the P-14 commit (two independent reviewers, claude -p and codex exec; no CRITICAL; fixes in bb18134, attack-the-fix gate by a fresh claude -p: all findings resolved, remaining MINORs below). Plugin suite: 219 pass; claude plugin validate --strict . passes.

Fixed

  • [MAJOR] non-interactive runs never got comments (codex). One load, no poll.
  • [MAJOR] project only found by walking up from the session folder (both). attach() also finds it from the file being read (skips dbt_packages/node_modules, remembers folders already searched).
  • [MAJOR] first read before the first load finished missed the review (codex). The read waits up to 8 s for the load in flight.
  • [MAJOR] duplicate concurrent post (both). Synchronous module flag set before the first await; test with a held post.
  • [MAJOR] an in-flight poll suppressed the post-write refresh and could bring a resolved thread back; the "Replied."/"Resolved." note was wiped (both). Loads coalesce and re-run once the running one ends; load errors live in their own error field. The test fails with the re-run removed (checked).
  • [MAJOR] comment text in Claude's context unframed, fields could forge lines, thread size unbounded (both). Header says the text is data, never instructions; author/highlight/column/field are one-line quoted; at most 6 messages per thread and a 6000-character block budget.
  • [MINOR] placement used only the first line of a highlight / first occurrence anywhere (both). Whole highlight; one-word highlights match whole words only; the occurrence nearest the stored line wins.
  • [MAJOR/MINOR] tests: Reply with nothing typed, in-flight post, nested project, first-read wait, non-interactive, settings (readOptions: poll floor 30 s, cap one day, commentsInContext off), placement, budget; the missing-tool test now records attempts before the stub returns.
  • [MINOR/NIT] atom shape tag; lacksTool narrowed to the placeholder's own text; no hard-coded CLI version; state reset at session start (and a load from an earlier session can't write into the new one); header comment updated.

Not changed

  • "Claude never posts" is not enforced by a Bash gate (claude, 0.6): out of P-14 scope; the normal Bash permission applies and the skill tells Claude not to add --allow-write.
  • The pane shows the stored line while the context block shows the placed line: intentional, the pane shows what the commenter saw.
  • The commentsInContext: false switch is covered through readOptions; the plugin test harness has no way to set a plugin option.

hkaltai and others added 3 commits November 13, 2026 21:22
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>
@hkaltai

hkaltai commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Review round 1 (independent claude -p and codex exec reviewers), and what was done:

  • MAJOR, fixed — with commentsInContext off, a project below the session folder was never found (discovery sat behind the context switch). Discovery now runs first.
  • MAJOR, fixed — loadRun and posting were not reset at session.start, so a /clear with a list or post in flight blocked later ones; the stale-session check also covers the post and error paths. Test: "a post still running when a new session starts does not block the new session's posts" (fails without the fix).
  • MAJOR, fixed — a list asked for before a Resolve could republish the resolved thread if the follow-up refresh failed. A resolved thread now leaves the list at once, and an answer asked for before a successful post is dropped (inside the state update, after a gate finding on a smaller window). Test: "a Resolve during a poll whose follow-up list fails…" (fails without the fix).
  • MAJOR, rebutted — "the plugin cannot read the CLI's list output": it reads metadata.threads from tool run --json (altimate-code src/cli/cmd/tool.ts:236); the demo video exercises it.
  • MINOR, fixed — the Reply/Resolve test title claimed Reply coverage; renamed to Resolve. A Reply-submit test is not added (the harness has no way to type into the Input).
  • MINOR, deferred — first read of any file waits up to 8 s while the first list runs; the context block repeats on each read of a commented model (capped); lacksTool regex breadth; a dbt_project.yml without a readable name: shows no explanation.

@hkaltai
hkaltai marked this pull request as ready for review November 14, 2026 03:42
@hkaltai

hkaltai commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

review-loop: APPROVED at af487e2

@kilo-code-bot

kilo-code-bot Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: 3 Issues Found | Recommendation: Merge after follow-ups

Incremental review of 8d383ec..68e292a (1 commit, 2 files, +21/-2). The delta was read in full and no new defect was found in it; the three items below are carried from the previous review and re-verified at this head.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 3
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/.claude-plugin/plugin.json 47, 54 Carried, re-verified: both descriptions still read "Not used yet: team comments aren't in this version", and README.md:139 still says "None is used yet", while readOptions (hooks/features/comments.tsx:85) reads both settings and this PR ships the feature. 5b86ba7 reverted the earlier wording fix, so these files are no longer in the PR diff and the finding is summary-only.
plugins/altimate-code/hooks/comments.test.tsx 714 Carried, re-verified: "the first read of a second project waits for that project's list" still passes with the firstWaitSpent = false reset removed from attach. start() settles list 0, so the read of FILE finds loadedAt !== null and never spends the wait; only /other's read waits, and that happens with or without the reset. Holding list 0 and reading a model before the switch would pin it (author acknowledged, not changed).
plugins/altimate-code/hooks/comments.test.tsx 627 Carried, partly addressed: the negative case (a message already in the thread does not confirm a reply) is pinned at line 486, but the positive consumer path in fetchThreads — seen true for a reply, then freed, posting: null, and the draft cleared (comments.tsx:471-483) — still has no test. A wrong key or a dropped draft clear would not fail any test.
Files Reviewed (4 files)
  • plugins/altimate-code/hooks/features/comments.tsx - no new issues. askedAt (:425) is captured before the CLI call and used for both until and the age check (:471), so a list is judged by when it was asked for, not when a slow answer arrives; the failure direction is safe (lock held longer, never freed early), askedAt - pending.at is negative for lists asked before the post, and the next poll or Refresh still frees it. until: askedAt + LIST_TIMEOUT_MS is unchanged in value.
  • plugins/altimate-code/hooks/comments.test.tsx - new test at 469 is a genuine regression test: it asks for the list at +295 s and releases it at +335 s (5 s inside the 45 s CLI deadline), so now - pending.at ≥ 330 s frees the lock on the previous head while askedAt - pending.at = 295 s keeps it here. Not a duplicate of the poll test at 506, which covers a list asked before the post. 2 carried issues above.
  • plugins/altimate-code/hooks/features/docs.test.tsx, plugins/altimate-code/types/index.d.ts - untouched by this delta; no new findings.
  • plugins/altimate-code/.claude-plugin/plugin.json, plugins/altimate-code/README.md - targeted docs check only (carried finding above; no longer in the PR diff).

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

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 3
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/.claude-plugin/plugin.json 47, 54 Carried, re-verified: both settings still read "Not used yet: team comments aren't in this version", and README.md:139 still says "None is used yet", while readOptions (hooks/features/comments.tsx:85) reads both and this PR ships the feature. 5b86ba7 reverted the earlier wording fix, so these files are no longer in the PR diff and the finding is summary-only.
plugins/altimate-code/hooks/comments.test.tsx 697 Carried, re-verified: "the first read of a second project waits for that project's list" still passes with the firstWaitSpent = false reset removed from attach. start() settles list 0, so the read of FILE finds loadedAt !== null and never spends the wait; only /other's read waits, and that happens with or without the reset. Holding list 0 and reading a model before the switch would pin it.
plugins/altimate-code/hooks/comments.test.tsx 610 Carried, partly addressed: the negative case (a message already in the thread does not confirm a reply) is now pinned at line 469, but the positive consumer path in fetchThreads — seen true for a reply, then freed, posting: null, and the draft cleared (comments.tsx:467-480) — still has no test. A wrong key or a dropped draft clear would not fail any test.
Files Reviewed (4 files)
  • plugins/altimate-code/hooks/features/comments.tsx - no new issues (/clear is a no-op in sessionEnd; freed requires !partial and the post's own root; the Nothing was sent fallback runs only in the !sent branch)
  • plugins/altimate-code/hooks/comments.test.tsx - 2 issues (carried, test coverage)
  • plugins/altimate-code/hooks/features/docs.test.tsx - no issues (the comments tool is excluded from the docs test's CLI stub)
  • plugins/altimate-code/types/index.d.ts - no issues (partial is nullable and falsy when absent; Shaped<CommentsState | null> matches the other persisted views)
  • plugins/altimate-code/.claude-plugin/plugin.json, plugins/altimate-code/README.md - targeted docs check only (carried finding above)
  • hooks/inert-features.ts, hooks/features/index.test.ts, hooks/features/sql-graph.test.tsx, hooks/task-impact.test.tsx - targeted check: the suite-breakage warning from the previous review is resolved at this head

Incremental review of f9362fb..8d383ec (1 feature commit plus the origin/main merge; the PR diff against base is 4 files). The delta was read in full and no new defect was found in it.

Checked in the delta and found correct:

  • sessionEnd returning early for reason === 'clear': no session.start follows a clear in this engine, so keeping poll, generation, posting and uncertain is consistent; a real session.start still resets them, which the merge test at 523 exercises.
  • The new /clear tests at 405, 419 and 432 each fail on the previous head: the old sessionEnd cleared posting/uncertain (buttons reappear, a second post goes out) and cancelled the poll (1 list instead of 3).
  • freed = seen || (now - pending.at >= LIST_LAG_MS && !partial && current.root === pending.root): the partial-list test (455) and the extended cross-project test (563) pin both new guards; the age branch cannot fire before the cache window, and seen still requires the post's own root.
  • Nothing was sent fallback: out.text is always a string from runTool (altimate-cli.ts:191), the check sits only in the !sent branch, and the existing timeout/throw paths keep the lock. The text match is coupled to the CLI's wording; a named refusal code remains the cleaner follow-up the author already noted.
  • Refresh clearing searched and within: both caches are lookup accelerators only, so clearing them is always safe.

Reviewed statically (read-only run: no test suite executed; the failures above were traced from the harness, e.g. sessionEnd old body clearing state posting).

Fix these issues in Kilo Cloud

Previous review (commit f9362fb)

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 3
Issue Details (click to expand)

WARNING

File Line Issue
plugins/altimate-code/hooks/features/comments.tsx 213 Carried, unchanged since the last review: the session-start list still breaks three suites this branch does not fix (hooks/features/index.test.ts:57 — the bare engine has no $.session, so $.session.cwd() throws and expect(logs).toEqual([]) cannot pass; hooks/features/sql-graph.test.tsx — no docs_share_comments exclusion, so the list shifts toHaveLength(1)/(0) and holdFirst's nth === 1; hooks/task-impact.test.tsx — the list falls into the impact branch and expect(dialogs).toEqual([0]) becomes [1]). The author's reply is that these files are shared and the accommodations land with PR #34; that makes this a merge-order dependency, so restore the three guards or land #34 first. The delta itself is clean here: comments.test.tsx now records only its own tool, so it is green either way.

SUGGESTION

File Line Issue
plugins/altimate-code/.claude-plugin/plugin.json 47 Carried, re-verified: commentsPollSeconds (47) and commentsInContext (54) still say "Not used yet: team comments aren't in this version", and README.md:139 says "None is used yet", but readOptions (hooks/features/comments.tsx:85) reads both and this PR ships the feature.
plugins/altimate-code/hooks/comments.test.tsx 629 Carried, re-verified: the per-project first-read test still passes with the firstWaitSpent = false reset in attach removed — start() settles list 0, so the read of FILE finds loadedAt !== null and never spends the wait, and only /other's read waits. Holding list 0 and reading a model before the switch would pin it.
plugins/altimate-code/hooks/comments.test.tsx 534 Carried: only sameText is tested; the consumer path in fetchThreads (seen/freed, posting: null, clearing the draft when the reply is in) has no test, so a wrong key or an inverted action check would not fail anything.
Files Reviewed (5 files)
  • plugins/altimate-code/hooks/features/comments.tsx - 1 issue (carried)
  • plugins/altimate-code/hooks/comments.test.tsx - 2 issues (carried)
  • plugins/altimate-code/types/index.d.ts - no issues (partial added to CommentsState and INITIAL consistently; an old persisted state renders nothing for it)
  • plugins/altimate-code/.claude-plugin/plugin.json - 1 issue (carried)
  • plugins/altimate-code/README.md - same docs issue as plugin.json
  • hooks/features/index.test.ts, hooks/features/sql-graph.test.tsx, hooks/task-impact.test.tsx - targeted check only, for the carried suite finding

Incremental review of 5b86ba7..f9362fb (5 commits, 3 files, 128+/16-). The delta was read in full and traced statically: no new defects found in it.

Checked in the delta and found correct:

  • projectOf(dir, stop): the stop check precedes the dbt_project.yml check, so a project nested below the loaded root is found and the loaded root itself never becomes "nested" (the dir === known early return also covers that); the walk still cannot escape above known.
  • within: written only when mine === generation, cleared in sessionStart, keyed per loaded project, so a switch back re-walks instead of trusting a stale entry.
  • open no longer re-attaches: an existing root keeps the pane's project; a null root still walks from $.session.cwd().
  • startPoll extraction and the restart on a successful list: the poll === null check is synchronous (no double poll), interactive still gates it, and the success path is behind the generation/writes guard so /clear cannot resurrect a poll.
  • partial (incomplete/truncated): a resolve is no longer confirmed by absence from a partial list, and LIST_LAG_MS still frees it, so the lock cannot hang; a reply is still confirmed only by presence of a new matching message, which a partial list cannot fake.
  • placeThread whitespace regex: every part is escaped, the pattern cannot be zero-length, lastIndex = at + 1 keeps the old overlapping-match behavior, and the 500-match cap and the \w boundary check are preserved.
  • REFUSALS additions and the new tests: each of the five new tests fails on the previous head, so they pin their fixes.
  • types/index.d.ts: partial is nullable and the pane treats a missing value as falsy.

Reviewed statically (read-only run: no test suite executed; each failure above was traced from the harness code, e.g. featuresSessionStart($, {}) → (e as {cwd?}).cwd ?? $.session.cwd() on a stub with no $.session).

Fix these issues in Kilo Cloud

Previous review (commit 5b86ba7)

Status: 7 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 4
SUGGESTION 3
Issue Details (click to expand)

WARNING

File Line Issue
plugins/altimate-code/hooks/features/comments.tsx 208 The session-start load now runs in three existing suites whose docs_share_comments accommodations commit 5b86ba7 reverted; all three fail (details in the inline comment)
plugins/altimate-code/hooks/features/sql-graph.test.tsx 57 The comments list is recorded as a sql-graph CLI call: expect(cli).toHaveLength(1) (171) / (0) (283, 308) and cli[0] (172-174, 289-290) shift, and holdFirst's nth === 1 holds the comments list instead of the graph ask (320, 338)
plugins/altimate-code/hooks/task-impact.test.tsx 147 Without the docs_share_comments stub the list falls into the impact branch, impactBody pushes it into tools, and expect(dialogs).toEqual([0]) (413) becomes [1]
plugins/altimate-code/hooks/features/index.test.ts 57 expect(logs).toEqual([]) cannot pass: the bare engine has no $.session, so the real comments sessionStart throws and attempt logs comments · sessionStart failed: …

SUGGESTION

File Line Issue
plugins/altimate-code/.claude-plugin/plugin.json 47 Previous, re-broken: commentsPollSeconds (47) and commentsInContext (54) say "team comments aren't in this version" and README.md:139 says "None is used yet", but readOptions (hooks/features/comments.tsx:82) reads both and this PR ships the feature
plugins/altimate-code/hooks/comments.test.tsx 533 Previous, still present: only sameText is tested; the consumer path (comments.tsx:444, the before id baseline) has no test, so a wrong key or an inverted check would not fail anything
plugins/altimate-code/hooks/comments.test.tsx 628 Previous, still present: passes with the per-project firstWaitSpent reset removed, because start() settles list 0 and the read of FILE never spends the wait
Files Reviewed (10 files)
  • plugins/altimate-code/hooks/features/comments.tsx - 1 issue (inline)
  • plugins/altimate-code/hooks/features/sql-graph.test.tsx - 1 issue
  • plugins/altimate-code/hooks/task-impact.test.tsx - 1 issue
  • plugins/altimate-code/hooks/features/index.test.ts - 1 issue
  • plugins/altimate-code/hooks/features/index.ts - no new issues (feature registry)
  • plugins/altimate-code/hooks/comments.test.tsx - 2 carried suggestions
  • plugins/altimate-code/hooks/integrations.tsx - no new issues (session.start wiring)
  • plugins/altimate-code/hooks/altimate-cli.ts - no new issues (runTool argv / later)
  • plugins/altimate-code/.claude-plugin/plugin.json - 1 issue
  • plugins/altimate-code/README.md - 1 issue (same as plugin.json)

Incremental review of 72c401a..5b86ba7 (one commit, 5 files, 6+/10-). The delta only reverts shared test/docs accommodations to main's content, but the real comments feature stays registered, so the reverted guards are now needed. The comments.tsx logic itself is unchanged since the previous review.

Reviewed statically (read-only run: no test suite executed; each failure above was traced from the harness code, e.g. runTool -> process.run(['altimate','tool','run','docs_share_comments',…]) and later -> $.clock.after).

Fix these issues in Kilo Cloud

Previous review (commit 72c401a)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/comments.test.tsx 533 Previous, still present: only the sameText helper is tested. The consumer path is unchanged in coverage but has grown: the new before set check at comments.tsx:444 (a reply is confirmed only by a message whose id was not in the thread at post time) has no test at all, so a wrong key or an inverted !pending.before.has(...) would not fail anything
plugins/altimate-code/hooks/comments.test.tsx 628 Previous, still present: this test still passes with the per-project firstWaitSpent reset removed. start() settles list 0, so the read of FILE finds loadedAt !== null and never spends the wait; the read of /other therefore waits on the reset it is meant to pin, and no test fails if the reset is deleted
Files Reviewed (1 file)
  • plugins/altimate-code/hooks/features/comments.tsx — no new issues. The delta adds a per-post before: Set<number> baseline and requires a verifying message's id to be absent from it (line 444); both uncertain writes record it, toThread guarantees messages[].id is a number, and the added generation check before writing the lock in the !sent and catch branches is consistent with the existing release() guard. The previous Yes/older-message confirmation WARNING is fixed at this head. Remaining risk (a reply with the same text as a genuinely new teammate message, or a stale pane snapshot supplying the baseline) is inherent to text matching and not introduced here.

Incremental review of 80054d37..72c401a (PR commit 21, one file, 9+/4-). The two suggestions above are carried forward from the previous review after a targeted check; no inline comments were added because there are no new defects on the changed lines and the test-file findings have active comments.

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

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
plugins/altimate-code/hooks/features/comments.tsx 574 New: the exact-match fix still confirms a timed-out reply against any message already in the thread, so an older identical Yes/+1 frees the lock and wipes the draft for a reply that never landed (it also allows a double post after the free)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/comments.test.tsx 533 Previous, still present: only the sameText helper is tested; its consumer (comments.tsx:439-457, seen/freed/note/draft clear) is untested, so a wrong key or swapped action would not fail anything
plugins/altimate-code/hooks/comments.test.tsx 628 Previous, still present: this test passes with the per-project firstWaitSpent reset removed — list 0 settles inside start(), so the wait is never spent in the first project before the switch
Files Reviewed (3 files)
  • plugins/altimate-code/hooks/features/comments.tsx — 1 new WARNING. The delta's claims hold: sameText now requires the whole text for replies up to 200 chars (prefix only for longer, service-cut texts), and the unconfirmed-post note is a constant that a freeing list clears along with the lock. load()'s let run! rework is behaviourally identical. The earlier prefix WARNING and the stale-note SUGGESTION are fixed at this head.
  • plugins/altimate-code/hooks/comments.test.tsx — 2 previous SUGGESTIONs still present. The added assertions pin sameText's exact/prefix split but not its consumer.
  • plugins/altimate-code/hooks/features/sql-graph.test.tsx — no issues; the one-line guard just ignores the comments tool in the sibling harness.

Incremental review of 416f82aa..80054d37 (PR commits 18–20). The rest of git diff 416f82aa..HEAD is a rebase onto newer main (dbt-command.ts, features/index.ts, sql-graph.tsx) and was not re-analyzed; plugin.json, README.md and types/index.d.ts are outside this delta and only checked for carry-forward.

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

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 3
Issue Details (click to expand)

WARNING

File Line Issue
plugins/altimate-code/hooks/features/comments.tsx 569 New: sameText confirms a reply by prefix against every message already in the thread, so a failed short reply ("Yes") is "confirmed" by an older teammate message starting the same way; fetchThreads then frees the lock and clears the person's draft

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/features/comments.tsx 473 Previous, still present: the guard's "An earlier post is not confirmed yet: press Refresh first." note replaces LOCKED_NOTE, and the free path only clears notes ending with LOCKED_NOTE, so it outlives the lock — and with this delta a Refresh cannot free the thread before LIST_LAG_MS, so its advice is now wrong as well
plugins/altimate-code/hooks/comments.test.tsx 533 New: only the sameText helper is tested; its consumer (comments.tsx:438-453, seen/freed/cleared draft) is untested, so a wrong key or swapped action would not fail anything
plugins/altimate-code/hooks/comments.test.tsx 622 Previous, still present: this test passes with firstWaitSpent = false removed — list 0 already settles inside start(), so the first read never spends the wait; spending it in the first project before the switch would make it a regression test
Files Reviewed (2 files)
  • plugins/altimate-code/hooks/features/comments.tsx — 1 new WARNING + 1 previous SUGGESTION. The delta's claims hold: uncertain now records its project/action/text/time, a project switch no longer clears it, a list frees it only when a resolve's thread is absent or a reply's text is listed, or after the 330 s cache lag; a successful resolve is hidden locally until the cache catches up. The earlier warnings (global lock cleared by a switch, catch writing before the project check, dropped press with no note) are fixed at this head.
  • plugins/altimate-code/hooks/comments.test.tsx — 1 new SUGGESTION + 1 previous SUGGESTION. The new tests for the switch-held lock, the silent-note-in-the-new-project path, the lag-based free and the locally hidden resolve fail on the 51fe838 code, so they pin the fixes.

Incremental review of 51fe838..416f82a (2 files, 96+/31−). types/index.d.ts, README.md and plugin.json are not in this delta and were only checked for carry-forward.

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

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
plugins/altimate-code/hooks/features/comments.tsx 449 New: the guard's "An earlier post is not confirmed yet: press Refresh first." note replaces LOCKED_NOTE, and the free path only clears notes ending with LOCKED_NOTE, so a successful verification list/poll frees the thread but leaves that instruction on screen next to working buttons
plugins/altimate-code/hooks/comments.test.tsx 589 New: the "first read of a second project waits" test passes with firstWaitSpent = false removed — the first read here never spends the wait (loadedAt is already set), and clock.settle() after release() runs the 3 s timer, so it cannot distinguish a joined list from the timeout
Files Reviewed (4 files)
  • plugins/altimate-code/hooks/features/comments.tsx — 1 issue (new, line 449); the four previously reported WARNINGs (switch clearing posting, epoch-vs-project, catch writing before the project check, silent drop for unrelated threads) are fixed at this head
  • plugins/altimate-code/hooks/comments.test.tsx — 1 issue (new, line 589); the harness duplication findings are resolved by answer()/timedOut, and the holdPost test now pins the lock across a switch
  • plugins/altimate-code/README.md — no issues (line 139 now names the two active settings and the three unused ones)
  • plugins/altimate-code/.claude-plugin/plugin.json — no issues (the commentsPollSeconds / commentsInContext descriptions no longer say "Not used yet")

Incremental review of aa7918b..51fe838 (4 files, 102+/30−). The claimed fixes hold: post project-awareness now compares the post's project root with the one in view (so A → B → A keeps its uncertainty), the catch

[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>
hkaltai and others added 3 commits November 17, 2026 06:30
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>
Comment thread plugins/altimate-code/README.md Resolved

@sahrizvi sahrizvi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 }))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Yes does 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:

  • /clear drops 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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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($))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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($)))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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', () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@sahrizvi

Copy link
Copy Markdown
Collaborator

Consensus review (Claude + Codex): changes requested.

Scope: this PR's own change only, git diff 4c8add5238..03179fc535 (merge base with #30's head 2c494ecceb). The branch is missing one foundation commit, 2c494ec (expanded assignment ahead of a prefix word / throwing deadline or logger). The foundation's own findings are not repeated here.

What holds, checked by running it:

  • Context: only open threads of the model being read reach Claude. Using recorded real output from the altimate-code #1730 CLI against a local fake service, a resolved thread and a thread on another model stayed out, authors are display names (no email; the user list never reaches context), and a newline inside a message stays on one line. Caps: 8 threads, 600 characters per message, 6 messages per thread and a 6000-character block, each caught by a mutation.
  • Posting: Reply/Resolve use --allow-write (a mutation to write: false is caught). The reply text reaches the service verbatim, including $(…), backticks and quotes, as one argv JSON value, with no shell. Without --allow-write the CLI refuses with read_only.
  • CLI without the tool: one line, no loop. 401 / 404 / timeout: one error line in the pane, no context.
  • Placement: CRLF, a multi-line highlight, duplicates (nearest the stored line), a highlight that's gone (falls back to the stored range) and an empty file all place without crashing.
  • Outside the feature: the task-impact.tsx change only merges two imports; the test changes only make room for the real feature. Main's behaviour is unchanged.
  • Suites, head vs merge base: claude plugin validate and --strict (plugin and root) pass on both. claude plugin test: 369 pass at head, 349 at base, 0 fail. tests/*.sh: all 7 pass on both. pytest: 65 pass on both. The type check (the engine's recommended compiler options) is clean on both.

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:

  • Minor — no CHANGELOG entry or version bump. A user-visible feature (the /comments pane, the band, the context block, two new settings) leaves CHANGELOG.md without a mention of comments and the version at 1.6.1, the same as main.
  • Nit — "Claude never posts" (comments.tsx:8) overstates it. The plugin gives Claude no path of its own, but altimate tool run docs_share_comments … --allow-write through Bash remains possible once the person approves that Bash call. The bashGate stub is null and the skill's "only after a yes" rule is the only guard, and teammates' text is now in front of the model.
  • Nit — the 3 s wait sits inside the shared 5 s readOrEditAfter phase before cost/health/sqlGraph/docs/cteProfile. Those are stubs today, but once they do work, running out of the remaining 2 s drops every feature's context for that call.
  • Nit — tsconfig.json extends ./.claude-plugin/types/tsconfig.json, which the engine writes when the mod loads. It isn't committed and isn't in .gitignore, so tsc -p plugins/altimate-code fails in a fresh clone (TS5083), and the generated folder shows up as untracked files that could be committed by accident.

Merge order: altimate-code #1730 first (the plugin needs its docs_share_comments tool), then #30, then this PR after rebasing onto #30's head.

hkaltai and others added 2 commits November 17, 2026 13:51
…oject, reload uncertain posts, match package models by unique id

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@hkaltai

hkaltai commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

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 tsconfig.json generated-types nit, and the shared 5 s phase note, which only matters once the other features stop being stubs. Merge order noted.

Comment thread plugins/altimate-code/README.md Resolved
hkaltai and others added 2 commits November 17, 2026 14:05
…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>
hkaltai and others added 4 commits November 17, 2026 21:03
…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>
hkaltai and others added 2 commits November 17, 2026 21:19
…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>
hkaltai and others added 5 commits November 18, 2026 07:02
…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>
@hkaltai

hkaltai commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@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 sahrizvi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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', () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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…).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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', () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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([])
})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved (round 3). The new { options: { commentsInContext: false } } test catches the mutation that ignores inContext in readOrEditAfter.

@sahrizvi

Copy link
Copy Markdown
Collaborator

Consensus re-review, round 2 (Claude + Codex) of f9362fb: changes requested.

Scope: this PR's own change only, git diff e10448ca66..f9362fba5d (main is the merge base, now that #30 has merged). Three files: hooks/features/comments.tsx, hooks/comments.test.tsx and the comments section of types/index.d.ts. No other shared plugin file differs from main. The engine is altimate-code #1730 at 253e29afae, built from source and run against a local fake backend (the real service was never called). Its real outputs for list, the 401 refusal, a list timeout, a reply timeout and a failed pre-post check were replayed through the PR's test kit.

Open, blocking (inline):

  1. After a post that timed out, /clear drops the lock, so pressing Reply again posts twice. /clear fires no session.start in this engine, so the pane keeps the draft. (comments.tsx:233)
  2. A pre-post check failure that the CLI reports as "Nothing was sent" locks the thread for about 5.5 minutes, even after a successful Refresh. (comments.tsx:528)
  3. After /clear the poll never runs again, so Claude's context and the band stay frozen at the /clear moment. (comments.tsx:224)

Round-1 status:

Round-1 item Status at f9362fb
1. First-read wait on every read Fixed: one 3,000 ms wait, first model read only (monorepo switch resets it: minor)
2. Stale list overwrites a new session Fixed by code; no test guards it (minor)
3. Second dbt project never loaded Fixed (mutation fails 9 tests)
4. Timed-out post, retry posts twice Partly: ordinary case fixed; /clear and pre-check failure still open (majors 1 and 2)
5. Threads matched by path only Fixed for packages; moved model is a documented follow-up
6. First list requested twice Fixed
7. Poll continues after 401/404 Fixed; restart after a working Refresh tested
8. commentsInContext: false end-to-end test Open (minor): the kit supports { options }; test code inline
9. CHANGELOG and version Open (minor, below)
Nit: "Claude never posts" Open (nit, below)
Nit: 3 s wait in the shared 5 s phase Acknowledged in the comment at L31; fine while the other features are stubs
Nit: tsconfig.json extends a generated file No longer this PR's: the file is on main, not in this diff

What holds, checked by running it:

  • Context: only open threads of the model being read reach Claude. With a real list, a resolved thread and a package model's thread at the same path stayed out. Authors are first and last names, or user N for someone without a name, and no email appears anywhere in the CLI's list output. The caps (8 threads, 600 characters per message, 6000-character block) and the write-permission post are each caught by a mutation. With commentsInContext: false (set through the kit's options), a commented model gets no context block.
  • Partial lists: #1730's incomplete and truncated both mark the pane's list as partial, and a partial list doesn't confirm a resolve.
  • Suites: at head vs main, claude plugin validate and --strict (plugin and repo root) pass on both. tests/*.sh (7) all pass on both. pytest: 65 pass on both. tsc with the engine's recommended options is clean on both. claude plugin test: main 402 pass and 0 fail; head 443 pass and 7 fail (re-run alone, same 7); head with fix: shared fixes so the dbt Power User feature PRs merge in any order #34 merged 454 pass and 0 fail.

Not tied to a diff line:

  • Minor: merged alone, this PR turns main's plugin suite red. Seven tests fail in shared files: features/index.test.ts (the comments sessionStart throws on a fake $ without session.cwd), five sql-graph.test.tsx tests and one task-impact.test.tsx test (an extra process.run or ui.status call). These are test fakes, and fix: shared fixes so the dbt Power User feature PRs merge in any order #34 fixes all seven, so fix: shared fixes so the dbt Power User feature PRs merge in any order #34 must merge first.
  • Minor: plugin.json still says both comment settings are "Not used yet: team comments aren't in this version." The earlier fix (51fe838) was reverted by 5b86ba7, and fix: shared fixes so the dbt Power User feature PRs merge in any order #34 doesn't touch plugin.json. So with this PR merged, the settings menu tells people comments aren't used, while comment text does go into Claude's context unless commentsInContext is off. It doesn't bypass the setting, but the wording should be fixed before release.
  • Minor: no CHANGELOG entry or version bump (1.7.0, as on main). Deferring this to the release PR is fine.
  • Nit: "Claude never posts" (comments.tsx:8) still overstates it. altimate tool run docs_share_comments … --allow-write through Bash is possible once the person approves that call (bashGate returns null).

Merge order: altimate-code #1730 first (the docs_share_comments tool), then #34 (shared test fixes), then this PR.

Approve-worthy: NO. Three majors are open: a double post after /clear, a lock of about 5.5 minutes after a post the CLI says was not sent, and polling that stops for good after /clear.

hkaltai and others added 3 commits November 18, 2026 13:33
… 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>
@hkaltai

hkaltai commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

review-loop: APPROVED at 68e292a (reviewers: gpt-6-astra high, gpt-6.1-sol high)

@hkaltai

hkaltai commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Round-2 review, point by point (head 68e292a):

  1. /clear drops the post lock: fixed, session.end with reason clear is a no-op now (inline reply).
  2. Pre-post check failure locks the thread: fixed, "Nothing was sent" is treated as a refusal (inline reply).
  3. Poll never restarts after /clear: fixed with the same change.
  4. Minors: partial or other-project list freeing the lock fixed (and the cache age is now judged when a list is asked for); folders searched are cleared on Refresh; the three test-coverage points: commentsInContext and the pre-existing-message test are added, the updater generation check is declined (no deterministic hook). Declined as follow-ups: author match, per-project lock, per-project state.
  5. plugin.json wording and CHANGELOG/version: these are shared files that come from main for this PR, so they are left for the release PR; the owner will take them there.
  6. 'Claude never posts' wording at comments.tsx:8: reworded to say the plugin gives Claude no way to post.
  7. Merged-alone test failures: main now has the shared test fixes; one more shared fake (docs.test.tsx recording the new tool call) needed a one-line filter, included here.

@sahrizvi sahrizvi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):

  • /resume isn't exempted the way /clear is (: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.json still 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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($) })} />

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sahrizvi

Copy link
Copy Markdown
Collaborator

Consensus re-review, round 3 (Claude + Codex) of 68e292a: approve.

Scope: git diff 100897ce7a..68e292a305, where main is the merge base. Four files: hooks/features/comments.tsx, hooks/comments.test.tsx, the comments types in types/index.d.ts, and a one-line filter in hooks/features/docs.test.tsx. New since round 2: 8d383ec and 68e292a. The merge of main (4951626) is clean: features/index.ts, plugin.json, the README, the CHANGELOG and the other shared tests are identical to main. The only shared-file edit is the docs.test.tsx filter, which keeps the docs test's fake CLI from recording this feature's calls.

Engine: altimate-code main (with docs_share_comments), built from source in a separate worktree and run against a local fake backend; the real service was never called. Recorded real outputs: a list, a list after a reply landed, a reply timeout ("may already have been posted", with the reply stored on the backend), and a failed pre-post check ("Could not check the thread: … timed out after 15 s. Nothing was sent.", with nothing stored). These were replayed through the plugin's test kit against the real feature code.

Round-2 majors: all fixed.

Round-2 majors: status and checks

Round-2 major Status at 68e292a Check
A timed-out post, then /clear, then a retry posts twice Fixed Real timeout output, then /clear: the Reply button stays hidden and 1 reply goes out. Once a list shows the reply, the lock frees and the draft clears. Without the /clear early return, 4 tests fail (2 of the PR's, 2 replays)
"Nothing was sent" locks the thread for about 5.5 minutes Fixed Real pre-check failure output: the thread is free at once and the note shows the CLI's text. Without the regex, 2 tests fail. The phrase can't appear in a failure after a post was attempted: the CLI's HTTP errors are only "failed with status N", "timed out after N s" or "could not be sent", and never include a response body
Polling stops for good after /clear Fixed After /clear the poll keeps running, and a later Read puts the newer thread in Claude's context

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 !partial or the same-project check from the expiry fails 1 test each.

Round-2 minors, test items and docs: status

Round-2 item Status Edge case or real
C2: expiry freed on a partial list or another project's list Fixed (mutations caught). The stricter rule causes the new minor at :471 Edge case
C3: identical teammate message confirms a reply Open, declined as a follow-up Edge case (lost draft, never a double post)
C5: one lock per process Open, declined as a follow-up Edge case (monorepo)
C6: no-project folder memory never cleared Fixed (Refresh clears it); untested, see :187 Edge case
C7: A→B→A repeats the wait and the list Open, declined as a follow-up Edge case (monorepo)
L3: merged alone, shared tests failed Fixed: main has the shared fixes; 584 pass, 0 fail —
L4: "not in the thread before" untested Fixed (mutation now caught) —
L5: generation check in the final updater untested Open, declined Test-only
L6: commentsInContext: false end-to-end test Fixed (mutation now caught) —
L2: plugin.json "Not used yet" Open, see below Real, docs only
L7: CHANGELOG and version Open, deferred to the release PR Release bookkeeping
N1: "Claude never posts" Fixed (reworded at :8) —

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 --allow-write through the CLI only.

Checks at head and on main (run one after the other)

Check head 68e292a main 100897c
claude plugin validate, plain and --strict (plugin and repo root) pass pass
claude plugin test plugins/altimate-code 584 pass, 0 fail 529 pass, 0 fail
tests/*.sh (7) all pass all pass
pytest 65 passed 65 passed

The test-fake failures seen on another branch's head in round 2 don't happen here.

Not tied to a diff line:

  • Minor: plugin.json still says "Not used yet: team comments aren't in this version." on commentsPollSeconds and commentsInContext. At this head the code reads both: readOptions (comments.tsx:85) is applied at :95, inContext gates the only context path at :278, and pollSeconds drives the poll at :379. So the wording is wrong once this merges. It doesn't block: the switch works as its name says, and a user acting on the text loses nothing and posts nothing. A user reading it might wrongly think comment text never reaches Claude, though, so it needs fixing before release. The author has handed this to the release PR.
  • Minor: no CHANGELOG entry or version bump. Fine to defer to the release PR.

Live check: claude --plugin-dir with an isolated HOME and config folder, in a 200-column tmux session, stopped at the login-method screen. I don't log in, so no turns ran. The real-CLI replays above stand in for it.

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 (/resume, always-partial lists, C3, C5, C7), test gaps (Refresh, L5) and docs or release items (plugin.json wording, CHANGELOG).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants