Repository navigation
Chat works out what a person is asking and answers that question first - #791
Merged
Merged
Conversation
A newcomer who asked what could be useful to someone in his role got the "what's waiting on you" list, in the fixed shape that list's lookup put on every answer, with an unchecked claim that Jira wasn't connected. A question that linked a pull request comment got the canned "found nothing" line, because every uncited answer was replaced by it. - common::chat_intent reads the question with the last answer: the intent (orientation, capability, what needs me, status, how-to, lookup, judgement, correction, small talk), the role the person says they hold, and what a correction disputes. It decides only what code used to force on every answer. - chat_understand prepares a question the same way in production and in the evals: tool order, notes, and where the answer must look (an orientation looks the setup up; a correction checks the disputed point again). - coderhelm_setup: what Coderhelm is set up to do for the team, checked when called (GitHub, Jira through common::jira_connection, connected apps, repositories, knowledge bases, 30 days of runs, records), plus what Coderhelm does. A failed check is named as that check. - The "what needs me" list keeps its shape only for that question; an uncited answer looks once with its tools; small talk may go uncited; a pull request link is read as the pull request. - The prompt gains "Understand the question first" and "Check before you claim". - Replay evals (49 cases: 8 from real conversations, made anonymous, and variants of every intent) graded by a model judge; incident case cu_chat_answers_the_question.
…asked again instead of failing the answer CHAT_EVAL_BEDROCK=1 runs the replay with the shell's AWS credentials, the way a hosted install calls Claude. The judge gets room for its whole verdict and the full text of what Chat read, and a case it never graded is marked as not judged rather than counted as a failure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Chat now works out what a person is asking before it answers, answers that question first, and makes no claim about connections, counts or state that a check in the same answer doesn't support.
A first question such as "what could be useful to me" got a "what's waiting on you" list, in the fixed shape that list's lookup imposed on every answer, with a claim that Jira wasn't connected. A question with a pull request comment link got the canned "found nothing" line. The causes were in code, not in one prompt line:
work_needs_meand told the model to answer "in the shape its result gives" (brain.rsCHAT_SYSTEM, line 1326). There was no step to work out what was asked, and no guidance for an orientation, a correction or small talk.chat_work_needs.rs:1174,:1252). The must-look nudge repeated it (chat_agent.rs:138).common/src/knowledge/answer.rs:242). That covered greetings, questions about Coderhelm itself, and judgements whose evidence wasn't looked up.chat_hints.rs:21), so a question about a PR comment never reached the PR.Changes
common::chat_intent: reads the question and the last answer. It works out the intent (orientation, capability, what needs me, status, how-to, lookup, judgement, correction, small talk), the role the person says they hold, and, for a correction, the sentences of the last answer they question. It decides only what code used to force on every answer: the fixed list shape (only for "what needs me"), whether an uncited reply may stand (only small talk), and how the answer is sized. The model gets the reading as a note it checks against the question.chat_understand: one place where production (brain::answer) and the evals prepare a question. It orders the tools, writes the notes, and decides where the answer must look. An orientation must callcoderhelm_setup. A correction must check the disputed point again: the setup when it is about a connection, any lookup otherwise.coderhelm_setup(chat_setup): what Coderhelm is set up to do for the team, checked when it is called. It covers GitHub (installation and token), Jira (the sharedcommon::jira_connectiontest from Chat never says Jira isn't connected when it is; the Jira app's links heal themselves #786), connected apps and sign-ins, repositories, knowledge bases, the last 30 days of runs counted by outcome (chat_work_runs::tally), and reviews, findings, alerts and quarantined tests counted as the asker may see them. It also covers what Chat can read and what it can't do, plus what Coderhelm does, each item with a question to ask. A failed check is named as that check, never as "not connected". The lookup is read-only and registered with the permission gate.chat_work_needs::render_for/NOT_THE_LIST: the list keeps its shape only for its own question. For any other question, the result says to use only the items that answer it.chat_agent: an answer that cites nothing looks once with its tools (cite_something) before the no-source line replaces it.finalize_replykeeps an uncited reply only for small talk. The must-look note no longer forces the list's shape.chat_hints: a GitHub pull request link gives its number, repository and whether it points at a comment. The note says comments themselves aren't readable, so the answer judges the claim from the PR's checks and runs.CHAT_SYSTEM: new "Understand the question first" and "Check before you claim" sections cover intent, role, answering first, sizing, orientations, corrections and failed checks. The "what needs me" rule now applies only when that is the question.chat_eval_replayandchat_eval_cases.jsonhold 49 cases. 8 are modelled on real question shapes, written for the made-up marina team. 41 are variants covering every intent; every intent has at least 4 cases. Each case runs through the real loop and is prepared as production prepares it. A model judge grades it once against a five-point rubric. Offline tests replay the incident with a scripted model.cu_chat_answers_the_question, with its page.Verification
Replay eval on Bedrock (claude-sonnet-5-5 answers and judges), 49 cases, main and branch run one after the other with the same cases, fixture and judge. Two full runs; every case was judged on both sides in both.
Still weak on the branch: claims checked (about half the answers state something the judge can't find in what Chat read, most often what Chat itself can or can't do), length on orientation questions, and the four "what needs me" cases (0 of 4 on both sides). Those are the next change, not this one.
Run it with
CHAT_EVAL_BEDROCK=1and AWS credentials (orCHAT_EVAL_API_KEY):Gates, run locally as CI runs them:
cargo fmt --check --allrustfmt --check --edition 2021 worker/src/passes/incidents/*.rscargo clippy --workspace --all-targets -- -D warningscargo test --workspace --no-fail-fastThe new tests:
chat_intent(6),chat_understand(5),chat_setup(3),chat_eval_replay(6 offline: every case reads as its intent, the incident replayed with a scripted model before and after, a correction checks again, small talk stands, an uncited answer looks once, the judge's input),chat_work_runstally,chat_hintspull request links,finalize_reply, and the incident casecu_chat_answers_the_question(3).