Skip to content

Commit 0112adb

Browse files
krukowCopilot
andauthored
Upstream sync: post-v1.0.0-beta.4 round 5 (schema 1.0.55-1, postToolUseFailure) (#112)
* chore(schema): bump to 1.0.52-4 (upstream PR #1393) Regenerates schemas and event specs. Additive changes: - New event `mcp_app.tool_call_complete` (SEP-1865) - Optional `serviceRequestId` on error/assistant.message/assistant.usage/ model.call_failure/session.compaction_complete - Optional `contextTier` on session.model_change - Optional `transport`/`pluginName`/`pluginVersion` on loaded MCP servers - Optional `error` on mcp_server_status_changed - Optional `source`/`trigger` on skill.invoked - Optional `toolDescription`/`uiResource` on tool.execution_complete Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * feat: drop v2 protocol back-compat + runtime_instructions + mcp_app event Ports upstream PRs #1378 and #1377 plus opaque-field handling for the new mcp_app.tool_call_complete event from schema 1.0.52-4 (SEP-1865). BREAKING: minimum supported protocol version raised from 2 to 3 (upstream PR #1378). Removes v2 `tool.call` and `permission.request` RPC dispatcher cases from set-request-handler! and the v2 tool.call arguments escape hatch from protocol/normalize-incoming. v3 broadcast cover the same behaviour. Deletes 7 obsolete v2-only deftests. Adds (upstream PR #1377): - :runtime-instructions to specs/system-prompt-sections - util/section-key->wire entry for runtime_instructions - specs/system-message-sections + ::specs/system-message-section aliases pointing at the system-prompt-sections data, matching the upstream SystemPromptSection → SystemMessageSection rename without breaking existing callers Adds (upstream schema 1.0.52-4): - :copilot/mcp_app.tool_call_complete to the public sdk/event-types registry and to specs/::event-type - protocol/preserve-event-opaque-fields case for mcp_app.tool_call_complete so :arguments and :result keep source-defined keys (no kebab-case) Mock server: PROTOCOL_VERSION → DEFAULT_PROTOCOL_VERSION (= 3) with a per-instance :protocol-version atom on MockServer so tests can configure a v2 server and verify rejection. Tests added: - test-schema-1-0-52-4-mcp-app-tool-call-complete-event-type - test-schema-1-0-52-4-mcp-app-tool-call-complete-opaque-fields - test-schema-1-0-52-4-service-request-id - test-schema-1-0-52-4-model-change-context-tier - test-schema-1-0-52-4-skill-invoked-source-trigger - test-schema-1-0-52-4-runtime-instructions-section - test-schema-1-0-52-4-runtime-instructions-wire-roundtrip - test-schema-1-0-52-4-min-protocol-version-3 Docs: - CHANGELOG: post-v1.0.0-beta.4 round 5 entries - API.md: runtime-instructions section + SystemMessageSection rename note + mcp_app.tool_call_complete event row Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(docs): align customize-mode section list with specs; bump schema to 1.0.52 Addresses Copilot Code Review feedback on PR #111: - The 'Available section keys' paragraph and the 'Customize Mode' table in doc/reference/API.md listed sections that don't exist in github.copilot-sdk.specs/system-prompt-sections (e.g. :proactiveness, :formatting, :tools, :context-collection, :task-management, :agent-mode, :additional-instructions) and omitted real ones (:tool-efficiency, :environment-context, :code-change-rules, :guidelines, :tool-instructions, :custom-instructions, :runtime-instructions). Both locations now mirror the canonical spec (eleven sections) verbatim, including :runtime-instructions from upstream PR #1377. Also picks up upstream PR #1405 (schema bump @github/copilot 1.0.52-4 → 1.0.52 stable). The shipped JSON Schemas are byte-identical between the two versions, so codegen produces no diff; only the pin in .copilot-schema-version and the README/CHANGELOG references move to the stable release name. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chore(schema): bump to 1.0.55-1 and surface canvas event types Advance `.copilot-schema-version` from 1.0.52 to 1.0.55-1, picking up: - upstream PR #1408 (1.0.53-2) - upstream PR #1410 (1.0.53) - upstream PR #1411 (1.0.54) - upstream PR #1412 (1.0.55-0) - upstream PRs #1401 / #1413 (canvas runtime — wire-only, see below) - upstream PR #1432 (1.0.55-1) Schema regen surfaces two new wire-only canvas event types: `session.canvas.opened` and `session.canvas.registry_changed`, plus the field set behind them. These events now appear in the public `event-types` set for forward compatibility, but the canvas runtime (extension manifests, `requestCanvasRenderer`, `openCanvases`, extension info, etc. — upstream PRs #1401, #1413) is intentionally NOT yet exposed on the public Clojure API. Canvas runtime support is deferred to a dedicated future sync round; for now the events flow through as generic session events. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * feat(hooks): add :on-post-tool-use-failure lifecycle hook (upstream PR #1421) Adds a new lifecycle hook dispatched after a tool execution whose result was "failure". `:on-post-tool-use` only fires for successful results, so register this handler to observe or react to failed tool outcomes. Note: "rejected", "denied", and "timeout" results do not currently trigger this hook — only "failure" does. Handler input has `:tool-name`, `:tool-args`, `:error` (string), plus the base hook fields (`:session-id`, `:timestamp`, `:cwd`). Optional return value `{:additional-context "..."}` is appended as hidden guidance to the model alongside the failed tool result. Wiring sites: - `specs/::on-post-tool-use-failure` fn spec, added to `::hooks` :opt-un `:on-post-tool-use-failure` - `client/create-session` docstring lists the new hook key - API.md hooks example documents input/output shape Tests cover (a) handler invocation + `additionalContext` round-trip on the wire, and (b) graceful nil result when only the success hook is registered. RED→GREEN: the new tests fail without the dispatcher change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(review): address multi-model review on schema bump Two findings from code-review pass on PR-candidate round-5 extension: - (gpt-5.5) Canvas events declare `x-opaque-json` fields (`data.input` on `session.canvas.opened`; nested `canvases[].inputSchema` and `canvases[].actions[].inputSchema` on `session.canvas.registry_changed`). Since the canvas runtime is intentionally deferred to a future sync round and we have not yet implemented opaque-field preservation for these payloads, do not surface canvas event types in the curated public `::event-type` set yet — they would expose mangled JSON-Schema keys to consumers. The wire layer (`generated.event-specs/event-types`) still has them; canvas event types and their opaque-field preservation will land together when the canvas runtime is ported. - (claude-opus-4.7) CHANGELOG schema-bump entry had the version/PR positional mapping wrong for the first two items (`1.0.53 → #1408` should be `1.0.53-2 → #1408`, `1.0.53 → #1410`). Reorder so each position is correct and add a forward-looking note about deferred canvas opaque-field preservation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0802b15 commit 0112adb

11 files changed

Lines changed: 1419 additions & 104 deletions

File tree

.copilot-schema-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.52
1+
1.0.55-1

CHANGELOG.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. This change
44
## [Unreleased]
55

66
### Added (post-v1.0.0-beta.4 sync, round 5)
7+
- **`:on-post-tool-use-failure` hook** — New lifecycle hook in the
8+
`:hooks` map. Fires after a tool execution whose result was `"failure"`;
9+
`:on-post-tool-use` only fires for successful results, so register this
10+
handler to observe or react to failed tool outcomes. Note: `"rejected"`,
11+
`"denied"`, and `"timeout"` results do not currently trigger this hook —
12+
only `"failure"` does. Handler input has `:tool-name`, `:tool-args`,
13+
`:error` (string), plus the base hook fields (`:session-id`,
14+
`:timestamp`, `:cwd`). Optional return value:
15+
`{:additional-context "..."}` is appended as hidden guidance to the
16+
model alongside the failed tool result. (upstream PR #1421)
717
- **`:runtime-instructions` system message section** — New section recognized
818
by the SDK's `:system-message` `:customize` mode. Wire-encoded as
919
`"runtime_instructions"` and accepted by `::specs/system-prompt-section`.
@@ -32,10 +42,19 @@ All notable changes to this project will be documented in this file. This change
3242
on `:skill.invoked` data.
3343
- `:tool-description` and `:ui-resource` on `:tool.execution_complete` data.
3444
- **Schema bump**`.copilot-schema-version` advanced from `1.0.52-1` to
35-
`1.0.52` (stable). Picked up the 1.0.52-4 pre-release (upstream PR #1393)
36-
and then advanced to the 1.0.52 stable release (upstream PR #1405); the
37-
shipped JSON Schemas are byte-identical between 1.0.52-4 and 1.0.52, so
38-
no additional schema-driven changes were required.
45+
`1.0.55-1`. Picked up the 1.0.52-4 pre-release (upstream PR #1393), the
46+
1.0.52 stable release (upstream PR #1405), the 1.0.53-2 pre-release
47+
(upstream PR #1408), and the 1.0.53 / 1.0.54 / 1.0.55-0 / 1.0.55-1
48+
schema bumps (upstream PRs #1410, #1411, #1412, #1432). Schema regen
49+
surfaces new wire-only canvas event types (`session.canvas.opened`,
50+
`session.canvas.registry_changed`) and their field set in the
51+
generated `event-specs` namespace. The canvas runtime (extension
52+
manifests, `requestCanvasRenderer`, `openCanvases`, etc. — upstream
53+
PRs #1401, #1413) is **not yet exposed** on the public Clojure API,
54+
including the curated `event-types` set. Canvas runtime support
55+
(including opaque-field preservation for `data.input` and nested
56+
`inputSchema` payloads on canvas events) will land in a dedicated
57+
future sync round.
3958

4059
### Changed (post-v1.0.0-beta.4 sync, round 5)
4160
- **BREAKING: Minimum supported protocol version raised from 2 to 3.** The

doc/reference/API.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,11 +2258,30 @@ Lifecycle hooks allow custom logic at various points during the session:
22582258

22592259
:on-post-tool-use
22602260
(fn [input invocation]
2261-
;; Called after each tool execution
2262-
;; input contains {:tool-name "..." :result {...}}
2261+
;; Called after each *successful* tool execution
2262+
;; input contains {:tool-name "..." :tool-args {...} :tool-result {...}}
2263+
;; For failed tool calls, register :on-post-tool-use-failure below.
22632264
(println "Tool completed:" (:tool-name input))
22642265
nil)
22652266

2267+
:on-post-tool-use-failure
2268+
(fn [input invocation]
2269+
;; Called after a tool execution whose result was `"failure"`
2270+
;; (upstream PR #1421). :on-post-tool-use only fires for
2271+
;; successful results, so register this handler to observe
2272+
;; failed tool outcomes. Note: `"rejected"`, `"denied"`, and
2273+
;; `"timeout"` results do NOT currently trigger this hook —
2274+
;; only `"failure"` does.
2275+
;; input contains {:tool-name "..." :tool-args {...}
2276+
;; :error "failure message string"
2277+
;; :session-id "..." :timestamp 12345}
2278+
;; Optional return: {:additional-context "..."} is appended as
2279+
;; hidden guidance to the model alongside the failed result.
2280+
;; Other fields (e.g. :modified-result, :suppress-output) are
2281+
;; not honored for failure hooks.
2282+
(println "Tool failed:" (:tool-name input) (:error input))
2283+
{:additional-context "Tip: try `ls` first to see available files."})
2284+
22662285
:on-pre-mcp-tool-call
22672286
(fn [input invocation]
22682287
;; Called before each MCP tool call is dispatched (upstream PR #1366).

schemas/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ These files are fetched verbatim from the `@github/copilot` npm package at the v
44

55
**Do not edit by hand.** To update, run `bb schemas:fetch` after bumping `.copilot-schema-version`.
66

7-
Currently pinned version: `1.0.52`
7+
Currently pinned version: `1.0.55-1`

0 commit comments

Comments
 (0)