Skip to content

fix(contracts): stop false bright founder pill on standing bots - #207

Open
nullStack65 wants to merge 3 commits into
release/native-0.1.10from
fix/bot-attention-no-false-founder-pill
Open

nullStack65 wants to merge 3 commits into
release/native-0.1.10from
fix/bot-attention-no-false-founder-pill

Conversation

@nullStack65

Copy link
Copy Markdown
Owner

Problem

PR Reviewer showed a bright Kameron · Jeff pill with assignee: null, pendingRequestCount: 0 and no decisionRequest. The mention scan read @kameron/@jeff out of code blocks, inline code, quoted logs and address-like text, and applied to agent-only threads too.

Change

In packages/contracts/src/botAttention.ts:

  • resolveBotAttention never badges an agent-only thread on a name; only a real decisionRequest (or joint sign-off) does.
  • mentionedFounders ignores fenced code (including unterminated fences), inline code and > quoted lines, and requires the @ not to follow a word/email character. Explicit @Name pings in prose still badge, including on shared FYI threads.
  • The server (attentionMentionsFromText) and chatActivity share this function, so they stay consistent; no caller changes.

Scope

Requested by Kameron (2026-11-24 22:42 ET escalation). Existing tests that expected an agent-only inbox to badge on a mention now use a shared inbox.

Verification

  • packages/contracts: full suite 247 passed, including new tests for agent-only (no pill / pill with decisionRequest) and shared FYI (incidental code, inline code, emails, quoted logs → dot; explicit ping or decisionRequest → pill). Typecheck: 0 errors.
  • apps/server HumanNote.test.ts passed (3 tests).
  • Could not run apps/web sidebar tests: the runner fails with ERR_UNKNOWN_FILE_EXTENSION in this environment; no web test references this module.

Deploy: fleet

Model: claude-sonnet-5-5
Task: bot-attention-false-founder-pill

🤖 Generated with Claude Code

Agent-only threads never badge on a founder name, and code, quoted lines
and addresses no longer count as an @-mention.

Model: claude-sonnet-5-5
Task: bot-attention-false-founder-pill
Agent: claude-code-implementation-subagent
Harness: Claude Code

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

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@nullStack65

Copy link
Copy Markdown
Owner Author
{
  "reviewed_head": "4f5eeb3c075cf7f6069c6ae320b48409c6723cc7",
  "reviewer": "gemini-4-neon, antigravity",
  "findings": [
    {
      "id": "F1",
      "severity": "nit",
      "summary": "NON_PING_TEXT inline-code branch (`[^`\\n]*`) matches empty `` pairs around multi-backtick spans (e.g. ``@kameron`` or ``use `x` @jeff``), leaking mentions inside double-backtick inline code.",
      "outcome": "open"
    },
    {
      "id": "F2",
      "severity": "nit",
      "summary": "NON_PING_TEXT fence branch captures only 3 chars (```|~~~) and allows trailing text on closing fences ([^\\n]*$), so 4+ backtick fences wrapping 3-backtick blocks close early and single-line ```@kameron``` at line start swallows following lines.",
      "outcome": "open"
    }
  ]
}

Cross-family PR Review (4f5eeb3c075cf7f6069c6ae320b48409c6723cc7)

