* nes: implement cursor line distance check for serving from cache
* address review: use rebasedEdit for rejection, skip cross-file cursorOffset, fix test types
nes: fix: address PR review for _performFetch extraction
- Rename FetchResult.Error to FetchResult.FetchFailure to avoid
confusion with built-in Error class
- Move fetchResultPromise .then/.catch/.finally handlers before
await Promise.race so early-return paths get setFetchEndTime()
telemetry
* Fix double compaction on first-turn budget exceeded
When the first render of a turn throws BudgetExceededError and the
background summarizer is Idle, we fall back to a synchronous foreground
'full' summarization via renderWithSummarization. That path did not set
the 'summary applied this iteration' flag, so the post-render gate
(>= 80% + Idle) would also kick off a background 'inline' compaction
in the same buildPrompt call — producing both
summarizeConversationHistory-full and summarizeConversationHistory-inline.
- Set the flag on both foreground fallback call sites so the post-render
gate correctly short-circuits.
- Rename 'summaryAppliedThisIteration' to 'didSummarizeThisIteration' to
better reflect that it covers any summarization work (pre-render bg
apply, budget-exceeded bg apply, or foreground fallback).
* Update extensions/copilot/src/extension/intents/node/agentIntent.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Refactor inline summarization handling in ToolCallingLoop
* Refactor conversation summarization settings and improve logging in AgentIntent
* Refactor agent intent to improve telemetry and remove obsolete test file
* Refactor inline summarization handling: remove unused properties and related tests
* Remove unused summarization instruction from AgentPromptProps interface
* Refactor AgentIntentInvocation to streamline model capabilities handling in background summarization
* Update debugName for background summarization to reflect inline context
* Update logging message in AgentIntentInvocation for clarity and remove unused test suite for inline summarization
* Update hidden Model B agent prompt for evals
* Refine hidden Model B prompt tag structure
* updating prompt to remove codex string
* main merge
* adding task execution tag
* adding task execution tag
* fix: cache CCA disabled results with 5-min TTL to reduce /enabled traffic
The checkCCAEnabled() method previously only cached enabled=true results
(introduced in 19541d79ea). For the majority of users whose repos have CCA
disabled, every provideChatSessionProviderOptions() call bypassed the cache
and hit the jobs/:owner/:repo/enabled CAPI endpoint unconditionally. With
growing adoption, this became significant upstream traffic.
Fix: cache all /enabled results. enabled=true keeps the 30-min TTL.
enabled=false/undefined uses a new 5-min TTL (CCA_DISABLED_CACHE_TTL_MS),
short enough that users who just enabled CCA won't wait long, but long enough
to dramatically reduce repeated calls.
To support the shorter TTL for disabled entries without changing the enabled
TTL, TtlCache.set() now accepts an optional per-entry ttlMs override that
takes precedence over the cache-wide TTL.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: surface unexpected /enabled status codes (e.g. 429) in telemetry
Previously, isCCAEnabled's default case returned { enabled: undefined }
with no statusCode, swallowing 429 rate-limit and 5xx responses.
Changes:
- Widen CCAEnabledResult.statusCode from 401|403|422 to number so
unexpected codes can be propagated
- Return statusCode: response.status in isCCAEnabled's default case
- Add sendTelemetryErrorEvent('copilot.codingAgent.CCAIsEnabledUnexpectedStatus')
in checkCCAEnabled for any status code outside {401, 403, 422}, with
isRateLimited flag for quick 429 filtering in dashboards
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor: hoist knownStatusCodes to constant and add GDPR annotation
- Extract CCA_KNOWN_STATUS_CODES to file-level Set to avoid re-creating
it on every call and centralize the list of handled status codes
- Add __GDPR__ comment block for the new
copilot.codingAgent.CCAIsEnabledUnexpectedStatus telemetry error event
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rename the `inSessions` task property to `inAgents` across all source,
tests, JSON configs, and documentation.
Also fix a bug in `updateTask` where `setProperty` with a numeric
array index was inserting a duplicate entry instead of replacing the
existing one. The fix replaces the entire tasks array with the updated
entry mapped in at the correct index, consistent with how `removeTask`
already works.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
refactor(xtab): extract _performFetch from _streamEditsImpl
Separate the HTTP fetch lifecycle (FetchStreamSource setup, makeChatRequest2,
initial error handling, line stream construction with cursor-tag removal and
latency logging) into a dedicated _performFetch method.
This makes the fetch infrastructure self-contained and returns a clean
AsyncIterable<string> line stream + getFetchFailure callback for downstream
format handlers, matching the pattern already used by
XtabCustomDiffPatchResponseHandler.
_streamEditsImpl is now a coordinator: it calls _performFetch, then dispatches
to format handlers, then post-processes edit-window results.
Part of #308744
* ghost: debt: migrate to CompletionsFetchService and remove dead code
* ghost: propagate copilotAnnotations in convertStreamToApiChoices
The v2 stream processor (convertStreamToApiChoices) was not setting
copilotAnnotations on the returned APIChoice objects, despite tracking
them in the CompletionAccumulator. This caused annotations (e.g., code
citations) to be lost.
Add accumulator.annotations.current to the createAPIChoice helper.
* ghost: fix tests to mock ICompletionsFetchService for v2
After migrating to CompletionsFetchService, LiveOpenAIFetcher no longer
calls ICompletionsFetcherService (via postRequest). Tests that mocked
the old low-level fetcher with StaticFetcher were silently bypassed.
Add StaticCompletionsFetchService adapter that bridges StaticFetcher
responses into ICompletionsFetchService by parsing SSE bodies through
jsonlStreamToCompletions. Wire it up in ghostText.test.ts and
inlineCompletion.test.ts setupCompletion helpers.
Without this, `this._controller.items.get(uri)` returns undefined... but the metadata is stored on the item so that is needed to resolve.
FYI @mjbvz as an interesting quirk of the API.
- Add isClientBYOKEnabled() method to CopilotToken class
- Update isBYOKEnabled to allow users with client_byok=1 token flag
- Add github.copilot.clientByokEnabled context key for VS Code core model picker
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* nes: replace implicit _icon state with explicit outcome state machine (#308719)
Replace the implicit \`_icon\` field with an explicit \`_outcome: LogContextOutcome\`
discriminated union in InlineEditRequestLogContext.
- Define LogContextOutcome type with 8 states: pending, succeeded,
noSuggestions, cached, cachedFromGhostText, skipped, cancelled, errored
- Derive icon from outcome via switch in _resolveIcon()
- Keep _isCompleted orthogonal (lifecycle flag, not an outcome)
- Add _setOutcome() with debug warning on invalid re-transitions
- Refactor setIsCachedResult to use direct field copy (avoids
triggering outcome transitions during bulk data inheritance)
- Add double-completion warning in markCompleted()
- No caller changes required — public method signatures unchanged
* nes: unify live and static log entry paths (#308720, #308722)
Remove the static \`add()\` path from InlineEditLogger — all log entries
now use the live pattern with callbacks for icon/content resolution.
- Remove InlineEditLogger.add() and _liveRequestIds tracking
- Ghost text provider now uses addLive() + markCompleted() in finally
block, ensuring lifecycle is always closed
- Remove redundant add() call in NES inlineCompletionProvider (the live
entry was already registered via addLive())
This eliminates the static snapshot path that was the source of frozen
spinner bugs, and ensures ghost text entries have proper lifecycle
management matching the NES pattern.
* nes: fix stale icon caching in ChatPromptItem tree nodes (#308721)
Store the main entry reference in ChatPromptItem and always resolve
the icon unconditionally from it, preventing stale icon snapshots.
- Add _mainEntryRef field to ChatPromptItem
- setMainEntry() always sets iconPath (even to undefined when icon
resolves to undefined), clearing any previous stale value
- withFilteredChildren() re-resolves from the entry ref via
setMainEntry() instead of copying a potentially stale iconPath
This makes stale icons structurally impossible — the icon is always
derived from the live entry state on each tree refresh.
* nes: map cancelled outcome to skipped icon instead of loading
Cancelled requests should show a terminal icon, not a spinner.
Map 'cancelled' to Icon.skipped alongside 'skipped' to avoid
frozen-spinner appearance in the log tree.
* refactor: remove getSessionIdForWorkspaceFolder method and update clearWorkspaceChanges to handle both session IDs and folder URIs
* Address comments