SessionFs structured error contract + workspace E2E tests#1102
Draft
SteveSandersonMS wants to merge 4 commits intomainfrom
Draft
SessionFs structured error contract + workspace E2E tests#1102SteveSandersonMS wants to merge 4 commits intomainfrom
SteveSandersonMS wants to merge 4 commits intomainfrom
Conversation
…e tests
- Regenerate rpc.ts from updated api.schema.json with structured error type
(error?: { code: 'ENOENT' | 'UNKNOWN', message?: string }) on all sessionFs results
- Update createTestSessionFsHandler to catch fs errors and return error objects
instead of throwing (matches the new RPC contract)
- Add E2E tests for workspace metadata and plan.md written via sessionFs
- Add test snapshots for new workspace tests
Depends on: github/copilot-agent-runtime#6479
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ae9d745 to
b39f0de
Compare
Two issues caused duplicate type generation in json-schema-to-typescript: 1. $ ef objects with sibling keywords (e.g. description) were treated as new inline types instead of reusing the referenced definition. Fix: strip all sibling keywords from $ ef objects in normalizeSchemaForTypeScript. 2. withSharedDefinitions copies definitions into $defs when $defs is empty, then normalizeSchemaForTypeScript aliased collisions as $defs_X. Since definitions entries go through the full pipeline (title-stripping, ref-reuse) but $defs copies don't, they diverge. Fix: when a key exists in both, prefer the definitions entry and drop the $defs duplicate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The runtime schema uses anyOf [{not:{}}, {$ref: ...}] for optional
results (e.g., writeFile returns SessionFsError or undefined).
Previously all 4 codegen scripts only recognized {type: 'null'} as
null-like, producing incorrect wrapper types.
Changes:
- utils.ts: Add getNullableInner() to detect {not:{}} null patterns
- typescript.ts: Emit 'T | undefined' for nullable results
- csharp.ts: Emit 'Task<T?>' for nullable results
- python.ts: Emit 'T | None' for nullable results
- go.ts: Emit '*T' (pointer) for nullable results
- Regenerated all 4 languages
- Fixed C# test handler to use Task<SessionFsError?>
- Fixed Go session.go Vision type rename
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates the Node.js SDK to support the new sessionFs structured error contract from github/copilot-agent-runtime#6479.
Changes
pc.ts* from updated \�pi.schema.json\ — all sessionFs result types now include an optional \�rror\ object:
\\ ypescript
error?: { code: 'ENOENT' | 'UNKNOWN'; message?: string }
\\
Why
\�scode-jsonrpc\ \ResponseError\ loses the Node.js .code\ string property during serialization. The runtime's \WorkspaceManager.loadWorkspace()\ checks \�rror.code === 'ENOENT'\ to handle missing workspaces — without this contract, workspace initialization silently fails over SDK sessions.
Depends on