Claude accounts: route the request with the chat's native session id
The account requests carry the chat in a claude_account body, which the multi-machine gateway neither routed by nor stripped of its chat@ prefix, so the server refused them as 'a valid chat session id is required'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -336,4 +336,33 @@ void main() {
|
||||
await machine.events.close();
|
||||
},
|
||||
);
|
||||
|
||||
test('a chat\'s Claude account request reaches its own machine with the '
|
||||
'native session id', () async {
|
||||
final a = Machine(), b = Machine();
|
||||
final sources = {
|
||||
'a': ChatServerGateway(server('a'), a),
|
||||
'b': ChatServerGateway(server('b'), b),
|
||||
};
|
||||
final all = FederatedChatGateway(
|
||||
() => sources,
|
||||
() => 'a',
|
||||
const Stream.empty(),
|
||||
);
|
||||
for (final type in ['claude_accounts', 'claude_account_use']) {
|
||||
await all.call(type, {
|
||||
'claude_account': {
|
||||
'session_id': federatedChatId('b', 'collision'),
|
||||
'name': 'second',
|
||||
},
|
||||
});
|
||||
final (sent, fields) = b.calls.last;
|
||||
expect(sent, type);
|
||||
expect(fields['claude_account'], {
|
||||
'session_id': 'collision',
|
||||
'name': 'second',
|
||||
});
|
||||
}
|
||||
expect(a.calls.where((c) => c.$1.startsWith('claude_')), isEmpty);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user