Repository navigation
fix(agent,coderd): defer plugin pack name dedupe until after per-chat pack filtering - #225
Conversation
… pack filtering The workspace agent deduplicated skills and custom agents by name across every pack on disk, so a disabled, deleted, or stale pack file could hide the same-named resource of an enabled pack before chatd's per-chat and per-commit filtering ran. The agent now keeps same-named pack resources and only lets ordinary workspace skills and agents shadow them. chatd deduplicates the pack rows that survive filterPackResources, keeping the first in source order.
|
@codex review
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5402341017
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…d bound the copies Only packs coderd installs under ~/.coder/plugins are filtered per chat, so only their same-named skills and agents are deferred to chatd. Ordinary resources and packs outside that root keep first-wins dedupe on the agent and always shadow managed packs. Deferred copies are added after the resource caps, within twice MaxResources and the remaining bytes, so they cannot displace live rows or push past coderd's per-push limit. chatd dedupes only managed rows, so an unmanaged row always wins. Also give each parallel subtest of the chatd dedupe test its own context: the parent's expired before the subtests ran and failed the pack lookups closed.
|
@codex review
|
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Merged by the pstack parity lead. The pull_request fork-ci run 43124702347 passed on head c848107, and its chat-tests job covers TestAgentContextFilesAndSkillsLoadedIntoChat. Codex receipt 6810419783 is clean on that head, and 0 of 2 threads are unresolved. Tests cover the change, including the rename case, both scan orders and the capacity bounds. The code sits behind fork-plugin-packs, which the daily server does not enable, so the final W6 pack UAT will cover it live. Main is ahead only by #222, which changes docs. Fixes #214. Adds an ARCHITECTURE.md Author TODO for Mike. |
Fixes #214
What changed
The workspace agent no longer deduplicates skills and custom agent definitions from managed plugin packs (packs under
~/.coder/plugins, the only oneschatdfilters per chat) against each other before it pushes the context snapshot. Name deduplication among those packs now runs inchatd, afterfilterPackResourcesdrops rows from packs that are not enabled for the chat or not part of the pinned commit.agent/agentcontext: a managed pack resource is dropped if an ordinary resource or an unmanaged pack uses the same name. The first managed row for each name stays in the normal pipeline and competes under the resource caps like any other row. Later managed duplicates are set aside and appended after the caps, only into spare capacity (at most2*MaxResourcesrows, and only the bytes the snapshot has left). Ordinary resources and unmanaged packs keep first-wins in scan-root order, as before. The upstreamresolve.gochange is two hook lines plus the exemption indeduplicateSkills.coderd/x/chatd/fork_plugin_gate.go: after per-chat and per-commit filtering, a dedupe pass keeps the first surviving managed pack row for each name (the lexically first pack directory, the same order the agent scans in). Ordinary and unmanaged-pack rows are never deduplicated here.Behavior notes
chatd, which lost the resource.MaxResources(up to twice it) only when managed packs hold same-named duplicates. This stays within the 1000-row push limitcoderdallows at the default cap.coderdpaired with a new agent can show duplicate pack rows, because the oldcoderddoes not run the dedupe pass. This clears oncecoderdis updated.Validation
Ran in a container at this head:
gofmt,go build ./agent/... ./coderd/...,go vet, andgo test -count=3 ./agent/agentcontext/...passed.coderd/x/chatdwith-run 'TestDedupePackResourceNames|TestFilterPackResources|Pack|AgentDefinition|AgentType|Skill|ContextResources'passed exceptTestAgentContextFilesAndSkillsLoadedIntoChat. That test also fails 3/3 onorigin/mainb62d2396fain the same container, and it passes in fork-ci. fork-ci runs on the PR.Author TODO
coderd/x/chatd/ARCHITECTURE.md(the fork-plugin-packs gating section, around line 1231) should say that the agent defers name dedupe for managed-pack skills and agents, and thatfilterPackResourcesdeduplicates them by name after filtering. I left the document alone, per the repository rule.