GeezerVison is showing github.com — feat: add chat context pinning storage and push trigger by kylecarbs · Pull Request #26385 · coder/coder
Conversation
kylecarbs
commented
Jun 15, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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
changed the title
feat: hydrate and refresh chat context from agent snapshots
feat: add chat context pinning storage and push trigger
Jun 15, 2026
|
@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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
sreya
sreya approved these changes
hugodutka
Awaiting requested review from hugodutka
Uh oh!
There was an error while loading. Please reload this page.
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.
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.
|