Uh oh!
There was an error while loading. Please reload this page.
fix(runtime): branch copied tool authority facts - #2061
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Superseded by a plain comment; no formal rating intended.
Review notes (no rating on the PR itself; severity labels per finding): the direction is right (admitting tool dispatch/recovery facts with a typed identity rewrite, classifying P1 — The gate inspects a different set than the copy. P2 — Keep the old auth-classification recall while excluding P2 — Add two tests. |
jackwener
commented
Aug 4, 2026
Review by maka-审美专家 — request changes(修复方向正确:工具授权走 typed rewrite 路径的论证成立——toolOperationIdMap 由新 invocation id 派生、requiredMappedId 缺映射即 loud fail、SQLite 侧 rebuildToolProjections 重投影,这套链路我们核过是对的。但门控收窄后暴露出两个真缺口): 1. 阻塞:hosted 复制路径完全没有门控。 runtime-host/src/server/session-revision-coordinator.ts:397 直接调 cloneConversationRuntimeLedger,全文件无 assertConversationRuntimeLedgerCloneSupported 等价物(已核实)。PR 声明的不变量「continuation authority 在有 typed copy 协议前保持 fail-closed」只在 legacy SessionManager 路径成立;host coordinator 会把 actions.continuationStart 原样拷贝——claimId / boundaryDigest / immediateSource.* 全部指回源会话,而 recovery 是按 claimId 查事件的。请给该路径加同一门控(或 rewrite/reject)。 2. 应修:门控的 turn 集合窄于复制的 turn 集合。 session-manager.ts:5462 用复制消息推导 copiedTurnIds,但实际计划走 conversationCopyTurnClosure(conversation-copy.ts:1269)会经 parentRunId 拉入 child-run turns——closure 加入的 turn 里若有 continuationStart / run.continuationSource 会绕过门控被原样复制。门控改为对 plan.copyTurnIds 求值,并加一个「closure 子 run turn 里埋 continuationStart」的测试把两处一起钉住。 3. 说明或收敛:cloneRunHeader(conversation-copy.ts:867)对 continuationSource 只重写 sourceInvocationId/sourceRunId,V2 的 claimId/boundaryDigest/…以及 rootExecution/automationId 等原样存活——当前只经路径 1 可达,修掉 1 后请在注释里写明这是被门控挡住的死角还是待办。 4. 顺带盯一下:redaction.ts 把 includes('auth') 换成词边界正则修掉了「authority」误报是对的,但也放走了 auth_token / AuthError / authenticate / OAuth2 这类真认证错误(降级为通用文案,无泄漏风险)。建议用 authenticat|authoriz|oauth 词干或对 authority 负向前瞻收紧。5. rollback 现在只删 session 元数据,门控收窄后 mid-copy 失败会孤儿化 runs/events/tool_operations 行——至少在 PR 里声明这个已知洞。 1+2 修完(含新测试)我复审合入。 |
liugddx
commented
Aug 4, 2026
Addressed the review feedback in e1d976c.
Validation completed:
|
e1d976c to
c6b194cCompareliugddx
commented
Aug 4, 2026
Rebased this PR onto current |
2afbe67 to
c211d03Compareliugddx
commented
Aug 4, 2026
CI follow-up: fixed the runtime-host Linux fixture in |
Summary
authorityas authentication failure by matching explicit authentication termsRoot cause
The conversation copy implementation already creates new Run, invocation, RuntimeEvent, provider trace, and tool operation identities, then rewrites dispatch/recovery and operation references before importing the target ledger. The later continuation preflight rejected those supported tool facts together with unsupported continuation claims, so the typed copy path was unreachable for ordinary tool-bearing conversations.
The Desktop error was also misleading: the shared classifier used
includes('auth'), so the wordauthoritybecame “Authentication failed”.Safety boundary
This does not copy or bypass continuation authority. A retained Run with
continuationSource, or a retained RuntimeEvent withcontinuationStart, is still rejected before the target Session is created. Tool operation facts are only admitted through the existing typed rewrite and atomic RuntimeEvent import path.Verification
npm --workspace @maka/core test— 771 passedTMPDIR=/private/tmp npm --workspace @maka/runtime run test:dist— 3,080 passed, 9 skipped, 0 failednode --test packages/runtime/dist/__tests__/conversation-copy.test.js— 10 passednpm run test:scripts— 86 passednpm run typecheck— all workspaces cleannpm run lintnpm run format:checkgit diff --checkReal Desktop acceptance
Using the current macOS Desktop build and the exact persisted conversation/turn that reproduced the failure:
window.maka.sessions.branchFromTurn()through the real preload/IPC boundaryparentSessionIdandbranchOfTurnIdFixes#2060