Skip to content

Commit f9dbcdc

Browse files
committed
Fix workflow family result projection
1 parent 58ceadb commit f9dbcdc

2 files changed

Lines changed: 63 additions & 1 deletion

File tree

src/mcp/response-projection/projectors/workflow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ function compactStep(
194194
const visibleResult = status === "ok" && usesChildOptions
195195
? projectChildValue(input, raw, stepIndex, projectCompatibilityValue)
196196
: status === "ok" && usesFamilyProjection
197-
? visible.result
197+
? projectChildValue(input, raw, stepIndex, projectCompatibilityValue)
198198
: status === "ok"
199199
? raw.result
200200
: visible.result;

tests/unit/response-projection-inventory.test.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,68 @@ describe("response projection inventory", () => {
736736
}
737737
});
738738

739+
it("validates repoStatus when workflow and child both request full detail", () => {
740+
const workflowRegistration = capturePublicToolRegistrations({
741+
enabled: true,
742+
exclusive: true,
743+
}).find(({ name }) => name === "sdl.workflow");
744+
const repoStatus = AGENT_OUTPUT_CASES.find(
745+
({ action }) => action === "repo.status",
746+
);
747+
assert.ok(workflowRegistration);
748+
assert.ok(repoStatus);
749+
const workflowOutputSchema = exhaustiveOutputSchema(workflowRegistration);
750+
assert.ok(workflowOutputSchema);
751+
752+
const request = {
753+
repoId: "sdl-mcp",
754+
detail: "full" as const,
755+
includeDiagnostics: false,
756+
steps: [{
757+
fn: "repoStatus",
758+
args: repoStatus.publicRequest,
759+
detail: "full" as const,
760+
}],
761+
};
762+
const projected = projectToolResultForModelContent(
763+
"sdl.workflow",
764+
{
765+
results: [{
766+
stepIndex: 0,
767+
fn: "repoStatus",
768+
status: "ok",
769+
result: {
770+
...repoStatus.canonicalResultFactory(),
771+
derivedState: {
772+
stale: false,
773+
structuralStale: false,
774+
semanticStale: false,
775+
clustersDirty: false,
776+
processesDirty: false,
777+
algorithmsDirty: false,
778+
summariesDirty: false,
779+
embeddingsDirty: false,
780+
targetVersionId: "v2",
781+
computedVersionId: "v2",
782+
graphIntegrityState: "verified",
783+
graphIntegrityVersionId: "v2",
784+
graphIntegrityRevision: 2,
785+
graphIntegrityVerifiedRevision: 2,
786+
graphIntegrityDigest: "a".repeat(64),
787+
graphIntegrityFilelessPruningSupported: true,
788+
graphIntegrityManifestEstablished: true,
789+
nextBestAction: "No recovery required.",
790+
},
791+
},
792+
_resolvedArgs: repoStatus.publicRequest,
793+
}],
794+
},
795+
request,
796+
);
797+
798+
assert.deepEqual(workflowOutputSchema.parse(projected), projected);
799+
});
800+
739801
it("rejects arbitrary response content schemas and incoherent continuations", () => {
740802
const registrations = capturePublicToolRegistrations();
741803
const responseRegistration = registrations.find(

0 commit comments

Comments
 (0)