Skip to content

fix: add product context fallback for subchannels#133

Open
fpfp100 wants to merge 5 commits into
mainfrom
fix/product-context-fallback-subchannel
Open

fix: add product context fallback for subchannels#133
fpfp100 wants to merge 5 commits into
mainfrom
fix/product-context-fallback-subchannel

Conversation

@fpfp100
Copy link
Copy Markdown
Collaborator

@fpfp100 fpfp100 commented May 11, 2026

fix: add product context fallback for subchannels

Ports the subchannel fallback from SDK PR:microsoft/Agent365-nodejs#251.
Additionally, extracted a shared resolveSubChannel helper in turnContextUtils and applied the same fallback to ScopeUtils.deriveChannelObject(), which was still reading channelIdSubChannel directly without the productContext fallback.

jsl517 and others added 2 commits May 11, 2026 13:40
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…riveChannelObject

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fpfp100 fpfp100 marked this pull request as ready for review May 11, 2026 23:36
Copilot AI review requested due to automatic review settings May 11, 2026 23:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR ports the “subchannel fallback” behavior by resolving a subchannel from activity.channelIdSubChannel with a fallback to activity.channelData.productContext, and applies it consistently across hosting utilities so channel metadata is derived uniformly.

Changes:

  • Added a shared resolveSubChannel() helper and used it from getChannelBaggagePairs() and ScopeUtils.deriveChannelObject().
  • Extended ActivityLike to include channelData, enabling productContext fallback support.
  • Added unit tests covering the fallback and precedence rules.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/internal/unit/a365/hosting/turnContextUtils.test.ts Adds unit tests for resolveSubChannel and verifies getChannelBaggagePairs fallback behavior.
test/internal/unit/a365/hosting/scopeUtils.test.ts Adds unit tests ensuring ScopeUtils.deriveChannelObject() uses the same fallback.
src/a365/index.ts Re-exports resolveSubChannel from the public A365 entrypoint.
src/a365/hosting/types.ts Adds channelData?: unknown to ActivityLike so callers can pass productContext.
src/a365/hosting/turnContextUtils.ts Introduces resolveSubChannel and updates channel baggage extraction to use it.
src/a365/hosting/scopeUtils.ts Updates deriveChannelObject() to use resolveSubChannel.
src/a365/hosting/index.ts Re-exports resolveSubChannel from the hosting barrel.
.claude/settings.local.json Adds a Claude local settings file with allowed Bash commands.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +94 to +106
export function resolveSubChannel(activity: ActivityLike | undefined): string | undefined {
let subChannel = activity?.channelIdSubChannel as string | undefined;
if (!subChannel) {
try {
const rawChannelData = activity?.channelData;
let channelData: Record<string, unknown> | undefined;
if (typeof rawChannelData === "string") {
channelData = JSON.parse(rawChannelData) as Record<string, unknown>;
} else if (rawChannelData && typeof rawChannelData === "object") {
channelData = rawChannelData as Record<string, unknown>;
}
if (channelData && typeof channelData.productContext === "string") {
subChannel = channelData.productContext as string;
Comment thread .claude/settings.local.json Outdated
Comment on lines +3 to +12
"allow": [
"Bash(gh pr:*)",
"Bash(gh issue:*)",
"Bash(gh run:*)",
"Bash(npx prettier:*)",
"Bash(git add:*)",
"Bash(git commit:*)",
"Bash(git push:*)",
"Bash(gh workflow:*)"
]
Comment thread .claude/settings.local.json Outdated
@@ -0,0 +1,14 @@
{
"permissions": {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lets remove local setting from the PR then we can merge

jsl517 and others added 3 commits May 11, 2026 16:54
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

5 participants