Skip to content

fix: route AgentSession @mentions with global regex - #19

Merged
calltelemetry-jason merged 1 commit into
masterfrom
fix/issue-16-agent-session-mention-routing
Jul 27, 2026
Merged

fix: route AgentSession @mentions with global regex#19
calltelemetry-jason merged 1 commit into
masterfrom
fix/issue-16-agent-session-mention-routing

Conversation

@calltelemetry-jason

@calltelemetry-jason calltelemetry-jason commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #16

Summary

  • route AgentSession.created and AgentSession.prompted from the first full @mention, which works with the production global regex
  • make malformed or missing aliases a safe no-op
  • add global-regex single-mention regression coverage for both session paths

Validation

  • npx vitest run src/pipeline/webhook.test.ts --reporter=dot
  • npx vitest run src/infra/shared-profiles.test.ts --reporter=verbose
  • npm run typecheck
  • npm run build

npm test was attempted but the pre-existing suite invokes git from a non-repository directory in this environment; CI is the authoritative whole-suite result.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b51d4bad-3d95-443f-bbe6-650c1c086684

📥 Commits

Reviewing files that changed from the base of the PR and between f6a2977 and 6ab9b01.

⛔ Files ignored due to path filters (2)
  • dist/src/infra/shared-profiles.js is excluded by !**/dist/**
  • dist/src/pipeline/webhook.js is excluded by !**/dist/**
📒 Files selected for processing (4)
  • src/infra/shared-profiles.test.ts
  • src/infra/shared-profiles.ts
  • src/pipeline/webhook.test.ts
  • src/pipeline/webhook.ts

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved agent mention routing so aliases are correctly recognized in webhook events, including global mention patterns.
    • Added safe handling for missing, null, empty, or invalid aliases without causing errors.
    • Ensured mentioned agent aliases are resolved consistently during new sessions and follow-up prompts.
  • Tests

    • Expanded coverage for mention-based routing and invalid alias inputs.
    • Added assertions confirming the correct alias is passed for agent resolution.

Walkthrough

Agent-session mention routing now extracts aliases correctly from global regular expressions in created and prompted flows. Alias resolution also rejects undefined, null, and empty inputs without throwing, with tests covering both routing paths and malformed aliases.

Changes

Agent mention routing

Layer / File(s) Summary
Global-regex mention extraction
src/pipeline/webhook.ts, src/pipeline/webhook.test.ts
Created and prompted agent-session flows extract aliases from full matches, strip @, and verify resolution with "kaylee".
Defensive alias resolution
src/infra/shared-profiles.ts, src/infra/shared-profiles.test.ts
resolveAgentFromAlias validates unknown inputs and returns null for undefined, null, or empty aliases.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A bunny found the regex’s tale,
Where capture groups had lost their trail.
Now @kaylee hops through right,
Bad aliases vanish from sight.
Clean routes bloom beneath moonlight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: fixing AgentSession @mention routing with a global regex.
Description check ✅ Passed The PR description is mostly complete and includes the summary and validation details required by the template.
Linked Issues check ✅ Passed The code now handles global-regex mentions correctly, adds a safe alias guard, and covers both AgentSession paths.
Out of Scope Changes check ✅ Passed The changes stay focused on mention routing and related tests, with no clear unrelated or extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-16-agent-session-mention-routing

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

@calltelemetry-jason
calltelemetry-jason merged commit 0c2d7cb into master Jul 27, 2026
3 checks passed
@calltelemetry-jason
calltelemetry-jason deleted the fix/issue-16-agent-session-mention-routing branch July 27, 2026 03:06
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

AgentSession @mention routing always crashes: mentionMatch[1] undefined because mention regex has the /g flag

1 participant