Skip to content

feat(planning): a Discussion under each question - #8402

Merged
kyle-sexton merged 8 commits into
mainfrom
feat/shared-discussion
Oct 19, 2026
Merged

kyle-sexton merged 8 commits into
mainfrom
feat/shared-discussion

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: PR 4 of the shared interview question-screen spec (follow-up item 10 from the live dogfood rounds); the spec lives in the owner's local working notes.

Summary

People had nowhere to talk about one question except the session-wide chat, so side threads about a question got lost. Each question now has its own Discussion.

Fix

  • A Discussion section under each question, folded below the Claude section, with an "N new" count; the owner can hide a comment, and hidden comments stay hidden.
  • "@claude" in a comment creates a request through the same path as Ask Claude, so it waits on Run like any guest request and gets no owner queue notice (its Inbox item covers it).
  • Schema v5 with a v4 to v5 migration; the shared lane's digest gains the Discussion fields, documented in lane-shared.md.

Verification

  • Shared Python tests: 932 OK.
  • ui.test.sh: exit 0. align.test.sh: PASS 482/482.
  • interview-defenses.test.sh: 172 pass, 0 fail, no digest re-pin.
  • check-changelog-fragments.sh --check: all fragments valid.
  • Migration rehearsed in memory on a copy of the live session's state (v3 to v5): every count unchanged, only the new keys added, schema check ok.
  • Left out: the Windows run, which CI's pr-test-windows covers.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 7 commits October 19, 2026 01:58
Item 10 of the shared interview follow-ups. Each question gets a
Discussion below its Claude section, folded by default; its head reads
"Discussion", the comment count and "N new" for this person, meaning
others' comments since they last opened it. Opening it marks it read on
the server (discussionSeen), so the count follows the person across
devices. Anyone who may write adds a plain-text comment with mentions;
its author edits or deletes it, nobody else can; the owner hides any, and
a hidden comment then shows only to the owner and its author, marked
Hidden. Comments take the chat's emoji reactions.

"@claude" in a new comment also files an ask request on the question
with its text, owner-gated like any guest request; the owner's own runs
at once (the host-skip rule). The comment reads "Sent to Claude" with
the request's status, and the request's card and Claude's answer in the
Claude section link back with "from Discussion". The composer says
"Type @claude to send it to Claude." People already in a Discussion get a
rolled-up "discussion" notification; mentions notify as before.

The round-sent digest lists each question's comments under
`discussion` (text, by with digestNames, edited, askedClaude), hidden
ones left out, the newest 50 at most.

Routes /api/discussion, /edit, /delete, /hide (owner), /react and /read
each go through _write_as with its own one-a-second throttle and write
nothing when nothing would change.

schemaVersion 4 -> 5: migrate.py adds empty discussions and
discussionSeen and changes nothing else. core.js reloads on version 5.

Tests: TestDiscussion in test_server, the v4 -> v5 migration test,
state-v5.json, and ui_discussion.js (folded default, N new and clearing
on open, edit/delete own only, owner hide, reactions, @claude hint,
request and from Discussion links, 390 fit).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@claude matches Claude only

Review fixes for the per-question Discussion:

- Editing a hidden comment notifies no mention, so no notice carries an
  excerpt of hidden text.
- The question cap (200) and session cap (2000) count only comments
  everyone sees (not hidden, author active), so the owner's Hide makes
  room. A new per-person cap, MAX_MY_COMMENTS = 30 per question (as
  MAX_MY_NOTES for prototype notes), counts that person's hidden comments
  too, so hiding gives a flooder no room back (409 too-many-comments).
- An @claude comment past the waiting-request cap still posts, without a
  request, answering requestRefused: too-many-pending with a message the
  page shows.
- "@claude" is matched after mention tokenization, so it never files a
  request when it names a participant called Claude.

Left as is: a discussion notice's rolled-up count still counts a comment
the owner later hid, and deleted comments leave gaps in D ids.

Tests: four TestDiscussion cases that failed before these fixes, and the
waiting-cap path in ui_discussion.js.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…what each reader sees

- The state schema no longer caps a question's stored comments at 200: hidden
  ones do not count toward MAX_COMMENTS, so a 201st was stored and the next
  load failed state-invalid. The server's caps bound growth.
- @claude in a comment shares /api/request's one-a-second limit; refused,
  the comment still posts with requestRefused.
- A comment that filed a request cannot be edited (409 sent-to-claude);
  hiding one whose request still waits declines it, as the owner's Decline.
- Posting marks the Discussion read for its author only when no one else's
  comment is unread to them; a read stops at the newest comment the reader
  can see; hidden comments name no removed person in the snapshot.
- The digest cuts each comment to 500 characters and lists at most 30000
  comment characters, counting the rest in discussionMore.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tatus to others

A viewer who sees neither the request nor its answer reads "Sent to Claude"
with no status instead of "Waiting for the host".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 19, 2026 06:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T06:41:36.574532Z d6450c4 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d6450c4b0d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/planning/shared/web/app.js Resolved
Comment thread plugins/planning/shared/web/app.js Resolved
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 034df34532cfc8feda139fb8912f824d70f39c0a: 0 finding(s), 0 as inline comments.

No security issues in the incremental change (034df34, since d6450c4), which touches plugins/planning/shared/web/app.js and plugins/planning/shared/tests/ui_discussion.js.

  • Per-question comment drafts: these live in an in-memory Map keyed by question id. The draft is restored by assigning discTa.value, which does not parse HTML, so there is no injection surface. The draft never leaves the page unless the user posts it.
  • Post handler: Core.comment(qid, text) uses the qid captured at submit time. A draft typed on one question cannot be posted under another, and the textarea is cleared only if the user is still on that question.
  • Delete visibility: the k.acts.hidden change only decides whether the action row shows when the Delete button is visible. It adds no capability and changes no request. Whether a user may delete a comment is still decided by the server, which this diff does not touch. The user-facing effect is that the author of a hidden, sent-to-Claude comment still sees Delete.
  • Tests: ui_discussion.js is test-only. It uses synthetic fixture strings and holds no secrets or transcripts.
  • Instruction surfaces: the diff deletes or softens no standing instruction, so the instruction-surface lens does not apply.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 034df34532cfc8feda139fb8912f824d70f39c0a: 0 finding(s), 0 as inline comments.

I found nothing to report in the incremental change since d6450c4 (plugins/planning/shared/web/app.js and plugins/planning/shared/tests/ui_discussion.js). I read both diffs and the surrounding code and ran nothing, so the UI tests and the author's verification numbers are unconfirmed.

  • Per-question draft (app.js): ui.discDrafts is saved on each input event and on question switch, and restored on arrival. The post handler deletes the draft for the question that was posted. It clears the box only if the user is still on that question. A user who switched away mid-post therefore keeps the box for the question they are now on. A failed post leaves the draft in place.
  • Delete visibility (app.js): k.acts.hidden now also checks k.del.hidden. k.del.hidden is assigned just above that line, so a comment's author whose only visible action is Delete (a hidden comment already sent to Claude) no longer loses the action bar.
  • Tests (ui_discussion.js): the new cases cover the draft staying with Q1, Post on Q2 not sending Q1's draft, and the author deleting their own hidden @Claude comment. They would fail if either app.js fix were reverted. They lean on fixed waitForTimeout delays, but that is a flakiness risk and not a defect.

The PR describes no closing issue (it states "No related issue") and no acceptance criteria apply. The PR context text contained no embedded instructions.

…en comment keeps Delete

- The comment box keeps one draft per question, saved and restored on
  select, so switching questions (by hand or by Follow) never posts one
  question's text under another; a post that lands after a switch clears
  only its own question's draft.
- The comment's actions row counts Delete, so the author of a hidden
  comment that went to Claude (no React, no Edit, no Hide) can still
  delete it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

1 participant