Skip to content

feat(feedback): thumbs up/down on answers (MCP + chat) with an answer_log table - #1162

Open
northdpole wants to merge 46 commits into
feat/ingest-comprehensionfrom
feat/answer-feedback
Open

northdpole wants to merge 46 commits into
feat/ingest-comprehensionfrom
feat/answer-feedback

Conversation

@northdpole

Copy link
Copy Markdown
Collaborator

Adds thumbs up/down on answers so staging can collect labelled data.

  • answer_log table (+ migration d1e2f3a4b5c6, which joins the two existing heads) and recording of ratings.
  • MCP: ask returns an answer_id; new rate_answer tool.
  • Chat: completion returns answer_id; POST /rest/v1/answer_feedback; GET /admin/feedback. Chat answers are logged only when a deployment opts in (ANSWER_LOG_CHAT=1).
  • Chat UI: thumbs under answers, storage notice when answers are logged, and the "not stored" privacy paragraph is hidden when answers are stored.
  • Test: alembic_single_head_test fails when the migration chain has more than one head.

Stacked on #1158 (order: #1142, #1155, #1159, #1158, this). Needs the migration run and ANSWER_LOG_CHAT=1 set on staging. ask now writes one row per question, so this should be deployed after measurement runs.

Tested: answer_feedback_test, alembic_single_head_test, mcp_ask_test pass; Black clean. Frontend tests run in CI.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review: 1
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • 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

Comment @coderabbitai help to get the list of available commands.

@northdpole
northdpole force-pushed the feat/answer-feedback branch 2 times, most recently from b40939d to 957841c Compare October 20, 2026 08:51
@northdpole
northdpole force-pushed the feat/ingest-comprehension branch from c306180 to 6b2c573 Compare October 20, 2026 09:21
@northdpole
northdpole force-pushed the feat/answer-feedback branch 14 times, most recently from 76307f2 to dc9eb78 Compare October 21, 2026 20:05
@northdpole
northdpole force-pushed the feat/ingest-comprehension branch from b6ded96 to 0a34ae0 Compare October 21, 2026 21:09
@northdpole
northdpole force-pushed the feat/answer-feedback branch from dc9eb78 to c672c15 Compare October 21, 2026 21:09
@northdpole
northdpole force-pushed the feat/ingest-comprehension branch from 0a34ae0 to a6573ed Compare October 21, 2026 23:09
@northdpole
northdpole force-pushed the feat/answer-feedback branch 2 times, most recently from 2556722 to 6acc47d Compare October 22, 2026 01:29
@northdpole
northdpole force-pushed the feat/ingest-comprehension branch from c4b23d4 to 594e1d0 Compare October 22, 2026 07:59
@northdpole
northdpole force-pushed the feat/answer-feedback branch 2 times, most recently from 640e7c4 to f082dd3 Compare October 22, 2026 11:09
@northdpole
northdpole marked this pull request as ready for review October 22, 2026 11:17
northdpole and others added 9 commits October 25, 2026 10:31
…turn probe

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…messages (background, not a question); rewrite stays for retrieval

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…list; ungrounded free-form answers are replaced by an honest refusal (manual-test items 11 and 15)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…box (off by default) replaces New chat

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…PROJECTS (3 best projects each contribute sources)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…x capped results at 40)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…t chunks to the candidate pool

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…h in the references instead of reordering sources

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@northdpole
northdpole force-pushed the feat/ingest-comprehension branch from 5406406 to 4c92743 Compare October 25, 2026 10:35
@northdpole
northdpole force-pushed the feat/answer-feedback branch from 7c49a5d to 7335acc Compare October 25, 2026 10:35
northdpole and others added 9 commits October 25, 2026 10:49
… default)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ast question and answer

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…t references)

The OWASP agent answers bypassed the CRE lookup, so control questions no longer showed
their closest CRE. route_question now adds it to the references and citations.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… so [n] stays the only link form

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…es in citation URLs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… Related before child-of on CRE pages

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… the shown near-ties

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…file path, show 2 CREs and at most 5 resources

- paths.py: is_asset_path (image/asset-folder READMEs, vendored gems, site scaffolding) is dropped at ingestion;
  low-value paths (old versions, tests, changelogs) rank slightly lower and cite last
- answers cite at most OWASP_MAX_RESOURCES=5 resources; featured projects only fill spare slots
- closest CREs: 2 (was 3)
- scripts/prune_noise_chunks.py removes already-indexed noise chunks (dry run by default)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
northdpole and others added 5 commits October 30, 2026 14:06
NO_LOGIN=0 is a truthy string, so staging (NO_LOGIN=0) got a random per-process
secret key. Any worker restart invalidated session cookies, losing the OAuth
state and sending beta testers back to /auth/login in a loop. Only NO_LOGIN=1
now randomizes the key, and SECRET_KEY is preferred over GOOGLE_CLIENT_SECRET.

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

The singleton held the pending state in process memory, so concurrent logins
overwrote each other and a callback on another worker saw no state and looped.
State now comes from the user's session cookie.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The per-login flow built in the callback had no code_verifier, so Google
rejected the token exchange (invalid_grant) and the callback returned 500.
Store the verifier in the session at login and pass it to fetch_token.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
/auth/user was gated by login_required (admin). Signed-in users with only the
user role got 403, the SPA read that as anonymous and sent them back through
login in a loop. It only reports who is signed in, so user_required fits.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Named admins may sign in from outside LOGIN_ALLOWED_DOMAINS; /rest/v1/auth/*,
/me and /my-api-keys are never browser-cached; /auth/callback no longer 500s on a
replayed code, a consent denial or a missing state; chatbot redirects to login
only on 401. (MCP half lives on feat/ext-integration.)

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

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.

1 participant