GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: add chat context pinning storage and push trigger by kylecarbs · Pull Request #26385 · coder/coder

Conversation

@kylecarbs

@kylecarbs kylecarbs commented Jun 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Foundation for the Workspace Context Sources RFC (phase 3). The agent push (#25983) and coderd snapshot storage (#26145) already persist per-agent context snapshots; this PR lands the chat-side storage plus the agentapi push trigger that a follow-up will use to read them. It does not touch chatd and changes no behavior — nothing wires an implementation yet.

What changed

  • Adds four nullable columns to chats — context_aggregate_hash, context_dirty_since, context_dirty_resources, and context_error — and rebuilds the chats_expanded view.
  • Adds three queries — SetChatContextSnapshot, HydrateAgentChatsContext, MarkChatsContextDirtyByAgent — with dbauthz wrappers and audit entries. They are store-interface methods covered by a Postgres test (TestChatContextHydration).
  • Adds the agentapi.ContextDirtyMarker interface and invokes it inside the PushContextState transaction, publishing collected events only after commit.

Intentionally inert

There are no production callers of the three queries and no implementation wired for ContextDirtyMarker, so the push trigger is dormant. This is deliberate: the PR is the durable storage/query foundation only.

The actual integration — the chatd implementation that hydrates/dirties chats and backs a refresh endpoint, consuming the pinned context in prompt building, the rich SDK types + UI, and retiring the live per-turn pull — lands as a single follow-up PR. Splitting this way keeps the schema/query layer reviewable on its own and keeps the integration whole in one place.

Refs #25983, #26145.

Decision log
  • Columns over a side table. The four chats columns are the durable model (accepting the one-time chats_expanded view/CTE churn). last_injected_context is deliberately left untouched — it is load-bearing for the live per-turn context pull.
  • Keep agentapi, drop chatd. The earlier revision wired the hydrate/dirty implementation through chatd and added a PUT /chats/{chat}/context refresh endpoint. Those were removed so this PR is pure foundation; agentapi defines the trigger + interface (it does not import chatd), and the chatd implementation arrives with the full integration.
  • No new experiment flag. The columns are dark and unread by prompt building.
  • Authz. The new query wrappers authorize chat updates under the chat RBAC object / ResourceChat, consistent with the existing system chat mutators.

🤖 Generated by Coder Agents on behalf of @kylecarbs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Docs preview

📖 View docs preview for docs/admin/security/audit-logs.md

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot assigned kylecarbs Jun 15, 2026
@kylecarbs
kylecarbs requested a review from hugodutka June 15, 2026 18:32
sreya
sreya approved these changes Jun 15, 2026
View reviewed changes
@kylecarbs
kylecarbs marked this pull request as ready for review June 15, 2026 20:23
@kylecarbs
feat: add chat context pinning storage and push trigger
832dc67
Foundation for the Workspace Context Sources RFC phase 3. Agent push
(#25983) and coderd snapshot storage (#26145) persist per-agent context
snapshots; this lands the chat-side storage plus the agentapi trigger
that a follow-up will use to read them. It is inert: nothing wires an
implementation yet, so behavior is unchanged and chatd is untouched.

Add four nullable columns to chats (context_aggregate_hash,
context_dirty_since, context_dirty_resources, context_error) and rebuild
the chats_expanded view. Add three queries -- SetChatContextSnapshot,
HydrateAgentChatsContext, MarkChatsContextDirtyByAgent -- with dbauthz
wrappers and audit entries. The queries have no production callers yet;
they are store-interface methods covered by a Postgres test.

Add the agentapi ContextDirtyMarker interface and invoke it inside the
PushContextState transaction, publishing collected events only after
commit. No implementation is wired in this PR, so the trigger is dormant.
The full context integration (the chatd implementation, prompt
consumption, SDK/UI, and retiring the per-turn pull) lands separately.

Refs #25983, #26145.
@kylecarbs
kylecarbs force-pushed the chat-context-hydration branch from 4d6ec76 to 832dc67 Compare June 15, 2026 20:52
@kylecarbs kylecarbs changed the title feat: hydrate and refresh chat context from agent snapshots feat: add chat context pinning storage and push trigger Jun 15, 2026
@kylecarbs
kylecarbs marked this pull request as draft June 15, 2026 20:53
@kylecarbs
kylecarbs marked this pull request as ready for review June 15, 2026 21:36
@kylecarbs

kylecarbs commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

@hugodutka since you're offline right now, I avoided doing the chatd component as part of this. I'm going to do that in a separate PR that also integrates the UX.

I just got @sreya to approve the DB changes, which are in the RFC.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kylecarbs
kylecarbs merged commit 210261b into main Jun 15, 2026
40 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@kylecarbs
kylecarbs deleted the chat-context-hydration branch June 15, 2026 21:41
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@sreya sreya sreya approved these changes
@hugodutka hugodutka Awaiting requested review from hugodutka

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@kylecarbs kylecarbs

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@kylecarbs @sreya
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.