Repository navigation
fix(ai-vault): name Copilot sessions from the typed prompt, not its injected context - #11
Merged
Merged
Conversation
…njected context Copilot CLI records each user turn twice: `content` is the prompt as typed, and `transformedContent` is what the model sees, which Copilot prefixes with injected context starting `<current_datetime>...</current_datetime>`. The parser preferred `transformedContent`, so that prefix became the session title, preview and copyable first prompt for essentially every Copilot session — names that start `<current_datetime>` in the sidebar and in Agent Session History. Prefer `content`, and fall back to `transformedContent` only when the typed prompt is absent or blank, so a turn that carries nothing else still previews. The tag is not one the normalizer already hides: `HIDDEN_TEXT_BLOCKS` covers `system-reminder`, `codex_internal_context` and `goal_context`, all machinery a user never types. Adding `current_datetime` there would hide genuine user text for every agent, so the fix stays at the field the parser chooses. Both caches that persist the parsed title are bumped, because both replay a file whose mtime and size still match: - parse cache 4 -> 5, for the scanner's own answer and the previews overlaid on an indexed row; - search index 6 -> 7, for the session list itself. The index consumer keeps its own cursor and never consults the parse cache, and `sessionSearchReadDecision` skips a file whose stat matches its row, so a parse-cache bump alone would leave the wrong title in Agent Session History indefinitely. Costs one cold rebuild of each cache, once. Verified with a regression test that carries both fields and asserts the typed prompt wins; restoring the old precedence reproduces the reported `<current_datetime>...` title. `pnpm test src/main/ai-vault src/main/ai-vault-search` (169 files, 1524 tests), `pnpm tc`, and the changed-code quality gate all pass.
The readiness gate added to this file by the staged routing work (`7d2af35858`) needed one more import, and upstream had left the file at exactly the 300-line `max-lines` cap — so static analysis has been failing on `nplez1/main` for every PR since, not just this one. Move the three optional envelope fields (turn boundary, restored marker, observation provenance) out of the applicator's body and into `withAgentStatusEnvelopeFields` beside the other payload shaping in `normalize-agent-status-event.ts`. Each field stays optional and an absent one still leaves the payload untouched, so the fold is behavior-preserving; the `statusPayload` those branches sat next to is unchanged, since the suppression check and the terminal title still read the orchestration-only payload. No `max-lines` disable and no per-file cap bump, per AGENTS.md. The applicator now has headroom instead of sitting one import away from breaking again.
…l test
`987a8424aa` finished moving the panel's enable button onto the content consent
and said it brought the tests with it, but it missed this upstream test, which
still typed its settings mock and asserted `aiVaultSearch: { enabled: true }`.
The panel writes `contentEnabled`, so the assertion has been failing on
`nplez1/main` since — the fork's own test run for that commit covered the
ai-vault and session-search suites, where the renamed field was already in use,
and not this renderer panel test.
Assert the field the panel writes. The mock's type and the assertion are the
only changes; no production behavior moves.
nplez1
pushed a commit
that referenced
this pull request
Oct 21, 2026
…win projections stay on their host (review-5 #2 #9 #11) (stablyai#30890) * fix(renderer): host writes route only through the strict owner, and twin projections stay on their host (review-5 #2 #9 #11) A selected ssh: host that two paired servers proxy now resolves ambiguous at the one selected-host resolver, so no caller can fall back to this app's own SSH connection. File Explorer and SSH mutation expectations derive the full {endpoint, place} pair from resolveOwner, so a server folder's nested SSH target stays the write's host. A local lineage write projects onto its own host's rows only. The id-only store-write ratchet now also covers persistence repo-row lookups by id alone (review-5 #10's shape). * fix(ratchet): the id-only lookup scan also sees optional chaining and destructured ids * fix(renderer): an unstamped folder keeps reading its host from its repos; editor focus fallback left for a follow-up * docs(renderer): the File Explorer owner comment names its folder fallback
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.
ELI5
Copilot's session log keeps two copies of everything you type: the words you actually wrote, and a
longer version Copilot builds to send to the model, which begins with a timestamp tag. The app was
reading the longer version, so the timestamp tag became the session's name.
The branch also carries two small fixes for things that were already broken on the base branch
(
nplez1/main) and blocking every PR against it. They are separate commits, described at the end.What Changed
Before: almost every Copilot session showed up in the sidebar and in Agent Session History under
a name like
After: the same session is named after the prompt the user typed:
The mechanism:
session-scanner-copilot-parser.tsread the session title, list preview and copyablefirst prompt from
data.transformedContent. It now readsdata.content(the prompt as typed), andfalls back to
transformedContentonly whencontentis missing or blank, so a turn that carriesnothing else still previews.
Two caches that persist the parsed title are bumped, because both replay an unchanged file whose
mtime and size still match:
4 → 5— the scanner's own answer, and the previews overlaid onto an indexed row;6 → 7— the session list itself.Also in this PR (commits 2 and 3, described under Why): a refactor to bring
agent-status-event-applicator.tsback under themax-linescap, and an update to one stale paneltest that still asserted the pre-rename settings key.
Why
Copilot CLI stores each
user.messagetwice:contentis the prompt as typed,transformedContentis the model-facing text, which Copilot prefixes with injected context starting
<current_datetime>...</current_datetime>. PreferringtransformedContenttherefore put theinjected prefix at the front of every title, where the 96-character title cap then truncated it to
fit — which is why so many names started the same way.
The tag is not one the text normalizer already hides.
HIDDEN_TEXT_BLOCKScoverssystem-reminder,codex_internal_contextandgoal_context, all machinery a user never types; addingcurrent_datetimethere would silently strip genuine user text for every agent, not just Copilot.Choosing the right field at the parser is the narrower fix.
The search-index bump is required, not belt-and-braces. Agent Session History lists titles from the
index once a pass has completed, the index consumer keeps its own cursor and never consults the
parse cache, and
sessionSearchReadDecisionreturnsskipfor a file whose stat matches its row —so bumping only the parse cache would have left every unchanged Copilot session titled
<current_datetime>...in the panel indefinitely.Both bumps cost one cold rebuild of each cache, once.
The two pre-existing base failures, and why they are here
nplez1/maincurrently fails CI on its own. Both failures reproduce with this PR's four commitsreverted, and I chose to clear them here rather than leave the PR red behind a broken base.
static analysis—agent-status-event-applicator.tssits at 301 code lines against the 300max-linescap. The file was exactly at the cap upstream, and the staged routing work(
7d2af35858) added one import to it. I verified upstream's version of that file passes oxlintand the fork's does not. The fix moves the three optional envelope fields (turn boundary,
restored marker, observation provenance) into
withAgentStatusEnvelopeFieldsbeside the otherpayload shaping, which is behavior-preserving and leaves headroom rather than one import away
from breaking again. No
max-linesdisable and no per-file cap bump, perAGENTS.md.test / tests node 24 7/8—AiVaultPanel.legacy-filter.test.tsxexpectsaiVaultSearch: { enabled: true }, but the panel writescontentEnabled. The test file isbyte-identical to upstream's; the fork's
987a8424aarenamed the panel's write and said itbrought the tests with it, but that commit's own test run covered the ai-vault and session-search
suites, not this renderer panel test. The fix asserts the field the panel actually writes; no
production code moves.
Linked Issue
No tracked issue: issues are disabled on this fork, and the Copilot naming problem was reported
directly. This is a fork PR, not upstream-bound.
Visual Proof
The entire user-visible effect is one string, so the regression test's own before/after is the
change. With the old precedence (before):
With the fix (after):
No screenshot or video is attached: this is a parsed-string fix with no layout, styling or
interaction change, and capturing a live panel would require running the packaged app. Happy to
attach a CDP screenshot of the session list before/after if you want one for the record — say the
word and I will rebuild and capture it.
Testing
For the Copilot naming fix: added
uses Copilot's typed prompt, not its injected context, for the titletosrc/main/ai-vault/session-scanner.test.ts. The fixture carries bothcontentand a<current_datetime>-prefixedtransformedContent, and asserts the title and first preview bothcome from the typed prompt. Restoring the old precedence makes it fail with exactly the reported
string, so it is a real regression test rather than a restatement of the fix.
For the two base fixes: the existing suites cover both changes, and I ran the panels, hooks and
settings directories in full. No new test was needed for the refactor (it is behavior-preserving and
covered by the existing
ipc-eventssuite); the panel test I changed is itself the regression testfor the rename.
Run locally:
pnpm exec oxlint --format github(the exact CILintcommand) — 0 errors, 2 pre-existingunicorn/prefer-array-flat-mapwarnings in unrelated mobile test files.pnpm tc— clean.pnpm test src/main/ai-vault src/main/ai-vault-search— 169 files, 1524 tests.pnpm test src/renderer/src/hooks/ipc-events src/renderer/src/components/right-sidebar src/renderer/src/components/settings— 453 files, 3508 tests.
pnpm run check:code-quality:changed— 0 findings across the 7 changed files.oxfmt— clean on all changed files (also enforced by the pre-commit hook).Platforms: the parser is platform-independent text handling, and its tests drive the scanner
directly. The remote Copilot source (
remote-session-scanner-copilot-source.ts) calls the sameparser, so SSH and paired-runtime sessions get the same fix. The other two fixes are renderer-side
and platform-independent. I did not run a live desktop/mobile/SSH session; only the automated suites
above.
pnpm buildwas not run locally — CI'spackageandpackage (windows)jobs are the buildcheck.
AI Disclosure
Implemented by pi, an AI coding agent, at @nplez1's direction. Diagnosis (parser field precedence,
the two cache invalidations, and the root cause of both base failures), the fixes, and the
regression test were all produced by the agent; commits and PR are @nplez1's.
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
same record and picks a different string from it. The applicator refactor moves spreading code
between modules and changes no decision.
use it. The other two fixes are local renderer code.
with no protocol change.
transcript is modified, and no persisted format other than the two caches changes.
for one string. The only cost is the one-time cache rebuild the bumps require.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)On that last box:
pnpm tc, the exact CI oxlint command, the ai-vault/session-search suites and therenderer hooks/sidebar/settings suites all pass locally.
pnpm buildwas not run locally — theElectron packaging jobs (
package,package (windows)) passed on the previous run and re-run onthis one.
One caveat on scope: this PR is nominally about Copilot session names and now also carries two base
fixes. They are separate commits so they can be reviewed — or split out — on their own terms.