Verdict: Approve with 2 non-blocking nits (do not merge — release freeze until Nov 25 22:00 UTC).

  • Verified:
    • resolveBotAttention (packages/contracts/src/botAttention.ts:81-89) suppresses mention badges for audience: "agent-only" regardless of mentioned or latestText, while preserving decisionRequest badges and joint sign-off pills.
    • mentionedFounders strips 3-backtick and ~~~ fenced blocks (including unterminated fences, CRLF, and indented fences), single-backtick inline code, > / >> quoted lines, and email/word-prefixed @ addresses ((?<![\w.+-])), while preserving explicit @Name pings in prose (including punctuation like (@kameron), [@Jeff]!, **@kameron**, @Jeff's, and on shared + FYI threads).
    • Server (ProjectionStore.ts), client-runtime (chatActivity.ts), and web (SidebarBotsGroup.tsx) callers share mentionedFounders/attentionMentionsFromText/resolveBotAttention consistently with no caller changes needed.
  • Checks run locally (detached worktree at 4f5eeb3c075cf7f6069c6ae320b48409c6723cc7):
    • packages/contracts: vp test run — 39 test files, 247 passed.
    • packages/contracts: vp run typecheck — exited 0 (0 errors).
  • Non-blocking nits:
    • F1 (nit): Multi-backtick inline code spans ( @Kameron , use x @jeff ) match as empty spans and leak the inner `@mention`. Matching (`+)[^\n]*?\1 `` fixes this.
    • F2 (nit): 4+ char fences wrapping 3-char fences (e.g. md ```` containing ```) close early on the inner fence because `(```|~~~)` captures 3 chars and `[^\n]$` allows trailing non-whitespace on the closing line; similarly, a line starting with ```@kameron``` is matched as an unterminated fence and swallows subsequent lines. Matching `(`{3,}|~{3,})` with `[ \t]$` on the closing fence (and disallowing backticks in backtick-fence info strings) handles both.

…r pings

The shell read @-mentions from the latest message of any kind, so an incoming
user message or agent-to-agent digest that merely discussed founder mentions
lit the founder pill on the recipient bot. The SQL and in-memory shell paths
now take the latest assistant message or founder note only.

Also fix two markdown-scanner nits in the mention scanner: multi-backtick
code spans close on a run of equal length, and a fence closes only on at
least as many fence characters, so a one-line triple-backtick span no
longer swallows the rest of the message.

Model: claude-sonnet-5-5
Task: fix
Agent: claude-code

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

Copy link
Copy Markdown
Owner Author
{
  "reviewed_head": "8114f452ec61b12956f87505f1c534ad0932dc32",
  "reviewer": "gemini-4-neon, antigravity",
  "findings": [
    {
      "id": "F1",
      "severity": "nit",
      "summary": "NON_PING_TEXT inline-code branch (`[^`\\n]*`) matches empty `` pairs around multi-backtick spans (e.g. ``@kameron`` or ``use `x` @jeff``), leaking mentions inside double-backtick inline code.",
      "outcome": "fixed",
      "rechecked_head": "8114f452ec61b12956f87505f1c534ad0932dc32"
    },
    {
      "id": "F2",
      "severity": "nit",
      "summary": "NON_PING_TEXT fence branch captures only 3 chars (```|~~~) and allows trailing text on closing fences ([^\\n]*$), so 4+ backtick fences wrapping 3-backtick blocks close early and single-line ```@kameron``` at line start swallows following lines.",
      "outcome": "fixed",
      "rechecked_head": "8114f452ec61b12956f87505f1c534ad0932dc32"
    },
    {
      "id": "F3",
      "severity": "important",
      "summary": "apps/server/src/orchestration-v2/ProjectionStore.ts:1782 types isFounderPingSource with `humanNote?: boolean` instead of `humanNote?: boolean | undefined`, failing `apps/server` typecheck under `exactOptionalPropertyTypes: true` (TS2379 at line 1877).",
      "outcome": "open"
    }
  ]
}

Cross-family PR Re-check (4f5eeb3c075c..8114f452ec61, head 8114f452ec61b12956f87505f1c534ad0932dc32)

Verdict: Request changes (1 blocking important typecheck failure — F3; F1 and F2 confirmed fixed; do not merge — release freeze until Nov 25 22:00 UTC).

  • Verified fixed:
    • F1 (nit -> fixed): packages/contracts/src/botAttention.ts now matches N-backtick inline code spans with (?<!)(+)(?!)[^\n]*?(?<!)\3(?!), with regression tests in packages/contracts/src/botAttention.test.ts`.
    • F2 (nit -> fixed): packages/contracts/src/botAttention.ts now enforces CommonMark fence rules (3+ backticks with no backticks in info string, 3+ tildes, closing on >= N matching fence chars with trailing [ \t]*$ only, unterminated fence to EOF). Verified on LF, CRLF, nested fences, cross-char fences, and backtracking stress tests (<1 ms).
    • ProjectionStore SQL vs in-memory runtime parity: Both SQL (message.role = 'assistant' OR json_extract(message.payload_json, '$.humanNote') = 1) and in-memory (isFounderPingSource) exclude incoming user messages and agent-to-agent digests while keeping assistant replies and founder humanNote: true notes.
  • Blocking finding:
    • F3 (important, open): In apps/server/src/orchestration-v2/ProjectionStore.ts:1782, isFounderPingSource takes { readonly role: string; readonly humanNote?: boolean }. Under exactOptionalPropertyTypes: true, passing OrchestrationV2Message (whose humanNote is boolean | undefined) fails apps/server vp run typecheck:
      src/orchestration-v2/ProjectionStore.ts(1877,91): error TS2379: Argument of type '...' is not assignable to parameter of type '{ readonly role: string; readonly humanNote?: boolean; }' with 'exactOptionalPropertyTypes: true'.
      Fix: widen to readonly humanNote?: boolean | undefined.
  • Checks run locally (detached worktree at 8114f452ec61b12956f87505f1c534ad0932dc32, removed after):
    • packages/contracts: vp test run src/botAttention.test.ts — PASS (1 file, 15/15 passed)
    • packages/contracts: vp run typecheck — PASS (exit 0)
    • apps/server: vp run typecheck — FAIL (exit 2, 1 error: TS2379 at src/orchestration-v2/ProjectionStore.ts(1877,91))
    • apps/server: vp test run src/orchestration-v2/HumanNote.test.ts — PASS (3/3 passed)
    • apps/server: vp test run src/orchestration-v2/ProjectionStore.test.ts -t "shells read founder @-mentions only from assistant replies and founder notes" — PASS (1/1 passed)

…ptionalPropertyTypes)

Fixes F3 (TS2379) on PR #207 under exactOptionalPropertyTypes: true.

Model: gemini-4-neon
Task: bot-attention-false-founder-pill
Agent: cto-thread
Harness: t3/antigravity
Model-family: gemini
Model-generation: 4
@nullStack65

Copy link
Copy Markdown
Owner Author
{
  "reviewed_head": "e562c3cf9a2a328e8a8e59e86fcd35fd66158058",
  "reviewer": "claude-sonnet-5-5, claude-code",
  "findings": [
    {
      "id": "F1",
      "severity": "nit",
      "summary": "NON_PING_TEXT inline-code branch (`[^`\\n]*`) matches empty `` pairs around multi-backtick spans (e.g. ``@kameron`` or ``use `x` @jeff``), leaking mentions inside double-backtick inline code.",
      "outcome": "fixed",
      "rechecked_head": "8114f452ec61b12956f87505f1c534ad0932dc32"
    },
    {
      "id": "F2",
      "severity": "nit",
      "summary": "NON_PING_TEXT fence branch captures only 3 chars (```|~~~) and allows trailing text on closing fences ([^\\n]*$), so 4+ backtick fences wrapping 3-backtick blocks close early and single-line ```@kameron``` at line start swallows following lines.",
      "outcome": "fixed",
      "rechecked_head": "8114f452ec61b12956f87505f1c534ad0932dc32"
    },
    {
      "id": "F3",
      "severity": "important",
      "summary": "apps/server/src/orchestration-v2/ProjectionStore.ts:1782 types isFounderPingSource with `humanNote?: boolean` instead of `humanNote?: boolean | undefined`, failing `apps/server` typecheck under `exactOptionalPropertyTypes: true` (TS2379 at line 1877).",
      "outcome": "confirmed",
      "rechecked_head": "e562c3cf9a2a328e8a8e59e86fcd35fd66158058"
    }
  ]
}

Cross-family PR Re-check (8114f452ec61..e562c3cf9a2a, head e562c3cf9a2a328e8a8e59e86fcd35fd66158058)

Verdict: F3 confirmed fixed. F1 and F2 stay fixed (code untouched by this delta). Nothing blocking remains from this review. Do not merge: release freeze until Nov 25 22:00 UTC.

  • Delta (1 hunk, apps/server/src/orchestration-v2/ProjectionStore.ts, authored by gemini-4-neon): isFounderPingSource parameter type is now { readonly role: string; readonly humanNote?: boolean | undefined }. The body is unchanged. This is the widening that F3 asked for.
  • Checks run locally (detached worktree at e562c3cf9a2a328e8a8e59e86fcd35fd66158058, removed after):
    • apps/server: vp run typecheck returned exit 0 with 0 error TS lines, including no TS2379. Only pre-existing effect-lint suggestions were printed.

This branch has not been deployed

No deployments
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