Skip to content

Commit cde10c6

Browse files
committed
fix(resolve): register action, normalize chain field, gate state on caller intent
1 parent 907e058 commit cde10c6

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

workers/src/orchestrate.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,7 @@ async function runResolve(
16511651
result: {
16521652
status: "CIRCULAR_SUPERSESSION",
16531653
input_uri: input,
1654-
chain: [...chain, { uri: next }],
1654+
supersession_chain: [...chain, { uri: next }],
16551655
message: "superseded_by chain cycles",
16561656
},
16571657
state: updatedState,
@@ -1676,10 +1676,10 @@ async function runResolve(
16761676
url: deriveUrl(current.uri),
16771677
content_hash: current.content_hash,
16781678
},
1679-
supersession_chain: chain,
1679+
supersession_chain: chain.slice(0, -1),
16801680
warning: `superseded_by points at \`${next}\` which is not in the index; chain truncated`,
16811681
},
1682-
state: addCanonRefs(updatedState || initState(state), [current.path]),
1682+
state: state ? addCanonRefs(initState(state), [current.path]) : undefined,
16831683
assistant_text: `Resolved \`${input}\` to \`${current.uri}\` (chain truncated at unknown successor \`${next}\`).`,
16841684
debug: { duration_ms: Date.now() - startMs, generated_at: new Date().toISOString() },
16851685
};
@@ -1698,7 +1698,7 @@ async function runResolve(
16981698
result: {
16991699
status: "CIRCULAR_SUPERSESSION",
17001700
input_uri: input,
1701-
chain,
1701+
supersession_chain: chain,
17021702
message: `chain exceeded MAX_DEPTH=${MAX_DEPTH}`,
17031703
},
17041704
state: updatedState,
@@ -1721,7 +1721,7 @@ async function runResolve(
17211721
},
17221722
supersession_chain: chain,
17231723
},
1724-
state: addCanonRefs(updatedState || initState(state), [current.path]),
1724+
state: state ? addCanonRefs(initState(state), [current.path]) : undefined,
17251725
assistant_text:
17261726
chain.length === 0
17271727
? `Resolved \`${input}\` (no supersession).`
@@ -2900,6 +2900,7 @@ const VALID_ACTIONS = [
29002900
"encode",
29012901
"search",
29022902
"get",
2903+
"resolve",
29032904
"catalog",
29042905
"validate",
29052906
"preflight",

0 commit comments

Comments
 (0)