Look up auth connections by domain instead of stored ID

Connection IDs change when re-authing. Instead of storing IDs in
settings.json (which go stale), look up connections by domain at
runtime via kernel.auth.connections.list({ domain }). This keeps
the applier in sync regardless of connection recreation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 15:55:26 -08:00
parent 561e666323
commit 668a40a51a
2 changed files with 42 additions and 23 deletions

View File

@@ -137,9 +137,8 @@ async function main() {
browser = await createBrowser(settings, null); // no profile needed
} else {
// Check auth status before creating browser
const connectionIds = settings.kernel?.connection_ids || {};
const kernelApiKey = process.env.KERNEL_API_KEY || settings.kernel_api_key;
const authResult = await ensureAuth(platform, kernelApiKey, connectionIds);
const authResult = await ensureAuth(platform, kernelApiKey);
if (!authResult.ok) {
console.error(`${platform} auth failed: ${authResult.reason}`);
await sendTelegram(settings, `⚠️ *${platform}* auth failed — ${authResult.reason}`).catch(() => {});