Skip to content

Commit bae548c

Browse files
mayoalexanderclaude
andcommitted
fix(comms): the Apple Mail ingest never authenticated, so every 401 read as "no messages"
Third layer of the same failure. `iris atlas:comms ingest --channel apple_mail` called the bridge with no X-Bridge-Key, got 401 on every request, silently fell through to the Gmail fallback, and reported whatever that returned as the complete answer. Lead anomalyco#10394 has 70 messages in Apple Mail across his three addresses; the ingest logged 1 and printed "1 new, 0 skipped". The Discord ingest twelve lines up in this same file has always sent the header. Mail simply never did, and because an unauthenticated read is indistinguishable from an empty mailbox downstream, nothing ever said so. Failures are now printed per address with the status code, and a 401 names the fix. Falling through to a lesser source without a word is what kept this invisible for months. Timeout raised 5s → 15s: Mail.app search over a large mailbox is genuinely slow, and a timeout here produced the same silent zero. Fixing the auth immediately exposed the layer underneath — the bridge now answers 503, because the daemon has no Full Disk Access and cannot read Mail at all: [mail/search] No permission to read Mail — grant Full Disk Access in System Settings That one is a macOS permission, not a code change. Grant it to ~/.iris/runtime/node-v22.11.0-darwin-arm64/bin/node and the ingest works. Until then it now says so on every run instead of returning an empty list that looks like an answer. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FEVuQjtBdw2Mq3EpE56GFY
1 parent 38c136a commit bae548c

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

‎packages/opencode/src/cli/cmd/platform-atlas-comms.ts‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,26 @@ async function ingestGmail(lead: any): Promise<any[]> {
246246
const collected: any[] = []
247247
let anyOk = false
248248

249+
// AUTHENTICATE. The bridge requires X-Bridge-Key and this call never sent it, so every
250+
// Apple Mail ingest got a 401, fell through to the Gmail fallback, and reported whatever
251+
// that found as the whole answer. The Discord ingest in this same file has always done it
252+
// correctly — mail simply never did. A 401 here is indistinguishable from "no messages"
253+
// downstream, which is how a mailbox with 70 messages in it logged 1 and said "1 new".
254+
const bridgeToken = getBridgeToken()
255+
const bridgeHeaders: Record<string, string> = { Accept: "application/json" }
256+
if (bridgeToken) bridgeHeaders["X-Bridge-Key"] = bridgeToken
257+
249258
for (const addr of emails) {
250259
const res = await fetch(`${BRIDGE_URL}/api/mail/search?from=${encodeURIComponent(addr)}&days=90&limit=50&include_body=1`, {
251-
signal: AbortSignal.timeout(5000),
260+
headers: bridgeHeaders,
261+
signal: AbortSignal.timeout(15000),
252262
})
253-
if (!res.ok) continue
263+
if (!res.ok) {
264+
// Say which address and why. Falling through to a lesser source without a word is what
265+
// made this invisible for months.
266+
console.log(dim(` apple_mail: ${addr} → bridge returned ${res.status}${res.status === 401 ? " (no/invalid X-Bridge-Key — run: iris bridge status)" : ""}`))
267+
continue
268+
}
254269
anyOk = true
255270

256271
const data = (await res.json()) as any

0 commit comments

Comments
 (0)