dsh-github-copilot 0.1.0-alpha.1.dsh.0.2.1.alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +439 -0
- package/CHANGELOG.md +875 -0
- package/CONTRIBUTING.md +55 -0
- package/LICENSE +21 -0
- package/README.md +366 -0
- package/README.zh.md +341 -0
- package/SECURITY.md +29 -0
- package/cordis.patch.yml +16 -0
- package/deployment-baseline.json +1580 -0
- package/docs/account-management-experience.md +143 -0
- package/docs/agent-readiness.md +110 -0
- package/docs/auto-high-cost.md +255 -0
- package/docs/auto-iteration-review.json +22 -0
- package/docs/auto-review-sampling.md +60 -0
- package/docs/auto-task-routing.md +341 -0
- package/docs/automatic-model-routing.md +236 -0
- package/docs/copilot-accounts.md +424 -0
- package/docs/copilot-compaction.md +148 -0
- package/docs/copilot-usage.md +133 -0
- package/docs/dual-model.md +66 -0
- package/docs/evidence-driven-iteration.md +86 -0
- package/docs/image-input-compatibility.md +64 -0
- package/docs/images/copilot-accounts-credits.png +0 -0
- package/docs/images/copilot-accounts.png +0 -0
- package/docs/images/copilot-current-provenance.json +39 -0
- package/docs/images/copilot-model-preferences.png +0 -0
- package/docs/images/copilot-search-routing.png +0 -0
- package/docs/images/copilot-session-continuation.png +0 -0
- package/docs/images/dual-model-desktop.png +0 -0
- package/docs/images/dual-model-mobile.png +0 -0
- package/docs/images/dual-model-provenance.json +35 -0
- package/docs/images/parent-model-follow.png +0 -0
- package/docs/manual-compaction-recovery.md +109 -0
- package/docs/mockups/copilot-account-dropdown.html +71 -0
- package/docs/mockups/copilot-account-management.html +393 -0
- package/docs/model-compatibility-acceptance.md +182 -0
- package/docs/npm-distribution.md +202 -0
- package/docs/official-first-016-alpha2.md +66 -0
- package/docs/official-first-020-rc1.md +32 -0
- package/docs/official-first-020-rc2.md +17 -0
- package/docs/official-first-021-alpha4.md +157 -0
- package/docs/official-first-021-alpha5.md +83 -0
- package/docs/plugin-diagnostics.md +605 -0
- package/docs/session-continuation.md +141 -0
- package/docs/session-search-routing.md +133 -0
- package/docs/single-route-migration.md +131 -0
- package/docs/web-lifecycle-rc2.md +55 -0
- package/lib/client.js +13236 -0
- package/lib/client.js.map +1 -0
- package/lib/copilot-identity-DRZY_d2X.js +15 -0
- package/lib/diagnostics-analysis-io.js +78 -0
- package/lib/diagnostics-analysis.js +427 -0
- package/lib/diagnostics-types-CF-qg8Do.js +708 -0
- package/lib/index.js +15661 -0
- package/lib/manual-compaction-recovery.js +485 -0
- package/lib/remote.js +1507 -0
- package/lib/request-budget-DLY_aRq0.js +87 -0
- package/lib/routed-web.js +120 -0
- package/lib/search-routing-CV2hs8as.js +792 -0
- package/lib/types/account-dropdown.d.ts +22 -0
- package/lib/types/account-model-auth.d.ts +15 -0
- package/lib/types/account-model-catalog.d.ts +70 -0
- package/lib/types/account-model-source.d.ts +85 -0
- package/lib/types/agent-compaction.d.ts +4 -0
- package/lib/types/authorization-code-clipboard.d.ts +4 -0
- package/lib/types/authorization-controller.d.ts +121 -0
- package/lib/types/auto-allocation-card.d.ts +9 -0
- package/lib/types/auto-allocation-diagnostics.d.ts +126 -0
- package/lib/types/auto-allocation-evidence.d.ts +44 -0
- package/lib/types/auto-allocation.d.ts +47 -0
- package/lib/types/auto-assessment-evidence.d.ts +111 -0
- package/lib/types/auto-model-host.d.ts +30 -0
- package/lib/types/auto-model-intent.d.ts +36 -0
- package/lib/types/auto-model-presentation.d.ts +57 -0
- package/lib/types/auto-model-routing.d.ts +64 -0
- package/lib/types/auto-review-sampling.d.ts +6 -0
- package/lib/types/auto-selection-explanation.d.ts +9 -0
- package/lib/types/auto-task-assessment.d.ts +49 -0
- package/lib/types/auto-task-classifier.d.ts +10 -0
- package/lib/types/background-compaction.d.ts +30 -0
- package/lib/types/client.d.ts +129 -0
- package/lib/types/compact-account.d.ts +42 -0
- package/lib/types/compaction-continuation-ui.d.ts +29 -0
- package/lib/types/compaction-continuation.d.ts +48 -0
- package/lib/types/compaction-input-estimate.d.ts +28 -0
- package/lib/types/compaction-pressure.d.ts +23 -0
- package/lib/types/compaction-replay.d.ts +18 -0
- package/lib/types/compatibility.d.ts +17 -0
- package/lib/types/composer-notice-style.d.ts +7 -0
- package/lib/types/config.d.ts +141 -0
- package/lib/types/content-file.d.ts +10 -0
- package/lib/types/context-evidence-ui.d.ts +28 -0
- package/lib/types/context-evidence.d.ts +256 -0
- package/lib/types/context-usage.d.ts +4 -0
- package/lib/types/copilot-account-presentation.d.ts +7 -0
- package/lib/types/copilot-accounts-card.d.ts +43 -0
- package/lib/types/copilot-accounts-host.d.ts +93 -0
- package/lib/types/copilot-accounts-remote.d.ts +85 -0
- package/lib/types/copilot-accounts-types.d.ts +43 -0
- package/lib/types/copilot-auth.d.ts +31 -0
- package/lib/types/copilot-grant.d.ts +11 -0
- package/lib/types/copilot-identity.d.ts +11 -0
- package/lib/types/copilot-request.d.ts +11 -0
- package/lib/types/copilot-stream-liveness.d.ts +23 -0
- package/lib/types/copilot-usage-card.d.ts +51 -0
- package/lib/types/copilot-usage-host.d.ts +61 -0
- package/lib/types/copilot-usage-normalize.d.ts +9 -0
- package/lib/types/copilot-usage-remote.d.ts +63 -0
- package/lib/types/copilot-usage-types.d.ts +20 -0
- package/lib/types/copilot-usage-ui.d.ts +4 -0
- package/lib/types/current-provider.d.ts +59 -0
- package/lib/types/deepseek-search-fallback.d.ts +11 -0
- package/lib/types/diagnostics-analysis-io.d.ts +23 -0
- package/lib/types/diagnostics-analysis.d.ts +298 -0
- package/lib/types/diagnostics-card.d.ts +12 -0
- package/lib/types/diagnostics-client.d.ts +13 -0
- package/lib/types/diagnostics-collector.d.ts +50 -0
- package/lib/types/diagnostics-host.d.ts +183 -0
- package/lib/types/diagnostics-remote.d.ts +113 -0
- package/lib/types/diagnostics-types.d.ts +893 -0
- package/lib/types/dual-model-host.d.ts +119 -0
- package/lib/types/dual-model-remote.d.ts +63 -0
- package/lib/types/dual-model-types.d.ts +34 -0
- package/lib/types/external-link.d.ts +3 -0
- package/lib/types/failure.d.ts +38 -0
- package/lib/types/http.d.ts +48 -0
- package/lib/types/image-input-admission.d.ts +5 -0
- package/lib/types/index.d.ts +39 -0
- package/lib/types/manual-compaction-recovery.d.ts +67 -0
- package/lib/types/migration-status.d.ts +50 -0
- package/lib/types/model-exclusions.d.ts +15 -0
- package/lib/types/model-preferences-card.d.ts +9 -0
- package/lib/types/model-protocol.d.ts +31 -0
- package/lib/types/native-select-style.d.ts +4 -0
- package/lib/types/native-settings-style.d.ts +10 -0
- package/lib/types/parent-model-follow-card.d.ts +32 -0
- package/lib/types/parent-model-follow.d.ts +44 -0
- package/lib/types/pi-provider-bridge.d.ts +22 -0
- package/lib/types/plan.d.ts +148 -0
- package/lib/types/pre-step-pressure.d.ts +8 -0
- package/lib/types/preview-provider.d.ts +77 -0
- package/lib/types/preview-route.d.ts +76 -0
- package/lib/types/probe.d.ts +39 -0
- package/lib/types/remote-codec.d.ts +10 -0
- package/lib/types/remote.d.ts +202 -0
- package/lib/types/replay-recovery-host.d.ts +28 -0
- package/lib/types/replay-recovery-remote.d.ts +14 -0
- package/lib/types/replay-recovery-types.d.ts +24 -0
- package/lib/types/replay-recovery-ui.d.ts +28 -0
- package/lib/types/replay-recovery.d.ts +17 -0
- package/lib/types/request-body-composition.d.ts +17 -0
- package/lib/types/request-body-evidence.d.ts +37 -0
- package/lib/types/request-body-timeout-marker.d.ts +2 -0
- package/lib/types/request-body-timeout.d.ts +4 -0
- package/lib/types/request-budget.d.ts +58 -0
- package/lib/types/request-diagnostics.d.ts +278 -0
- package/lib/types/request-upload-evidence.d.ts +23 -0
- package/lib/types/response-error-body.d.ts +3 -0
- package/lib/types/responses-reasoning-text.d.ts +24 -0
- package/lib/types/responses-reasoning.d.ts +7 -0
- package/lib/types/responses-replay-compat.d.ts +31 -0
- package/lib/types/responses-request-compression.d.ts +33 -0
- package/lib/types/route-ownership.d.ts +70 -0
- package/lib/types/routed-web.d.ts +50 -0
- package/lib/types/search-backend.d.ts +16 -0
- package/lib/types/search-routing-host.d.ts +19 -0
- package/lib/types/search-routing-policy.d.ts +18 -0
- package/lib/types/search-routing-remote.d.ts +20 -0
- package/lib/types/search-routing.d.ts +43 -0
- package/lib/types/search-tool-routing.d.ts +22 -0
- package/lib/types/serialize.d.ts +106 -0
- package/lib/types/session-accounts-controller.d.ts +20 -0
- package/lib/types/session-accounts-host.d.ts +33 -0
- package/lib/types/session-accounts-remote.d.ts +114 -0
- package/lib/types/session-accounts.d.ts +38 -0
- package/lib/types/session-continuation-host.d.ts +45 -0
- package/lib/types/session-continuation-remote.d.ts +22 -0
- package/lib/types/session-continuation-types.d.ts +62 -0
- package/lib/types/session-continuation-ui.d.ts +49 -0
- package/lib/types/session-continuation.d.ts +14 -0
- package/lib/types/settings-reader.d.ts +16 -0
- package/lib/types/sse.d.ts +28 -0
- package/lib/types/temporary-models.d.ts +25 -0
- package/lib/types/tool-schema-compat.d.ts +17 -0
- package/lib/types/traditional-search.d.ts +17 -0
- package/lib/types/turn-model-provenance.d.ts +45 -0
- package/lib/types/turn-request-models.d.ts +55 -0
- package/lib/types/turn-selection-card.d.ts +24 -0
- package/lib/types/turn-selection-host.d.ts +35 -0
- package/lib/types/turn-selection-remote.d.ts +17 -0
- package/lib/types/turn-selection.d.ts +186 -0
- package/lib/types/turn-usage-evidence.d.ts +66 -0
- package/lib/types/turn-usage-notice.d.ts +7 -0
- package/lib/types/types.d.ts +69 -0
- package/lib/types/usage.d.ts +26 -0
- package/lib/types/watchdog.d.ts +22 -0
- package/lib/types/web-delegate.d.ts +12 -0
- package/lib/types/web-search-routing-card.d.ts +16 -0
- package/lib/types/web-search-routing-config.d.ts +12 -0
- package/lib/types/wire-anthropic.d.ts +37 -0
- package/lib/types/wire.d.ts +56 -0
- package/lib/web-delegate.js +9 -0
- package/output/auto-model-mockup/index.html +207 -0
- package/package.json +261 -0
- package/scripts/analyze-diagnostics.mjs +91 -0
- package/scripts/check-search-composition.mjs +191 -0
- package/scripts/iteration-review.mjs +53 -0
- package/scripts/release-policy.mjs +353 -0
- package/scripts/select-core-release.mjs +11 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
# Copilot accounts
|
|
2
|
+
|
|
3
|
+
## Delivery status
|
|
4
|
+
|
|
5
|
+
This document records the approved requirements and implementation design for
|
|
6
|
+
issues #297 and #305. It is not a release receipt or a claim of current
|
|
7
|
+
installation/runtime state. The existing single-account behavior remains the
|
|
8
|
+
compatibility baseline; publication, installation and loaded runtime state are
|
|
9
|
+
separate evidence.
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
### Native OAuth refresh and dispatched requests (#385)
|
|
14
|
+
|
|
15
|
+
In 0.4.0, every matching credential notification aborts managed wires, including
|
|
16
|
+
normal native refresh by another same-account request. Upgrade to 0.4.1 for the
|
|
17
|
+
narrow plugin-owned refresh exception. This is synthetic regression evidence,
|
|
18
|
+
not attribution of a particular live error to refresh.
|
|
19
|
+
|
|
20
|
+
Versions through 0.4.2-alpha.13 keyed refresh evidence by a traced credentials
|
|
21
|
+
service face. Official rc.2 Cordis returns distinct faces on repeated reads,
|
|
22
|
+
so even certified refresh notifications could be classified as unknown source.
|
|
23
|
+
The plugin now correlates by the published `symbols.original` service identity,
|
|
24
|
+
while executing credential operations through the traced face. Real Service
|
|
25
|
+
regressions exercise distinct contexts, isolated services, duplicate/missing/
|
|
26
|
+
delayed notifications and failed/mismatched commits. This repairs qualification,
|
|
27
|
+
not proof that a particular historical notification was a token refresh.
|
|
28
|
+
|
|
29
|
+
Separately enabled request diagnostics may now record fixed qualification,
|
|
30
|
+
notification and commit reasons plus bounded live-wire populations; see
|
|
31
|
+
[credential-change decisions](./plugin-diagnostics.md#credential-change-decisions-402).
|
|
32
|
+
Unknown notification source stays unknown. This observes the existing exception,
|
|
33
|
+
not a broader permission to preserve requests or a reconstruction of past failures.
|
|
34
|
+
|
|
35
|
+
Only a genuine native refresh through the plugin's public credential-store bridge
|
|
36
|
+
may qualify: normalized account grant, model entitlements and official
|
|
37
|
+
OAuth-derived endpoint must remain unchanged. Its exact returned object is
|
|
38
|
+
consumed once inside the serialized `modifyRecord` callback. Exactly one
|
|
39
|
+
synchronous record notification and matching returned committed grant confirm
|
|
40
|
+
the write. No refresh-wide timing flag or unchanged-token heuristic is used.
|
|
41
|
+
Failed, duplicated, delayed, unknown or externally produced notifications remain
|
|
42
|
+
revocation; Core's separately owned canonical adapter has no provenance seam
|
|
43
|
+
through this bridge and remains fail-closed.
|
|
44
|
+
|
|
45
|
+
The exception retains only HTTP streams already dispatched through the native
|
|
46
|
+
adapter's public Fetch seam, including concurrent streams for the same frozen
|
|
47
|
+
account. Metadata, prepared leases, search/recovery proof and retry snapshots are
|
|
48
|
+
still invalidated immediately. A new step/request must resolve fresh native auth
|
|
49
|
+
and validate current account metadata. An old prepared request cannot dispatch
|
|
50
|
+
after renewal; an already-dispatched request cannot use its old lease to make a
|
|
51
|
+
second physical HTTP attempt after renewal. Core retains retry/transaction
|
|
52
|
+
ownership; this plugin adds no resend or automatic retry. Account default changes
|
|
53
|
+
do not redirect frozen requests; each account's record remains isolated.
|
|
54
|
+
|
|
55
|
+
Account/endpoint/permission replacement, record removal, read/commit failure,
|
|
56
|
+
caller cancellation and disposal still revoke. Supplier expired-token rejection
|
|
57
|
+
and network failures can still terminate the original request; preserving a local
|
|
58
|
+
stream does not prove supplier acceptance. Identity/quota presentation caches
|
|
59
|
+
continue to invalidate on every notification, not reuse old credentials.
|
|
60
|
+
|
|
61
|
+
### Selector switching and account-bound turns (#344)
|
|
62
|
+
|
|
63
|
+
A global switch changes only the selector. Explicit record-bound request leases
|
|
64
|
+
may be acquired during its preflight and CAS so already admitted turns can
|
|
65
|
+
prepare and dispatch their next native step with their frozen account. A new
|
|
66
|
+
turn still captures its account once at admission; it does not adopt a later
|
|
67
|
+
selector. Unbound/global leases remain blocked during switching, and all
|
|
68
|
+
requests remain blocked during credential authorization/removal/sign-out.
|
|
69
|
+
Pinned records cannot be reauthorized or removed until their leases end.
|
|
70
|
+
Cancellation, route eligibility, credential validity and account-model checks
|
|
71
|
+
remain independent. This is not automatic retry or permission to redirect an
|
|
72
|
+
existing turn. Deferred native fixtures exercise all three supported protocols
|
|
73
|
+
while the selector operation is still pending, not just after it settles.
|
|
74
|
+
|
|
75
|
+
### Global switch responsiveness (#342)
|
|
76
|
+
|
|
77
|
+
Models first reads metadata-only `get()` and separately hydrates display names
|
|
78
|
+
with nonforcing `ensureIdentity()`. Slow inactive-name queries do not hold the
|
|
79
|
+
Switch control. Unknown names remain unknown; route/activity/membership evidence
|
|
80
|
+
still gates controls and the Host independently verifies any requested switch.
|
|
81
|
+
An identity hydration result captured before a mutation or actual Remote/
|
|
82
|
+
authorization/credential lifecycle replacement cannot overwrite newer state.
|
|
83
|
+
Parent callback identity changes alone do not recreate the account lifetime.
|
|
84
|
+
|
|
85
|
+
The Host overlaps fresh identity and available-model preflight under one
|
|
86
|
+
60-second operation signal. It never replaces fresh verification with the
|
|
87
|
+
ten-minute display cache. Both must finish successfully before selector CAS;
|
|
88
|
+
identity key, membership, route/activity, canonical authorization and revision
|
|
89
|
+
checks remain, including post-commit confirmation. A failed branch aborts the
|
|
90
|
+
other and drains both before releasing the mutation fence, without automatic
|
|
91
|
+
retry or another account fallback. The strict save result updates the account
|
|
92
|
+
card; parent status refresh remains separate. This reduces a serial preflight
|
|
93
|
+
critical path to overlapping work, not zero network latency or proven live
|
|
94
|
+
timing. Synthetic deferred tests establish ordering, not production speed.
|
|
95
|
+
|
|
96
|
+
- Keep multiple independently authorized GitHub Copilot accounts in one DSH
|
|
97
|
+
profile. Models retains the global default. Sessions without an override
|
|
98
|
+
inherit that default at each new turn; explicit Session choices take priority.
|
|
99
|
+
- Models manages reauthorization/removal and the global default; Credits supports
|
|
100
|
+
add-only authorization without selection. Its compact no-search dropdown
|
|
101
|
+
applies to this Session's subsequent turns. No standalone
|
|
102
|
+
composer selector, one-turn override or DSH application identity replacement.
|
|
103
|
+
- Persist OAuth grants through the existing DSH credentials service. Use
|
|
104
|
+
official pi-ai login, refresh and transport, not copied credentials, a token
|
|
105
|
+
backup/refill scheme, a separate credential store, a second wire or Core edits.
|
|
106
|
+
- Preserve the existing `llm-pi-ai/github-copilot` record without moving or
|
|
107
|
+
copying it. It is the compatibility account when no active account is stored.
|
|
108
|
+
Newly added accounts are directly authorized into plugin-owned records.
|
|
109
|
+
- Changing the account must not change Session histories, selected models,
|
|
110
|
+
future global defaults, model exclusions or billing/Usage records. A selected
|
|
111
|
+
model unavailable to the new account fails explicitly, without substitution.
|
|
112
|
+
- Freeze an admitted turn's account before Auto assessment. Later Session/global
|
|
113
|
+
choices do not redirect its steps, native retries or hosted search. Block
|
|
114
|
+
reauthorization/removal of its pinned record until native turn end/disposal.
|
|
115
|
+
Never cancel a running answer automatically. Explain that encrypted historical replay can be
|
|
116
|
+
account-bound; do not silently remove replay or replay a message.
|
|
117
|
+
- No automatic fallback to another account on quota exhaustion, authorization
|
|
118
|
+
failure, missing records or invalid settings.
|
|
119
|
+
|
|
120
|
+
## Public API evidence
|
|
121
|
+
|
|
122
|
+
Official DSH `0.2.0-rc.2`, commit
|
|
123
|
+
`639ed015397290b3745d163aafe02ffee4aa3f84`, exposes
|
|
124
|
+
`PiAiAdapterOptions.auth.credentials`. Its adapter source was compared
|
|
125
|
+
byte-for-byte with that commit. DSH `authorization.registerFlow()` registers a
|
|
126
|
+
flow per credential key; `credentials.modifyRecord()` serializes mutations.
|
|
127
|
+
|
|
128
|
+
Published pi-ai `0.87.1` accepts a public `CredentialStore` in `createModels()`.
|
|
129
|
+
`Models.login()` persists directly through that store. `Models.getAuth()`
|
|
130
|
+
refreshes OAuth under its serialized mutation; each account can supply an
|
|
131
|
+
independent store binding without changing provider IDs or model IDs.
|
|
132
|
+
|
|
133
|
+
An isolated experiment with unchanged pi-ai and synthetic in-memory stores
|
|
134
|
+
verified independent native login, no refresh for valid tokens, parallel
|
|
135
|
+
account-local refresh, captured-store stability after selection changes,
|
|
136
|
+
preservation after refresh failure, and independent logout. All HTTP was
|
|
137
|
+
mocked. This is SDK composition evidence, not live OAuth, DSH durable storage,
|
|
138
|
+
native gateway or model-call proof.
|
|
139
|
+
|
|
140
|
+
GitHub's authenticated `GET /user` returns the identity corresponding to the
|
|
141
|
+
GitHub authorization token. The current native OAuth requests `read:user`.
|
|
142
|
+
Its `refresh` field holds that GitHub token; the short-lived `access` field
|
|
143
|
+
holds a different Copilot request token. Never exchange their purposes.
|
|
144
|
+
|
|
145
|
+
The Copilot SDK `account.getQuota` contract at commit
|
|
146
|
+
`ef04633cc84e4ba8e79888a39259ca276f5de732` returns quota snapshots and accepts
|
|
147
|
+
an account selection identifier or GitHub token. It is an experimental
|
|
148
|
+
SDK/runtime RPC, not a pi-ai API or proof of cross-application AI credits.
|
|
149
|
+
This feature does not introduce another CLI runtime to obtain quota.
|
|
150
|
+
|
|
151
|
+
## Ownership extension
|
|
152
|
+
|
|
153
|
+
The user explicitly approved this limited extension of the previous
|
|
154
|
+
single-record policy:
|
|
155
|
+
|
|
156
|
+
- Official canonical credentials remain under their existing owner.
|
|
157
|
+
- The plugin may own additional `github-copilot/account-<opaque-id>` records,
|
|
158
|
+
obtained by official OAuth writing directly into the target record.
|
|
159
|
+
- All records use the existing DSH credentials service and documented grant
|
|
160
|
+
normalization. No credentials enter Settings, Client, Remotes, logs or docs.
|
|
161
|
+
- Official pi-ai remains the OAuth and refresh implementation owner. The plugin
|
|
162
|
+
owns only account addressing, selection, lifecycle and safe presentation.
|
|
163
|
+
- This does not authorize Core changes, credential cloning, ambient credential
|
|
164
|
+
discovery, copied upstream catalogs or a second general transport adapter.
|
|
165
|
+
|
|
166
|
+
## Account binding and persistence
|
|
167
|
+
|
|
168
|
+
Settings contain an opaque global active account identifier, written with a
|
|
169
|
+
path-level compare-and-swap in the existing `github-copilot` namespace. An
|
|
170
|
+
absent selector means the canonical compatibility account. An invalid selector
|
|
171
|
+
or missing selected record is an error, not permission to use canonical.
|
|
172
|
+
There is no persisted membership list: native `credentials.listRecords()`
|
|
173
|
+
enumerates record keys and kinds, while public identity stays in bounded
|
|
174
|
+
Host-memory cache. No usernames, grants or auxiliary account list are stored
|
|
175
|
+
in Settings. Hidden volatile `sessionAccounts` additionally persists bounded
|
|
176
|
+
`{sessionId, accountId}` overrides, changed through a separate path-level CAS.
|
|
177
|
+
Selecting the same account as the default is still an explicit override.
|
|
178
|
+
Choosing **Follow global default** removes only this Session's row.
|
|
179
|
+
|
|
180
|
+
A request captures an immutable account identifier, record key and selection
|
|
181
|
+
ownership. Its `CredentialStore.read/modify/delete` methods all refer to that
|
|
182
|
+
record. A mutable active-account lookup inside each store method is forbidden:
|
|
183
|
+
an A refresh must never commit into B after a switch.
|
|
184
|
+
|
|
185
|
+
Account identity uses GitHub host plus stable numeric user ID for duplicate
|
|
186
|
+
detection, not usernames or token strings. Identity reads are bounded,
|
|
187
|
+
Host-only, redirect-refusing and cancellation-aware. Normalize only required
|
|
188
|
+
public identity fields, discard unrelated `/user` fields, and reject results
|
|
189
|
+
whose credential/selection evidence changed during the read.
|
|
190
|
+
Host normalization and strict Remote decoding share the same bounded login
|
|
191
|
+
pattern. It accepts ordinary names and GitHub.com Enterprise Managed User names
|
|
192
|
+
with underscore-separated shortcodes, including setup admin names. This is not
|
|
193
|
+
support for a custom enterprise OAuth host; `enterpriseUrl` remains unsupported.
|
|
194
|
+
See [GitHub's official username rules](https://docs.github.com/en/enterprise-cloud@latest/admin/managing-iam/iam-configuration-reference/username-considerations-for-external-authentication).
|
|
195
|
+
|
|
196
|
+
Token refresh remains lazy. Inactive accounts need not hold fresh Copilot
|
|
197
|
+
tokens. Refresh uses native `Models.getAuth()` and the corresponding DSH record
|
|
198
|
+
mutation. Failure preserves the account's stored grant and does not affect
|
|
199
|
+
other records. Reauthorization targets the same account slot and must detect
|
|
200
|
+
unexpected identity replacement before activating it.
|
|
201
|
+
|
|
202
|
+
## Add and switch transactions
|
|
203
|
+
|
|
204
|
+
Adding an account runs native OAuth in an independent slot. It does not
|
|
205
|
+
overwrite or change the active account. Identity and model metadata validation
|
|
206
|
+
must complete before the new slot can be selected. Partial authorization is
|
|
207
|
+
reported truthfully and can be retried or explicitly removed.
|
|
208
|
+
|
|
209
|
+
The Models card keeps the GitHub verification link, selectable manual URL,
|
|
210
|
+
one-time authorization code, copy action and cancellation together while
|
|
211
|
+
device authorization is pending. A confirmed OAuth completion is followed by
|
|
212
|
+
a separately reported identity-and-model verification phase; neither phase
|
|
213
|
+
changes the global default. The Host's operation state, not a Client guess,
|
|
214
|
+
proves when that verification phase begins. Normal pending authorization is
|
|
215
|
+
progress, not a terminal busy error; technical diagnostics remain available in
|
|
216
|
+
a collapsed disclosure. Unknown blockers are not replaced with a speculative
|
|
217
|
+
list. **Refresh account information** remains an identity refresh only and
|
|
218
|
+
does not complete or cancel authorization.
|
|
219
|
+
|
|
220
|
+
Switching has a preparation phase and a commit phase:
|
|
221
|
+
|
|
222
|
+
Route eligibility reads official rc.2 SettingsForms through redacted
|
|
223
|
+
`describe()` values and revision-bearing namespaces; it does not require the
|
|
224
|
+
retired `get()` method. Missing or malformed configuration still means
|
|
225
|
+
incomplete evidence, not an absent native route. The legacy reader remains
|
|
226
|
+
available for retained compatibility fixtures. Account persistence acceptance
|
|
227
|
+
uses real SettingsForms and the production route diagnostic, without an
|
|
228
|
+
eligibility override.
|
|
229
|
+
|
|
230
|
+
1. Capture the selector revision and verify managed-only route eligibility.
|
|
231
|
+
2. Validate target identity, refresh authorization as needed and check account
|
|
232
|
+
model metadata without publishing it as the active account.
|
|
233
|
+
3. Hold an admission fence during commit. Existing account-pinned managed
|
|
234
|
+
turns may continue; unbound legacy preparation remains conservatively fenced.
|
|
235
|
+
4. CAS the selector, read back committed settings and confirm target evidence.
|
|
236
|
+
5. Update the default directory and UI without revoking another account's
|
|
237
|
+
running turn/proofs or writing model/history/default selection. Credential
|
|
238
|
+
replacement revokes only the matching account runtime and search/quota proof.
|
|
239
|
+
|
|
240
|
+
`COPILOT_ACCOUNTS_BUSY` is transient: each account status read reevaluates
|
|
241
|
+
current managed Agent activity, operation leases and authorization. A rejected
|
|
242
|
+
switch must not remain busy after that work settles. Reading status does not
|
|
243
|
+
refresh credentials or retry the rejected switch. In Models, use **Refresh
|
|
244
|
+
account information** after work ends to update the mounted view. With only
|
|
245
|
+
one saved account, first use **Add GitHub account**; a **Switch** control is
|
|
246
|
+
shown only for another saved account. No running work is cancelled for this.
|
|
247
|
+
|
|
248
|
+
Failed preparation leaves the old selector unchanged. A committed selector
|
|
249
|
+
followed by failed readback is reported as uncertain, never successful and
|
|
250
|
+
never automatically rolled back. Cross-process/external mutations are guarded
|
|
251
|
+
by revisions and evidence checks; an in-process fence is not a cross-namespace
|
|
252
|
+
or cross-process transaction guarantee.
|
|
253
|
+
|
|
254
|
+
Operations include model preparation, Auto assessment, model discovery,
|
|
255
|
+
native auth refresh, managed answer streams and hosted search. Release leases
|
|
256
|
+
on completion, failure, cancellation and disposal. Switching never terminates
|
|
257
|
+
native retries, rewrites native retry policy or manufactures Usage.
|
|
258
|
+
An abandoned signal-free prepared call has no public completion/cancellation
|
|
259
|
+
evidence; it conservatively retains its account mutation barrier until disposal.
|
|
260
|
+
Changing the global default can still proceed without redirecting that call.
|
|
261
|
+
A guessed idle timeout must not permit reauthorization/removal of its account.
|
|
262
|
+
|
|
263
|
+
## Route compatibility
|
|
264
|
+
|
|
265
|
+
Core's canonical route still reads its canonical record. Do not intercept
|
|
266
|
+
Core's store, mutate its prototypes or mirror selected grants into its record.
|
|
267
|
+
The first multi-account delivery therefore requires a managed-only profile.
|
|
268
|
+
Existing canonical configuration, running/selected legacy routes, or
|
|
269
|
+
incomplete route evidence blocks switching with a named diagnostic.
|
|
270
|
+
|
|
271
|
+
Any migration uses the existing separately approved, explicit configuration
|
|
272
|
+
workflow. Enabling accounts does not remove native profiles, rewrite stored
|
|
273
|
+
Sessions or silently migrate their route IDs.
|
|
274
|
+
|
|
275
|
+
Sign-out deletes only the selected record. Inactive records remain intact.
|
|
276
|
+
For a noncanonical selection, the selector remains unchanged after sign-out:
|
|
277
|
+
the missing selected slot fails explicitly, never falls back to canonical.
|
|
278
|
+
In a managed-only profile with complete route/Session evidence and no admitted
|
|
279
|
+
activity, Models still permits an explicit CAS switch to a stored valid account
|
|
280
|
+
or Add into a new inactive slot. The missing-slot view remains an error even
|
|
281
|
+
when `switchable` is true for that recovery. Existing Sign in never recreates
|
|
282
|
+
the missing slot with an unverified replacement identity; use Add then Switch.
|
|
283
|
+
|
|
284
|
+
## Presentation and quota
|
|
285
|
+
|
|
286
|
+
Models shows current identity and available accounts, Add, Switch and explicit
|
|
287
|
+
authorization recovery. Switch confirmation describes profile-wide impact and
|
|
288
|
+
history/replay risks. Activity and route blockers remain visible.
|
|
289
|
+
|
|
290
|
+

|
|
291
|
+
|
|
292
|
+

|
|
293
|
+
|
|
294
|
+
These images render the actual candidate components with synthetic accounts
|
|
295
|
+
and quota in an isolated browser. They are not real authorization, supplier
|
|
296
|
+
availability or loaded Desktop evidence.
|
|
297
|
+
|
|
298
|
+
The separate `githubCopilotAccounts` namespace exposes `get`, `ensureIdentity`,
|
|
299
|
+
`refreshIdentity`, `add`, `cancel`, `switchAccount`, `reauthorize` and
|
|
300
|
+
`removeAccount`. Existing Remote descriptors are retained. The removal method
|
|
301
|
+
cannot be named `remove`: official rc.2 reserves that inherited service name
|
|
302
|
+
and rejects the entire Client contribution.
|
|
303
|
+
|
|
304
|
+
Credits shows the Session's next-turn account and quota under the existing title.
|
|
305
|
+
Its **Switch** dropdown marks the current choice, scrolls long lists internally
|
|
306
|
+
and offers **Follow global default** plus add-only authorization at the bottom.
|
|
307
|
+
Reauthorization, removal and global
|
|
308
|
+
selection remain in Models. Changing
|
|
309
|
+
the preference while a turn runs leaves that turn's old account pinned; the
|
|
310
|
+
popover identifies it separately. Other Sessions are unchanged. Unknown identity
|
|
311
|
+
is unavailable, not a stale username presented as current.
|
|
312
|
+
|
|
313
|
+
One Models **Manage** groups account management, the new-Session continuation
|
|
314
|
+
default and shared exact-ID model preferences. The existing Session policy is
|
|
315
|
+
under the composer Credits/usage popover → **Visible-history continuation** →
|
|
316
|
+
**Session policy**; it appears only for an open Session whose effective model
|
|
317
|
+
is the managed account-discovered Copilot route. Choose **On** after reviewing
|
|
318
|
+
the loss disclosure. This is distinct from the Models new-Session default and
|
|
319
|
+
applies to subsequent turns and managed native compaction summaries, including
|
|
320
|
+
on the same account. Active turns keep their captured policy; enabling does not
|
|
321
|
+
send or retry a message. See the [synthetic composer capture](./images/copilot-session-continuation.png)
|
|
322
|
+
and [continuation contract](./session-continuation.md). When off, an account change pauses for explicit
|
|
323
|
+
persistent-enable/keep-off/cancel consent. See the [approved experience and mock](./account-management-experience.md).
|
|
324
|
+
|
|
325
|
+
Completed managed turns have a compact **Account** disclosure alongside native
|
|
326
|
+
Usage/selection actions through the public assistant-actions slot. This is
|
|
327
|
+
request-account evidence, not billing attribution or a subagent account rollup.
|
|
328
|
+
It freezes a verified cached identity at admission. Missing identity starts one
|
|
329
|
+
nonforcing, bounded lookup for the exact admitted account without delaying model
|
|
330
|
+
delivery. A successful lookup may fill missing identity only while that same
|
|
331
|
+
turn/signal remains active and uncancelled, retaining the first verified name.
|
|
332
|
+
Account execution evidence is still created only on the first real ordinary
|
|
333
|
+
native chunk, not discovery, preparation or auxiliary Auto assessment. Late
|
|
334
|
+
lookups never backfill completed turns. Host memory retains at
|
|
335
|
+
most 64 Sessions and 128 turns per Session. Restart, cold history, eviction or a
|
|
336
|
+
request with no native delivery is unknown. Failed reads are distinct from
|
|
337
|
+
unknown evidence; Retry rereads the same turn without inference. Official rc.2
|
|
338
|
+
has no ignorable account-history event seam: no new durable event is emitted.
|
|
339
|
+
Only a login captured for that turn is shown; otherwise identity is explicitly
|
|
340
|
+
unavailable, never inferred from current settings or today's account selector.
|
|
341
|
+
Credits selector labels unknown original/saved authorizations without exposing
|
|
342
|
+
opaque record identifiers; these presentation labels do not fetch identity or
|
|
343
|
+
change account selection.
|
|
344
|
+
|
|
345
|
+
Identity and quota have separate error states but must share account evidence.
|
|
346
|
+
Models account mutations invalidate mounted Credits presentation before the
|
|
347
|
+
request and reject late responses. A data-free plugin-owned notification causes
|
|
348
|
+
a fresh read after settlement; it does not cancel native work or broadcast
|
|
349
|
+
identity, grants or quota between surfaces. Failed reads never restore the
|
|
350
|
+
previous username as current.
|
|
351
|
+
Missing quota is not zero; pooled, stale, request-based and credit-based
|
|
352
|
+
snapshots retain their distinct meanings. Do not claim cross-app aggregation
|
|
353
|
+
or relabel request counts as AI credits.
|
|
354
|
+
|
|
355
|
+
Visible Models and Credits surfaces ensure identity on mount, visibility return
|
|
356
|
+
and their sixty-second display cadence. `get` and `viewForAccount` remain
|
|
357
|
+
metadata-only. Nonforcing ensure reuses a fresh ten-minute identity, joins
|
|
358
|
+
same-account in-flight work and observes a thirty-second failure cooldown;
|
|
359
|
+
explicit **Refresh account information** bypasses cooldown but joins active
|
|
360
|
+
work. There is no render-driven request loop or background polling after
|
|
361
|
+
unmount. Credential changes revoke identity and pending work; cancelled or
|
|
362
|
+
unverified identity is never shown as current. Verified display names remain in
|
|
363
|
+
the bounded Host cache beyond the ten-minute revalidation interval; freshness
|
|
364
|
+
expiry alone never replaces an inactive account name with unknown. Names are
|
|
365
|
+
display metadata, not authorization/model-access proof, and are not persisted
|
|
366
|
+
across Host restarts. Models and Session Credits ensure missing configured
|
|
367
|
+
account names through the same per-account lookup without activating those
|
|
368
|
+
accounts. Membership limits bound the parallel lookups and each retains its
|
|
369
|
+
timeout/single flight/cooldown. Credential invalidation and failed verification
|
|
370
|
+
still clear names. Session ensure retains explicit
|
|
371
|
+
Agent lookup and rechecks account selection before returning.
|
|
372
|
+
|
|
373
|
+
Quota settles independently of identity renewal only after account-coherent
|
|
374
|
+
metadata checks. Identity failures cannot turn account quota into zero or
|
|
375
|
+
discard an otherwise valid same-account reading. Sanitized diagnostics separate
|
|
376
|
+
timeout, certificate, network, auth rejection, rate limiting and other HTTP
|
|
377
|
+
failures; no raw response/error text or credentials enter the Remote. These
|
|
378
|
+
diagnostics do not establish the cause of earlier screenshots or prove live
|
|
379
|
+
supplier health. Account switching, duplicate checks and reauthorization still
|
|
380
|
+
require fresh authenticated identity validation, not the presentation cache.
|
|
381
|
+
|
|
382
|
+
## Acceptance gates
|
|
383
|
+
|
|
384
|
+
- Native public authorization and credentials services: independent writes,
|
|
385
|
+
cancellation, restart persistence, per-record serialization and strict grant
|
|
386
|
+
JSON. No changes to the official fixture implementation.
|
|
387
|
+
- Both public gateways and strict Client codecs: no credential fields, stable
|
|
388
|
+
descriptor identities, bounded arguments and visible errors.
|
|
389
|
+
- Exact published native adapter: correct account auth on all supported
|
|
390
|
+
protocols; account-local refresh and failure; no ambient fallback.
|
|
391
|
+
- Races: A refresh versus B selection, admission versus switch, external record
|
|
392
|
+
replacement, settings conflicts, disposal and late identity/quota responses.
|
|
393
|
+
- Behavior: absent-selector compatibility, missing-selector fail-closed,
|
|
394
|
+
duplicate identity, same-account renewal, canonical route blocker, selected
|
|
395
|
+
model missing, revoked permissions and account-bound replay.
|
|
396
|
+
- UI: Models global-default management, Session switching only inside Credits,
|
|
397
|
+
global inheritance/explicit same-value override, frozen running turns,
|
|
398
|
+
historical Account/unknown/read-error distinctions, dark/light/mobile,
|
|
399
|
+
keyboard interaction, loading/error states and no overlapping controllers.
|
|
400
|
+
- No native Usage filtering, history edits, default selection changes or
|
|
401
|
+
automatic model/account substitution.
|
|
402
|
+
- Full current rc.2 Windows/Linux CI, package and tarball gates, reviewed merge,
|
|
403
|
+
immutable GitHub Release and same-byte npm publication before claiming
|
|
404
|
+
delivery. Installation and restart need separate authorization.
|
|
405
|
+
|
|
406
|
+
## Current evidence and limits
|
|
407
|
+
|
|
408
|
+
Focused native adapter and gateway tests use unchanged rc.2 public APIs and
|
|
409
|
+
synthetic credentials/HTTP. They exercise Responses, Chat Completions and
|
|
410
|
+
Anthropic account dispatch, immutable refresh bindings, strict gateway
|
|
411
|
+
reachability, target CAS, admission and same-identity renewal.
|
|
412
|
+
|
|
413
|
+
The temporary-profile persistence fixture uses native `LocalCredentialProvider`,
|
|
414
|
+
profile boot/Loader, ConfigEditor, SettingsForms CAS, authorization and SDK.
|
|
415
|
+
Independent grants and the selector survive disposal/reopen; stale CAS does
|
|
416
|
+
not replace the config fiber; account A refresh never writes B. It injects
|
|
417
|
+
model preflight, and mocks identity/provider
|
|
418
|
+
HTTP. It is not full production lifecycle or live OAuth qualification.
|
|
419
|
+
|
|
420
|
+
The local frozen install and full gate are blocked by HTTP 404s for unchanged
|
|
421
|
+
official rc.2 dependencies from the configured enterprise mirror. No package
|
|
422
|
+
versions, registry policy or Core artifacts were substituted. The complete
|
|
423
|
+
required Windows/Linux CI matrix remains the release gate; focused tests,
|
|
424
|
+
synthetic UI and persistence do not replace it or prove live model success.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Managed Copilot compaction budgets
|
|
2
|
+
|
|
3
|
+
Visible-history continuation does not impose a whole-request byte cap. Its
|
|
4
|
+
reasoning-only cancellable work bounds are separate from native token admission;
|
|
5
|
+
neither ciphertext length nor `COPILOT_CONTINUATION_REASONING_WORK_LIMIT` is
|
|
6
|
+
classified as context overflow. Enabled native automatic compaction still owns
|
|
7
|
+
summary commit and request rebuild before continuation filters the new payload.
|
|
8
|
+
See [continuation safety and evidence](./session-continuation.md#public-integration-and-safety).
|
|
9
|
+
|
|
10
|
+
Tracking: [#146](https://github.com/cloga/dsh-github-copilot/issues/146). This is a plugin-only implementation; publication, loaded-runtime state and live-provider acceptance remain separate evidence.
|
|
11
|
+
|
|
12
|
+
## Why two protections are needed
|
|
13
|
+
|
|
14
|
+
The motivating session recorded both `summarization truncated at the token cap (incomplete checkpoint)` and later HTTP 400 input-context overflow in automatic/manual compaction. A successful summary after an explicit model change used 7575 output tokens under an 8192-token cap. These observations do not establish hidden reasoning consumption, either model's contemporaneous capacity, or that simply changing the cap solves the problem.
|
|
15
|
+
|
|
16
|
+
The managed account catalog already retains three different facts: combined context capacity C, independent prompt ceiling I when supplied, and output capability O. Previously I produced a warning only. Stock Core exposes C and triggers normal pressure relative to C; that does not independently enforce I.
|
|
17
|
+
|
|
18
|
+
## Budget admission
|
|
19
|
+
|
|
20
|
+
`request-budget.ts` resolves validated operational policy without mutating catalog metadata:
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
R = explicit requested output cap, otherwise advertised output capability O
|
|
24
|
+
hard input limit = min(I when supplied, C - R) - safetyTokens
|
|
25
|
+
pressure input limit = floor(hard input limit * pressureRatio)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
An independent input ceiling does not include output, so output is subtracted from C, not twice from I. Missing I does not mean unlimited combined context. If catalog context was conservatively derived from prompt-only metadata, it retains that existing interpretation; the plugin does not invent an unadvertised larger combined capacity.
|
|
29
|
+
|
|
30
|
+
Invalid/nonpositive model capacities, invalid output caps, caps above O and nonpositive headroom fail explicitly. Impossible policy headroom is `INVALID_REQUEST`, not a request to compact an arbitrarily small history. An input estimate above a valid budget becomes `CONTEXT_WINDOW_EXCEEDED` with a plugin-owned, numeric diagnostic. This is a local estimated admission decision, not a fabricated provider rejection.
|
|
31
|
+
|
|
32
|
+
Final admission happens at the native provider boundary after Core conversion, before model transport. It uses the larger of native usage-anchored estimation and fresh current system/tool/message estimation, so a tiny historical usage anchor cannot hide a newly enlarged fixed prefix. Images and opaque native replay retain native representation and estimation; neither is decrypted, reconstructed or discarded. Token estimation is heuristic, not the provider's exact tokenizer. Safety allowance and genuine provider failure handling remain necessary.
|
|
33
|
+
|
|
34
|
+
The pinned SDK already has its own context-dependent output clamp. This plugin preserves the caller's requested cap rather than introducing another hidden rewrite. No second generic serializer, account-model table, credential lifecycle or native protocol transport is added.
|
|
35
|
+
|
|
36
|
+
## Earlier pressure and transaction ownership
|
|
37
|
+
|
|
38
|
+
For [#280](https://github.com/cloga/dsh-github-copilot/issues/280), a public `agent/pre-step` listener additionally prevents known continuing-step pressure before Core appends `step/start`. It awaits downstream decisions, delegates rejection/cancellation, and requires a committed plugin-owned managed route, no model-selection notice, and a readable native `modelSelection` projection with `pending: null`. First steps and unknown/pending selections delegate: a prior request header is not proof of the next selected route.
|
|
39
|
+
|
|
40
|
+
The account callback supplies only a current capacity threshold; an empty message array used for this lookup is not an input estimate. The public native token meter measures the existing surface. Above that threshold, the initiating Agent's currently bound engine runs one `compactIfNeeded(agent, 'context-overflow', signal)` transaction, respecting disabled auto and the effective zero/invalid overflow policy. Native failures and cancellation propagate before model-attempt admission; a null/no-progress result delegates to the retained final protections. The next native request is built from the replacement surface. No retry counter, history, usage sample or selected model is rewritten.
|
|
41
|
+
|
|
42
|
+
This is **partial prevention**, not general accounting repair. In the unchanged rc.2 synthetic AgentLoop fixture, the existing post-start pressure refusal creates an unsampled attempt and the strict native turn aggregate is unavailable, even after successful recovery. With pre-step reduction, the same two real model steps retain their complete native total without that attempt. Native turn-tail matches events by their recorded turn; compaction replacements for an earlier turn are not samples of the current turn. No samples are suppressed to produce the total.
|
|
43
|
+
|
|
44
|
+
Cold/first-step routes, pending model changes, later system/tool-prefix growth, unavailable evidence, indivisible oversized units and final converted hard-admission errors can still produce missing native turn Usage. Already-recorded totals remain unchanged. The plugin does not fabricate zero usage, display partial sums as full totals, or reinterpret transport failures as compaction pressure.
|
|
45
|
+
|
|
46
|
+
The public `llm/stream` listener sees a committed, frozen loop request. It requires:
|
|
47
|
+
|
|
48
|
+
- The exact plugin-owned managed route and an ordinary marked agent-loop call, not an auxiliary purpose.
|
|
49
|
+
- The public initiating Agent, matching Session ID, and complete matching committed call configuration.
|
|
50
|
+
- Current account-bound descriptor/proof and a valid operational budget.
|
|
51
|
+
- Optional token meter and stock automatic compaction with a positive effective overflow-retry policy.
|
|
52
|
+
|
|
53
|
+
Only then does it emit one terminal local pressure error before dispatch. Official `agent/request-error` recovery owns pruning, balanced-span selection, compaction locks, source checks, durable shrink and bounded retry. The next request is rebuilt from the replaced surface. The plugin never compacts inside a frozen request then sends the stale request, changes the retry counter, or registers a competing compaction service.
|
|
54
|
+
|
|
55
|
+
Disabled auto recovery or zero retries are respected. Missing/mismatching optional capabilities delegate unchanged and can produce one bounded unavailability diagnostic; the hard native guard remains. Cancellation before iteration wins over pressure. There is no polling, automatic metadata refresh from the pressure listener, or whole-Session dump.
|
|
56
|
+
|
|
57
|
+
On official `0.2.0-rc.2`, Desktop presets may isolate `compaction` inside a child group, invisible to both the global plugin context and a plain `agent.ctx.get('compaction')`. The plugin uses the public `agentPresets.composedPreset()` and `serviceFor(agent, 'compaction')` methods to resolve the initiating Agent's current preset engine. A bound preset with no engine remains unavailable; it never borrows another scope's policy. Only an Agent without a bound preset uses its own context lookup. The lookup is repeated rather than caching a replaced engine. Auto's recovery-availability diagnostic uses the same helper.
|
|
58
|
+
|
|
59
|
+
This fixes scope wiring, not a new automatic command: native pressure and `agent/request-error` still invoke the selected engine. Neither `/compact` nor `/copilot-compact` is called by this listener. If the recovery engine is selected, automatic segmentation defaults on for known oversized summary input or one exact native summary capacity failure, within the same native transaction. `automaticRecovery: false` restores its automatic single-summary path; native `auto: false` and retry bounds remain authoritative. Ordinary timeout/transport failures do not become context overflow.
|
|
60
|
+
|
|
61
|
+
## Summary purpose policy
|
|
62
|
+
|
|
63
|
+
Replay-scope rejection is not input overflow: a smaller summary request can still
|
|
64
|
+
carry old encrypted reasoning that the supplier refuses. Ordinary and automatic
|
|
65
|
+
compaction never inherit chat continuation consent. The selected recovery engine's
|
|
66
|
+
explicit `/copilot-compact visible-history` authorizes one lossy Responses summary
|
|
67
|
+
operation, with safe failure-code reporting and unchanged native transaction
|
|
68
|
+
ownership. Review [consent and bounded limitations](./manual-compaction-recovery.md#explicit-visible-history-summary-recovery)
|
|
69
|
+
before invoking. This does not decrypt or repair replay, rewrite source history,
|
|
70
|
+
retry a failed message or guarantee capacity recovery.
|
|
71
|
+
|
|
72
|
+
Official `GenerateOptions.purpose` permits adapter-specific generation policy. For `purpose: 'compaction'`, `prefer-low` selects supported `minimal`, otherwise supported `low`, only when no effort was supplied or materialized by Core/the configured native profile. Explicit and resolved defaults win; unsupported low controls preserve the provider default. `preserve` disables this purpose default. Normal conversations and other purposes keep their existing reasoning behavior.
|
|
73
|
+
|
|
74
|
+
The stock summary record takes its requested output cap from the owning compaction configuration. Therefore the plugin does not silently increase/decrease that cap in middleware or alter summary route identity. It preserves native `max-tokens` output truncation as failure, distinct from input overflow. Public summaries, encrypted replay and native stop reasons remain native-owned.
|
|
75
|
+
|
|
76
|
+
Each dispatch captures its own policy, descriptor lease and admission-failure state. SDK lazy-stream wrapping may retain only an exception's text; the outer adapter restores only the exact locally captured budget failure, never reclassifying unrelated auth/network errors by guesswork. Concurrent calls do not share mutable purpose or failure state, and cancellation/account invalidation still wins.
|
|
77
|
+
|
|
78
|
+
## Settings
|
|
79
|
+
|
|
80
|
+
All three keys belong to the existing `github-copilot` settings namespace:
|
|
81
|
+
|
|
82
|
+
| Key | Default | Contract |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| `requestBudgetSafetyTokens` | 4096 | Non-negative safe integer; more allowance means less usable input. Lowering it trades away preventive headroom and does not change native SDK safeguards. |
|
|
85
|
+
| `requestBudgetPressureRatio` | 0.9 | 0.01 through 1, step 0.01, for eligible ordinary loop calls only. |
|
|
86
|
+
| `compactionReasoning` | `prefer-low` | Supported low-cost default for otherwise unspecified summary effort; `preserve` keeps existing defaults. |
|
|
87
|
+
| `responsesRequestCompression` | `false` | Experimental, opt-in lossless gzip for eligible managed HTTP Responses requests; no context reduction or additional retry. |
|
|
88
|
+
|
|
89
|
+
The existing `enabled` switch remains hosted-search-only. These controls do not change global/default model selection, enable another account route, or transfer conversation data to another provider.
|
|
90
|
+
|
|
91
|
+
## Existing oversized history and recovery limits
|
|
92
|
+
|
|
93
|
+
HTTP `408 / user_request_timeout` is separate from input-budget overflow. For the exact observed request-body timeout response, the managed route supplies a safe `COPILOT_REQUEST_BODY_TIMEOUT` diagnostic and final JSON UTF-8 byte count when available, while preserving native failure classification and retries. These bytes include serialized messages, tools and replay/attachments; they are not token occupancy or an advertised HTTP-size limit. Repeated unchanged retries cannot reduce the request. After retries exhaust, an explicit native compaction may reduce compressible history, but giant fixed prefixes/attachments and network/service faults may remain. The existing optional manual recovery engine must be separately selected; installing the account plugin does not enable it. No 408 triggers automatic compaction, hidden history trimming, credential refresh, model switching, timeout changes or a second retry loop. Consult [GitHub troubleshooting](https://docs.github.com/en/copilot/how-tos/troubleshoot-copilot/troubleshoot-common-issues) and [service status](https://www.githubstatus.com/) without bypassing network policy.
|
|
94
|
+
|
|
95
|
+
`github-copilot.responsesRequestCompression` is a separate, experimental, default-off upload mitigation. Explicit opt-in gzips only account-proven official Copilot HTTPS `/responses` POSTs with a string JSON body, at the existing plugin-owned Fetch seam after native serialization, replay normalization and context admission. Custom Fetch, other APIs, explicit `auto` and WebSocket remain unchanged. It starts at 256 KiB, skips compression work above 32 MiB, and requires at least 5% and 4 KiB savings; every ineligible, oversized or uneconomic body remains the original native request. The asynchronous work is cancellation/account/deadline fenced before dispatch. No route pinning, hidden trimming, token/admission changes, identity resend after 415, retry or model switch is added.
|
|
96
|
+
|
|
97
|
+
For a verified 408 after a compressed request, the diagnostic labels the original JSON composition bytes separately from the prepared gzip HTTP-body bytes (excluding transport framing). The compressed size is not confirmed delivered bytes, a token count, a provider size limit or proof of a network cause. A skipped compression may include one fixed reason; request bodies and headers are not retained. Synthetic controls support an opt-in mitigation only, not a universal provider capability or guaranteed 408 cure. Keep it off where endpoint support is unknown; disabling it affects later dispatches and installation never enables it.
|
|
98
|
+
|
|
99
|
+
For [#263](https://github.com/cloga/dsh-github-copilot/issues/263), the same public final-body fetch hook additionally captures a monotonic fetch-invocation-to-response-header duration, before clone observation. This is round-trip latency, not measured upload progress, throughput or time spent reading the body. Only a verified exact error triggers numeric composition analysis; successful requests are not analyzed or retained.
|
|
100
|
+
|
|
101
|
+
For #291, request-scoped public Node/Undici diagnostic channels also observe local body-write completion and native response-header timing, negotiated TLS ALPN when exposed, and a public Node writable-buffer count at body-write completion. Exactly one matching native request is required; no matching event, multiple requests (such as redirects), and more than eight request identities yield explicit unavailable, ambiguous or work-limited evidence, never combined partial timings. H2 connection evidence does not depend on H1-only header-write events; reused H2 sockets or custom transports may leave ALPN unavailable. Subscriptions stop when Fetch settles, including errors, before bounded response-clone analysis. Only an exact verified timeout emits these numeric observations; no request fields, headers, URLs, content, replay or credentials are retained or logged. The original Fetch arguments, signal, Response/error, dispatcher, proxy, connections and retries remain native-owned.
|
|
102
|
+
|
|
103
|
+
Local `bodySent` means the client reported body-write completion, **not** measured upload duration, kernel acknowledgement, supplier receipt or model execution. No completion event is not proof that upload was incomplete. A zero Node writable buffer is likewise not proof of remote receipt. This can correlate later real failures without changing their classification, but does not establish a supplier cause or cure recurring 408s; synthetic healthy requests are not live failure acceptance.
|
|
104
|
+
|
|
105
|
+
Original serialized value spans partition total bytes into `input`/`messages`, tool definitions, protocol-owned top-level `instructions`/`system` and residual keys/framing. Within conversation only, supported structural image blocks and opaque replay string spans form disjoint subsets; the rest includes text/tool history, framing and unknown representations. Completions system/developer messages stay in conversation. Image URLs and file references are counted as wire blocks, not fetched/decoded file sizes. Responses encrypted content and Anthropic signature/redacted data are counted without interpreting or decrypting replay; no raw contents, IDs, hashes or credentials are reported.
|
|
106
|
+
|
|
107
|
+
Responses tool pictures are also image blocks: the native SDK serializes them under `function_call_output.output[]`, separately from ordinary message `content[]`. Older plugin diagnostics incorrectly classified those spans as remaining history, so an old report of zero image bytes does not establish an image-free request. The corrected diagnostic applies only to newly observed failures; stored failures and history are not rewritten. Unknown output arrays remain residual, and the fix changes neither total bytes nor native image admission, offload budgets, replay or transport.
|
|
108
|
+
|
|
109
|
+
Analysis up to 16 MiB retains the existing span validator. Larger verified-408 JSON bodies use a cooperative span scanner up to 32 MiB without allocating a full payload object graph or decoding image/replay content. Its 65,536-character yields, two-second monotonic deadline and four concurrent scan slots bound additional work; both paths retain 64-level depth, 131072-token, 65536-value and 128-serialized-key-character limits. Separately opted-in physical request observations may already have started that same work after Fetch invocation, without holding up ordinary native response delivery. Verified-408 guidance may await it and preserves Fetch-to-header timing measured before analysis. Missing, malformed, unsupported, size/work/time-limited or cancelled evidence remains explicitly unavailable, never partial success-shaped totals. Replay validation and recovery keep the original 16 MiB limits. These limits are **not supplier request limits or admission controls**. A measured approximately 20.4 MiB body does not establish why a timeout occurred. If image blocks dominate, an explicitly selected smaller `chatMaxRequestImageBytes` can authorize native image offload; if compressible history dominates, explicit native compaction can help. Tool definitions and opaque replay may remain; small failing requests still warrant network/service investigation. Neither choice is performed automatically or guaranteed to reduce 408 frequency.
|
|
110
|
+
|
|
111
|
+
This implementation is preventive, not a general rescue summarizer. A manual summary whose full input already exceeds the hard budget fails before model transport. It does not silently trim, fabricate a partial checkpoint, or claim that refusing the request recovered the history. Giant fixed prefixes or an indivisible latest unit can also prevent useful reduction.
|
|
112
|
+
|
|
113
|
+
The separately selected recovery engine now plans through the published native
|
|
114
|
+
token meter, in the same token units as its budget (#418). Earlier content-byte
|
|
115
|
+
planning could falsely reject a long balanced tool span even when its token
|
|
116
|
+
estimate fits. This correction changes no final managed admission, output cap,
|
|
117
|
+
tool pairing, native transaction or retry bound. A fitting planning estimate is
|
|
118
|
+
not proof of supplier acceptance.
|
|
119
|
+
|
|
120
|
+
The #228 investigation confirmed a separate Auto undercount (#230): Core reasoning blocks caused the incompatible pi-ai estimator to throw and drop complete assistant messages. Auto now uses the native Core meter, without changing final native provider admission. This fixes candidate selection evidence, not a genuinely oversized summary. In the reported failure class, a roughly 508k-token summary input exceeded a roughly 368k-token input budget even with a 65,536-token output reservation. Reducing output reservation cannot remove an independently binding prompt ceiling.
|
|
121
|
+
|
|
122
|
+
On official `0.2.0-rc.2`, the stock summarizer uses an explicitly configured summary route, otherwise the latest committed request header, otherwise the Agent's initial options. Changing only a pending picker selection therefore does not necessarily change a manual `/compact` request's model. Repeating the same over-budget summary or disabling admission is not a recovery procedure.
|
|
123
|
+
|
|
124
|
+
Official configuration already supports a separate summary route and output cap. Selecting a suitable authorized route/cap is an explicit deployment choice, not an automatic fallback. Increasing the output cap consumes combined-context headroom; decreasing it can reproduce the observed incomplete-checkpoint failure.
|
|
125
|
+
|
|
126
|
+
A separately selected recovery engine for compressible already-oversized manual and automatic summaries is specified in [compaction recovery](./manual-compaction-recovery.md). The stock Basic engine and preventive request guard remain unchanged. Selection requires explicit same-scope configuration migration, not installation alone. The selected engine bounds segmentation to 16 physical calls including an initial capacity failure; no hidden wire interceptor, arbitrary-error fallback or recursive retry is used. The native summary event is unmarked when several real calls contributed to one checkpoint.
|
|
127
|
+
|
|
128
|
+
## Official-first evidence and retirement
|
|
129
|
+
|
|
130
|
+
Exact target: official `ddefc45fbc7f8e46dd73185e68295696d1297887` (`0.1.6-alpha.2`).
|
|
131
|
+
|
|
132
|
+
- [Model context and purpose contract](https://github.com/deepseek-ai/deepseek-harness/blob/ddefc45fbc7f8e46dd73185e68295696d1297887/packages/llm/llm/src/types.ts): combined context metadata and purpose-specific adapter policy.
|
|
133
|
+
- [Basic compaction](https://github.com/deepseek-ai/deepseek-harness/blob/ddefc45fbc7f8e46dd73185e68295696d1297887/packages/compaction/compaction-basic/src/index.ts): official pressure/overflow/manual paths and summary extension.
|
|
134
|
+
- [Summary owner](https://github.com/deepseek-ai/deepseek-harness/blob/ddefc45fbc7f8e46dd73185e68295696d1297887/packages/compaction/compaction-basic/src/summarizer.ts): request prefix, purpose, output cap and truncated-output refusal.
|
|
135
|
+
|
|
136
|
+
Support is partial: official transactional compaction is reused, while independent Copilot input admission and summary-purpose default policy remain companion-owned. Retire the corresponding companion component only after official behavior covers both input/output constraints, correct request identity, cancellation, purpose handling and equivalent regression/unchanged-runtime acceptance. Do not remove official recovery or falsify contextWindow to reduce the diff.
|
|
137
|
+
|
|
138
|
+
Current scoped-recovery evidence additionally targets unchanged official `639ed015397290b3745d163aafe02ffee4aa3f84` (`0.2.0-rc.2`): [public Agent preset service lookup](https://github.com/deepseek-ai/deepseek-harness/blob/639ed015397290b3745d163aafe02ffee4aa3f84/packages/preset/agent-preset-registry/src/index.ts). Native service lookup is complete and reused; plugin pressure still needs the account input budget. Retire this helper when the official request-budget path supplies equivalent preset-owned admission and recovery evidence.
|
|
139
|
+
|
|
140
|
+
## Verification boundary
|
|
141
|
+
|
|
142
|
+
Managed HTTP/SSE liveness is separate from compaction and HTTP 408. Core's idle watchdog measures translated assistant chunks, not heartbeat bytes. The plugin observes actual nonempty bytes without parsing or fabricating output: the default byte-idle limit stays five minutes, while native semantic silence is bounded to ten minutes. Consumer think time does not count; endless heartbeats still fail. Caller cancellation and native retry ownership remain unchanged. Explicit WebSocket/auto transport and `chatStreamLiveness: false` retain native-only timing.
|
|
143
|
+
|
|
144
|
+
`github-copilot.chatMaxRequestImageBytes` exposes the existing native image projection budget with its unchanged 20971520-byte default. An explicit smaller budget can reduce outgoing image payloads by offloading older images into mapped read-only paths; original history is retained, but outgoing image visibility changes. This is not a total request cap, automatic compaction, or a supplier size limit. No live budget reduction is performed by installation or by a 408. Fixed text/tool prefixes and network/service faults may still cause upload timeouts.
|
|
145
|
+
|
|
146
|
+
Pure arithmetic and policy tests, public-middleware fixtures, and the real published native adapter/SDK with synthetic transport cover separate layers. Required cases include independent/combined bounds, changed prefixes, explicit/default output and effort, metadata/credential invalidation, direct/prepared parity, concurrent calls, cancellation, output truncation and oversized manual input. Existing full plugin gates and exact-Core compatibility fixtures remain required; source inventory is not their execution result.
|
|
147
|
+
|
|
148
|
+
No live model inference, local Desktop installation, activation or restart is implied by unit tests or publication. Preserve immutable GitHub/npm byte identity and coordinate Desktop/Ops pins separately after release verification.
|