Skip to content

feat(samples,#7225): SK 1.78 plan JSON intermediate format + PlanJsonHelpers helper - #65

Closed
jsboige wants to merge 3 commits into
upgrade-skfrom
fix/7225-sk178-plan-helper
Closed

jsboige wants to merge 3 commits into
upgrade-skfrom
fix/7225-sk178-plan-helper

Conversation

@jsboige

@jsboige jsboige commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the SK 1.78 plan JSON intermediate format (Samples/Plans/SK178/*.json) and the PlanJsonHelpers helper that materializes it into a ChatHistory suitable for the canonical SK 1.78 Auto Function Calling flow (FunctionChoiceBehavior.Auto).

This is Step 2/4 of the MultiConnectorTests SK 1.78 migration (c.715 acceptance #2). The multi-cycle plan was committed as a decision comment on #7225 (issuecomment-5025094300). Step 3 (c.716) rewrites MultiConnectorTests.cs to consume this format and removes the <Compile Remove> from IntegrationTests.csproj.

Why an intermediate format?

The legacy Plan.FromJson(...) shape (state/steps/parameters/outputs/next_step_index) was REMOVED in Semantic Kernel 1.78:

  • The Microsoft.SemanticKernel.Planners.* NuGet packages were deleted.
  • plan.State, plan.Steps, SequentialPlanner.CreatePlanAsync, FunctionCallingStepwisePlanner no longer exist.
  • Plan is now a KernelFunction.

ChatHistory itself is a runtime type with non-trivial serialization (author roles, metadata, content items, FunctionCallContent). Shipping raw ChatHistory JSON would be brittle and tightly coupled to SK internals. The intermediate JSON shape captures the authoring intent of a plan (goal + sequence of function invocations) and lets PlanJsonHelpers.BuildChatHistoryFromPlan materialize it deterministically into a system+user prompt for the Auto Function Calling loop.

Changes

1. New plan JSON files (legacy files preserved for diff comparison)

  • Samples/Plans/SK178/Summarize.json — 1 invocation (SummarizeSkill.Summarize, $INPUT → $RESULT__SUMMARY)
  • Samples/Plans/SK178/Summarize_Topics_ElementAt.json — 3 chained invocations (Summarize → Topics → ElementAtIndex, with $RESULT__TOPICS substitution into ElementAtIndex.Arguments)

Both files include a $comment field explaining the shape, ignored by the parser.

2. Helper PlanJsonHelpers (dotnet/src/IntegrationTests/Connectors/MultiConnector/PlanJsonHelpers.cs)

  • LoadPlanAsync(planPath, ct) — read a plan JSON file into Sk178Plan.
  • ParsePlan(planJson) — parse a JSON string into Sk178Plan.
  • BuildChatHistoryFromPlan(plan, inputValue) — materialize as ChatHistory (system + user messages).
  • BuildInvocationPlan(plan, inputValue) — return the function-call sequence as IReadOnlyList<ResolvedInvocation> (plugin + function + pre-resolved arguments), for the integration test to register as available KernelFunctions on the Kernel.
  • BuildChatHistoryFromPlanJsonAsync(planPath, inputValue, ct) — convenience that does the read+build in one call.

Sk178Plan and Sk178Invocation are plain DTOs. ResolvedInvocation exposes FullyQualifiedName => "Plugin-Function".

3. Format spec (docs/Plans/SK178-format.md)

Full schema reference: field-by-field documentation of the intermediate JSON shape, the variable substitution rules ($VARIABLE_NAME references), and the materialization contract (what the helper emits vs. what the Auto Function Calling loop does at runtime).

Compilation

dotnet build src/IntegrationTests/IntegrationTests.csproj succeeds with 0 errors on the file (only pre-existing nullability warnings). The legacy MultiConnectorTests.cs remains <Compile Remove>-excluded at this stage (removal is acceptance #3 in c.716).

What this PR does NOT do

  • Does not rewrite MultiConnectorTests.cs itself (acceptance Bump Roslynator.Formatting.Analyzers from 4.3.0 to 4.5.0 in /dotnet #3 / c.716). It only adds the helper + format that the rewrite will consume.
  • Does not remove the <Compile Remove> block on MultiConnectorTests.cs. The rest of the IntegrationTests project compiles cleanly.
  • Does not depend on real LLM services — the helper is purely offline (System.Text.Json + Microsoft.SemanticKernel.ChatCompletion only).

Compatibility with the existing test scenarios

Legacy file (kept on disk for diff) SK 1.78 file (new)
Samples/Plans/Summarize.json Samples/Plans/SK178/Summarize.json
Samples/Plans/Summarize_Topics_ElementAt.json Samples/Plans/SK178/Summarize_Topics_ElementAt.json

Legacy files are not consumed by tests anymore once #7225 Step 3 ships. They remain on disk to make the migration auditable.

Source of truth

Test plan

  1. dotnet restore succeeds.
  2. dotnet build src/IntegrationTests/IntegrationTests.csproj succeeds (0 errors, 4 pre-existing warnings).
  3. JSON round-trip: a follow-up step (c.716) will add xUnit tests that load both SK178/Summarize*.json files and assert the produced ChatHistory has 2 messages (system+user) for the single-Invocation plan, plus that BuildInvocationPlan returns 3 pre-resolved invocations for the chained plan.

🤖 Generated with Claude Code

Add an intermediate plan JSON format (Samples/Plans/SK178/*.json) and a
PlanJsonHelpers.BuildChatHistoryFromPlan* API that materializes it into a
ChatHistory suitable for the SK 1.78 Auto Function Calling flow
(FunctionChoiceBehavior.Auto). The legacy Plan.FromJson / Plan.State /
Plan.Steps shape was REMOVED in SK 1.78 - Planners.* packages were deleted
and a Plan is now a KernelFunction.

This is the Step 2/4 of the #7225 MultiConnectorTests SK 1.78 migration
(see jsboige/CoursIA#7225 (comment)
for the multi-cycle plan). The helper compiles and is consumed by the
MultiConnectorTests rewrite in Step 3 (acceptance #3/4, c.716). The legacy
Samples/Plans/Summarize*.json files are kept on disk for diff-comparison
purposes; the integration tests will load the SK178/*.json files going
forward.

- Samples/Plans/SK178/Summarize.json: 1 invocation (SummarizeSkill.Summarize).
- Samples/Plans/SK178/Summarize_Topics_ElementAt.json: 3 invocations
  (Summarize -> Topics -> ElementAtIndex) with chained variable
  substitution ($RESULT__TOPICS feeding into ElementAtIndex).
- docs/Plans/SK178-format.md: full spec of the intermediate JSON shape,
  field reference, and materialization contract.
- dotnet/src/IntegrationTests/Connectors/MultiConnector/PlanJsonHelpers.cs:
  parser + ChatHistory builder + ResolvedInvocation helper. Builds the
  system+user messages of a ChatHistory and exposes the function-call
  sequence as a list of ResolvedInvocation structs (plugin+function name +
  pre-resolved arguments) for the integration test to register as available
  KernelFunctions on the Kernel before requesting chat completion.

Co-Authored-By: Claude-Code <noreply@anthropic.com>
jsboige added a commit that referenced this pull request Sep 3, 2026
#66) (#67)

The branch upgrade-sk hosts three PRs (#64, #65, #66) that have been
silent for ~6 weeks: the workflow on: filters exclude upgrade-sk (it
does not match the feature* glob, and is not main), so no build, no
format, no merge-gate check ever runs against these PRs. Only label-pr
fires on them, which is consistent with the ai-01 measurement 'no build
has run'.

Measured divergence main vs upgrade-sk: no common merge-base. upgrade-sk
is a fork of stable-from-v0343 with 3 additional commits; main is a
post-cleanup rewrite (264 vs 304 files). A direct merge of upgrade-sk
into main is materially impossible without massive conflict resolution,
so widening the gate temporarily is the only viable path.

This commit adds 'upgrade-sk' to the branches: filter of the four
workflows that gate the .NET PR pipeline. The widening is **temporary**:
the PR body carries the withdrawal clause required by ai-01 (PR body
below). When the SK 1.78 stack lands on main and the three PRs rebase,
upgrade-sk is removed from all four branches: lists in the same
follow-up.

Scope: 4 files, +4/-4. No code change.
jsboige added a commit that referenced this pull request Sep 4, 2026
…ine) (#68)

Mirror #67 verbatim: the four dotnet-* workflows filtered on
branches: ['main', 'feature*'] (or ['main'] for integration), which
never matched upgrade-sk. PRs #64, #65, #66 have base=upgrade-sk and
have slept since 2026-07-20.

Lines A and B are disjoint: merge-base(origin/main, origin/stable-from-v0343)
is empty (verified). #67 landed on A (base=main), so its filter
extension never touched the workflow copy resolved for PRs on B.

Critere de sortie verifiable: apres merge, PR #64 check count
passe de 1 a >1, avec dotnet-build-and-test-check present.

Refs #67, See #64 #65 #66

Co-authored-by: myia-po-2023 <myia-po-2023@myia.fr>
Records the byte-identical re-rooted upgrade-sk base as a second parent. The branch tree remains unchanged; no PR content is rewritten.

Co-Authored-By: Claude-Code <noreply@anthropic.com>
@jsboige

jsboige commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Tri (dispatch c2189, lane myia-po-2027:CoursIA) — contenu absorbé, PR fermée

Mesure du jour : l'apport de cette PR vit sur stable-from-v0343 (branche par défaut du dépôt), pour l'essentiel à l'octet près.

Fichier neuf de la PR État sur stable-from-v0343
dotnet/src/IntegrationTests/Connectors/MultiConnector/PlanJsonHelpers.cs blob bd8f30a887174140 (14 116 o) — byte-identique
Samples/Plans/SK178/Summarize.json présent (1 322 o) — identique
Samples/Plans/SK178/Summarize_Topics_ElementAt.json présent — identique
docs/Plans/SK178-format.md présent (6 026 o) — identique
.github/workflows/* (4 fichiers) blob 777222ab5911fe6c — identique
dotnet/src/IntegrationTests/IntegrationTests.csproj présent (4 522 o) — référence déjà Samples/Plans/SK178/*

La branche fix/7225-sk178-plan-helper reste en place ; la PR est fermée sans suppression de branche. Si un morceau de l'apport s'avérait absent, la PR se rouvre depuis la branche.

@jsboige jsboige closed this Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants