← Back to Pull requests

feat: comment add starts your thread or appends to your open one (#1690) #1700

Open
unknown opened this pull request with 432 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 05, 2026 14:47 UTC
Author

What

hadron comment add <node> --body "…" becomes its own command (it was an alias of create): one call that leaves the caller's feedback on a node whether or not they already hold an open thread there. This is the shed-step command of tasks:trim-context-clear-and-recover step 1, so it has to always work.

Refs #1690 (S1 of hadron-server#3493). Gate: Xylon CHECKED T2 + scoped §10 every head (6660642630); spec FIT COMPLIANT, Vera (6660453375).

Behavior (as the issue specifies)

  • One createComment. Accepted -> started (this includes a resolved earlier thread).

  • Refused with the first GraphQL error's extensions.code = COMMENT_OPEN_THREAD_EXISTS and a non-empty string extensions.threadId T -> exactly one replyToComment(T), replied. Typed code only, never message text (api.OpenThreadConflictID).

  • Anything else (other code, conflict as a later error, threadId missing/empty/non-string, malformed response, transport error, 5xx — a 5xx envelope is excluded the way cli#1495 excludes it) is returned unchanged with its exit code: no reply, no retry.

  • Body is read once (--body - consumes stdin once); both calls send the same bytes. Shared resolveBody keeps create's validation byte-identical.

  • Reply path folds --quote / --anchor-revision into the reply body as a Markdown blockquote (composedQuote: true); on the start path they are sent as create sends them.

  • Reply refused after the conflict: the reply's exit code and server code; the message names thread T and --json error.extensions.threadId carries it.

  • Output: started thread <id> / replied to your open thread <id>, then the comment; --json {outcome, threadId, composedQuote, comment}.

  • comment create is unchanged (still exit 5, no reply) apart from its help dropping the alias and pointing to add. No server change.
  • Evidence

  • Red first at 529da96f: the pins run the compiled binary against a stateful fake that holds threads (conflict only while an OPEN thread exists; reply to a deleted thread refused; a reply never reopens). Red for the right reasons (no reply sent, no started/replied line, no composedQuote).

  • Green at the head: make lint 0 issues, go test ./... all ok, make generate clean, make coverage-matrix-check in sync, make help-inventory-check clean (one new comment add row, create loses its alias).

  • Mutants seen to FAIL (not build failures): drop the 5xx guard, scan all errors for the conflict instead of the first, accept an empty threadId, don't compose the quote, don't name the thread, threadId = reply id, drop the envelope threadId.

  • Hadron review checklist walked: an-empty-flag-is-not-an-absent-flag (all usage refusals precede the first call), enumerate-the-paths (every return between custody and discharge is a pin), help-text-matches-changed-behaviour (create/group/agentic-usage/plan doc swept), assert-the-value-the-user-gets (exit codes read from the real process), stable-json-dto, map-new-server-error-codes (all codes already mapped). The rest: not applicable.
  • Limits

    Fake transport only. No real-provider conflict/race proof here: that is the QA seat's bounded leg (or its reuse map) per the stamp. No server change, no release claim (rides the next tag).

    Worker: Joshua (cli-engineer) <https://hadronmemory.com/app/u/hrn:worker:hadronmemory.com:hadron-dev-team:joshua>

    🤖 Generated with Claude Code

    Diff: 432 lines (+324 / -108) across 5 files Reviewer: claude[bot] Review duration: 2m
    All Vouch review confidence checks passed
    Residual risk 0.36 = Change Risk (0.45) × (1 − Review Confidence (0.19)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 432 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 25% · Reviewer familiarity: 35%
    19%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.363
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #1700"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 19.4% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.2% (MEDIUM) · Higher = larger blast radius
    45.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 19.4% · Lower = rushed or shallow review
    19.4%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 36.4% · Moderate risk
    36.4%