| … | … | @@ -0,0 +1,98 @@ | |
| 89 | + | if (senderThreadId === undefined) return {}; | |
| 90 | + | const isDelegatedTaskChild = | |
| 91 | + | loaded?.thread.lineage.parentThreadId === input.receiverThreadId || | |
| 92 | + | input.receiverChildThreadIds.includes(senderThreadId); | |
🟡 Medium orchestration-v2/ThreadMessageProvenance.ts:74
Messages from an ordinary fork back to its source are labeled as coming from a delegated task, so the provider receives a misleading provenance header. The lineage check tests only parentThreadId, which is also set for forks; require relationshipToParent === "subagent" for that branch while retaining the explicit child-task lookup.
| 1 | - readonly lineage: { readonly parentThreadId: ThreadId | null }; |
| 2 | + readonly lineage: { |
| 3 | + readonly parentThreadId: ThreadId | null; |
| 4 | + readonly relationshipToParent: string; |
| 5 | + }; |
| 6 | @@ |
| 7 | - loaded?.thread.lineage.parentThreadId === input.receiverThreadId || |
| 8 | + (loaded?.thread.lineage.parentThreadId === input.receiverThreadId && |
| 9 | + loaded.thread.lineage.relationshipToParent === "subagent") || |
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @apps/server/src/orchestration-v2/ThreadMessageProvenance.ts around lines 74-92: |
| 2 | |
| 3 | Messages from an ordinary fork back to its source are labeled as coming from a delegated task, so the provider receives a misleading provenance header. The lineage check tests only `parentThreadId`, which is also set for forks; require `relationshipToParent === "subagent"` for that branch while retaining the explicit child-task lookup. |
| … | … | @@ -1032,10 +1036,31 @@ export const layer: Layer.Layer< | |
| 1048 | + | ), | |
| 1049 | + | message, | |
| 1038 | 1050 | }); | |
| 1051 | + | const userText = withThreadMessageProvenance( | |
🟠 High orchestration-v2/ProviderTurnStartService.ts:1051
Sending /compact through t3_thread_send to an existing conversation now starts a normal provider turn instead of compacting it. The provenance header is added to userText, which runExecution.startRootRun uses for command recognition; because the resulting text no longer equals /compact, RunExecutionService does not select compactThread. Keep command recognition based on the original message.text, separate from the provenance-decorated provider prompt.
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @apps/server/src/orchestration-v2/ProviderTurnStartService.ts around line 1051: |
| 2 | |
| 3 | Sending `/compact` through `t3_thread_send` to an existing conversation now starts a normal provider turn instead of compacting it. The provenance header is added to `userText`, which `runExecution.startRootRun` uses for command recognition; because the resulting text no longer equals `/compact`, `RunExecutionService` does not select `compactThread`. Keep command recognition based on the original `message.text`, separate from the provenance-decorated provider prompt. |