Skip to content

fix: set QA latch on user_message path#7424

Merged
Jasonnnz merged 1 commit into
feature/qa-video-automationfrom
swarm/qa-rel-1
Feb 24, 2026
Merged

fix: set QA latch on user_message path#7424
Jasonnnz merged 1 commit into
feature/qa-video-automationfrom
swarm/qa-rel-1

Conversation

@Jasonnnz
Copy link
Copy Markdown
Contributor

@Jasonnnz Jasonnnz commented Feb 24, 2026

Summary

  • Adds detectQaIntent / detectQaOptOut checks to handleUserMessage in sessions.ts so the QA latch is set/cleared when users send regular chat messages (not just task_submit)
  • Previously, typing "help me test Slack typing" as a user_message would not activate QA mode for subsequent CU escalations
  • Adds test coverage for QA latch behavior via the user_message path

Test plan

  • bun test src/__tests__/qa-latch-user-message.test.ts — 6 tests pass
  • bunx tsc --noEmit — no new type errors (pre-existing errors in unrelated files only)
  • Manual: send a QA-intent message via chat (e.g. "help me test Slack typing"), verify latch is active when agent escalates to CU
  • Manual: send "stop qa mode" to verify latch clears

🤖 Generated with Claude Code


Open with Devin

The QA latch was only set in handleTaskSubmit and wireEscalationHandler,
so user messages sent via the user_message path (handleUserMessage in
sessions.ts) never detected QA intent. This meant if a user typed
"help me test Slack typing" as a regular chat message, the latch would
not be active when the agent later escalated to CU.

Add detectQaIntent/detectQaOptOut checks to handleUserMessage so the
latch is set/cleared before the message is processed, ensuring
subsequent CU escalations correctly inherit QA mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Jasonnnz Jasonnnz merged commit e9fddf2 into feature/qa-video-automation Feb 24, 2026
@Jasonnnz Jasonnnz deleted the swarm/qa-rel-1 branch February 24, 2026 01:43
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

Copy link
Copy Markdown

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

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: 24f1fc1379

ℹ️ 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 on lines +64 to +69
const messageContent = msg.content ?? '';
if (messageContent) {
if (detectQaOptOut(messageContent)) {
clearQaLatch(msg.sessionId);
} else if (detectQaIntent(messageContent)) {
setQaLatch(msg.sessionId);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Defer QA latch updates until message is accepted

Updating the latch here mutates conversation state before the message is actually accepted, but this handler can still return early on secret blocking (checkIngressForSecrets) or queue rejection (result.rejected). In those cases a rejected user_message containing QA/opt-out phrases still sets or clears the latch, so later unrelated escalations in the same session can incorrectly flip qaMode/requiresRecording even though the triggering message never ran.

Useful? React with 👍 / 👎.

Jasonnnz pushed a commit that referenced this pull request Feb 24, 2026
Move QA intent/opt-out detection in handleUserMessage to after the
secret-ingress and queue-rejection checks. Previously, the latch was
mutated before those guards, so a message blocked by checkIngressForSecrets
or rejected by enqueueMessage would still flip the QA latch — causing
incorrect qaMode/requiresRecording state for subsequent escalations.

Also adds two contract tests documenting the invariant that rejected and
blocked messages must not mutate the latch.

Addresses review feedback from #7424.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Jasonnnz added a commit that referenced this pull request Feb 24, 2026
Move QA intent/opt-out detection in handleUserMessage to after the
secret-ingress and queue-rejection checks. Previously, the latch was
mutated before those guards, so a message blocked by checkIngressForSecrets
or rejected by enqueueMessage would still flip the QA latch — causing
incorrect qaMode/requiresRecording state for subsequent escalations.

Also adds two contract tests documenting the invariant that rejected and
blocked messages must not mutate the latch.

Addresses review feedback from #7424.

Co-authored-by: Vellum Assistant <assistant@vellum.ai>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@Jasonnnz
Copy link
Copy Markdown
Contributor Author

Addressed in #7459

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