Skip to content

feat: discover plugin packs in agentcontext behind fork-plugins - #156

Merged
ibetitsmike merged 22 commits into
mainfrom
mike/plugin-packs-1-manifests
Nov 11, 2026
Merged

ibetitsmike merged 22 commits into
mainfrom
mike/plugin-packs-1-manifests

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

A plugin pack is a directory holding a Claude Code (.claude-plugin/plugin.json), Cursor (.cursor-plugin/plugin.json) or agent-plugins.org (plugin.json) manifest. The agentcontext resolver now discovers packs among the direct children of every scan root (and the scan root itself), reads their manifests, and emits the pack's declared skills and agents directories like ordinary skill and agent containers, honoring the Cursor manifest's declared directories.

Pack-contributed resources carry the manifest path in SourcePath, and a new chatd gate drops them from the pinned prompt and the context popup when the fork-plugin-packs experiment is off, so a deployment without the flag matches upstream.

Round 5 (codex review) additions: pack emission is negotiated - PushContextStateResponse carries a fork_plugin_packs capability that the server sets from the experiment, and the agent emits pack rows only after seeing it, so a rolling upgrade with a newer agent behind an older replica never persists pack rows; the derived drift hash skips pack subagent rows while fork-agent-definitions is off; and the live-sync change comparisons include source_path so a pack marker flip on an unchanged .mcp.json reclassifies its MCP rows. The experiment was renamed fork-plugins -> fork-plugin-packs (ExperimentForkPlugins -> ExperimentForkPluginPacks); file names fork_plugin_*.go are unchanged. The KindPlugin manifest resource itself stays agent-local: no DRPC or workspace agent context body kind carries a plugin payload yet, so nothing is pushed for the manifest. Manifest-declared directories that escape the pack root (absolute paths or ..) are rejected.

The watcher watches pack roots and their declared containers so pack changes re-resolve the snapshot, and ~/.coder/plugins joins the default scan roots as the install location for the later PRs in the stack.

Refs #12 (PRD 6.7, R7.1, R7.4, R7.5). First of five stacked plugin-packs PRs; install, per-chat enable, rules and pinned skills follow.

Xum opened this PR on behalf of @ibetitsmike.

A plugin pack is a directory holding a Claude Code, Cursor or
agent-plugins.org manifest. The agentcontext resolver now discovers
packs among the direct children of every scan root (and the root
itself), reads their manifests, and emits the pack's declared skills
and agents directories like ordinary skill and agent containers,
honoring Cursor manifest dir overrides while rejecting declarations
that leave the pack root.

Pack-contributed resources carry the manifest path in SourcePath, and
a new chatd gate drops them from the prompt and the context popup
when the fork-plugins experiment is off, so a deployment without the
flag matches upstream. The KindPlugin manifest resource itself stays
agent-local: no DRPC or workspace body kind carries a plugin payload
yet, so nothing is pushed for the manifest.

The watcher watches pack roots and their declared containers so pack
changes re-resolve, and ~/.coder/plugins joins the default scan roots
for installed packs.
Adds fork-plugins to the Experiment enum in the generated spec, the
schemas.md value list and the site Experiment type, matching the
constant added in the parent commit. The enum entries are inserted at
the committed position; swag's map-order nondeterminism across
deployment.go and fork_experiments.go is not committed.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum requested this review on behalf of @ibetitsmike.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T13:41:40.688129Z 8d56c34 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f5983b999

ℹ️ 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".

Comment thread coderd/x/chatd/fork_plugin_gate.go Resolved
Comment thread agent/agentcontext/resolve.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Comment thread coderd/x/chatd/fork_plugin_gate.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Comment thread coderd/x/chatd/fork_plugin_gate.go Resolved
…manifest edits

Codex review follow-ups on PR #156:

- Custom agent types now flow through the fork-plugin gate, so pack
  agents are not offered while fork-plugins is off (the prompt and the
  context popup already were).
- isPackContribution splits on both path separators: the source path is
  stamped by the workspace agent, which may run on Windows while coderd
  runs on Linux.
- A scan root that is itself a pack now routes through the pack walk,
  so its resources carry the manifest path and the gate can drop them;
  ordinary container discovery would have claimed the same files
  unstamped.
- The watcher re-resolves on plugin manifest edits, which fsnotify
  reports as writes that the recognized-name list did not cover.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b922558d1

ℹ️ 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".

Comment thread agent/agentcontext/resolve.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
…oundary, cap pack resources last

Codex round-2 follow-ups on PR #156:

- readPluginManifest stats the manifest and rejects files over the
  64 KiB per-resource payload cap before reading, so a multi-gigabyte
  plugin.json cannot be pulled into memory during resolve or watcher
  synchronization.
- Pack skills and agents resolve symlinks against the pack directory
  instead of the enclosing scan root, so a pack cannot import
  resources from outside its own boundary.
- applyCaps sorts pack contributions last within each kind, so the
  count cap cuts hidden pack rows before ordinary workspace
  resources and the chatd fork-plugin filter never leaves an
  ordinary resource excluded on behalf of a pack.

Covers codex threads 4530856974, 4530856958, 4530856947.
… gate

The round-1 gate fix left the import behind; go build fails the
package and every package that imports it (fork-ci run 42906095273).
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum requested this review on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 941441ef23

ℹ️ 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".

Comment thread agent/agentcontext/fork_plugins.go Resolved
Comment thread agent/agentcontext/resolve.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
…pack rows out of drift

Codex round-3 follow-ups on PR #156:

- readPluginManifest Lstats the manifest and requires a regular
  file, so a checked-in plugin.json symlink (even to /dev/zero) or
  a FIFO is never read, whatever its apparent size.
- A manifest that parses but declares no name is not a pack: the
  directory keeps ordinary discovery instead of being stamped with
  the pack marker the fork-plugin gate filters.
- driftResources drops pack rows, so installing or editing a pack
  cannot change the drift hash that hash-comparing subscribers
  read as a prompt change while fork-plugins is off.

Covers codex threads 4531571858, 4531571869, 4531571863.
…discovery

Three round-3 tests were written against a wrong mental model and
their first execution was the first container validation run:

- TestResolver_PluginPacksExcludedFromDrift resolved two different
  TempDirs and required equal AggregateHashes. The hash covers
  absolute ID and Source strings, so snapshots of different
  directories can never hash equal; a stream diff showed the first
  differing byte was the TempDir serial digit. Resolve one root
  before and after the pack appears instead: identical paths, so
  the only way the hash can move is a pack row leaking into the
  drift set, which is what the test must catch.
- TestResolver_PluginPacksNamelessManifest expected a nested
  pstack/AGENTS.md to be discovered, but ordinary discovery only
  recognizes instruction files at the scan root's top level. Give
  the root a top-level AGENTS.md as the positive control and a
  pack-style skills container under pstack that would be stamped
  if a nameless manifest were accepted, then require nothing from
  pstack to appear.
- TestResolver_PluginPacksManifestSymlinkRejected passed only
  vacuously: with no pack containers in its layout, even an
  accepted symlink emits nothing. Add the skills container and
  require nothing from pstack to appear.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Round-3 follow-ups are in. Head is now d8004d8: a81524e fixes the three round-3 findings (manifest Lstat + regular-file guard, nameless-manifest rejection, pack rows excluded from the drift hash) and d8004d8 corrects the three round-3 tests to match actual resolver discovery (same-root before/after for the drift hash; positive controls and no-pstack-leak assertions for the nameless and symlink cases). Container validation is green on this exact head. Threads replied and resolved.

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d8004d8a91

ℹ️ 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".

Comment thread agent/agentcontext/resolve.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Codex round-4 follow-ups on PR #156:

- The agent excludes pack contributions from its pushed aggregate
  hash unconditionally because it has no experiment knowledge. With
  fork-plugins on, pack rows are pinned prompt content, so editing
  one must mark bound chats dirty; the pushed hash never changed and
  live-sync covers only MCP and ACP, leaving chats on stale pack
  content. chatd now derives the drift hash itself from the pushed
  rows via an optional ContextDriftHasher capability: agentapi stores
  the derived hash on the snapshot row and hydrates and dirties chats
  against it, so the create-time and refresh pinning paths, which
  re-read the snapshot row, stay consistent with the push path by
  construction. With the experiment off the derivation reproduces the
  agent's exclusion, making the derived hash byte-identical to the
  pushed one.
- addPackWatchDirs arms the deepest existing ancestor of each
  declared pack container path: a manifest declaring
  "skills": "components/skills" while only components/ exists got
  no watch that fires when components/skills is created later
  (fsnotify is non-recursive), leaving the pack undiscovered until an
  unrelated resync.

Covers codex threads 4532602312 and 4532602321.
The derived drift hash must land on the snapshot row and return to the
dirty marker so create-time and refresh pinning stay consistent with
the push path.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Round-4 follow-ups are in. Head is now b6161ee: 3f1ce49 makes the chat drift hash experiment-aware (chatd derives it from the pushed rows via a new agentapi ContextDriftHasher capability and the derived value is stored on the snapshot row, so the create-time and refresh pinning paths stay consistent with the push path; with fork-plugins on, pack rows join the drift hash while MCP/ACP stay live-synced, and with it off the derived hash is byte-identical to the agent's pushed aggregate) and arms ancestor watches for missing declared pack containers so a late-created declared container still fires; b6161ee adds the agentapi push-path test for the derived hash. Container validation is green on this exact head (agentcontext suite, chatd drift/gate tests, agentapi push tests, builds). Threads replied and resolved.

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6161ee009

ℹ️ 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".

Comment thread coderd/x/chatd/fork_plugin_drift.go Resolved
Comment thread coderd/x/chatd/fork_plugin_gate.go Resolved
Comment thread agent/agentcontext/resolve.go Resolved
Round 5 of the codex review loop on PR #156 (threads 4533498689,
4533498695, 4533498700.

Emission negotiation (P1, 4533498700): pack rows reached the shared
context tables on the agent's first push, so a rolling upgrade with a
newer agent behind an older coderd replica could persist pack skills
that the old replica pins without a pack gate. PushContextStateResponse
now carries a fork_plugin_packs capability (field 100, fork convention),
agentapi sets it from a server option wired to the fork-plugin-packs
experiment, and the agent's resolver only emits pack rows once a server
advertised it; the Manager triggers a resync whenever the advertised
value flips in either direction, so retraction applies on the next push.

Drift hash (P2, 4533498689): with fork-plugin-packs on but
fork-agent-definitions off, pack subagent rows stayed in the derived
drift hash although ContextResources removes every subagent entry, so
pack agent edits dirtied chats without changing their prompt, tools or
visible inventory. DriftHash now skips KindSubagent pack rows unless
agent definitions are enabled; ordinary subagent rows stay hashed.

Live sync (P2, 4533498695): SyncAgentChatsContextLiveResources compared
only bodies, so an unchanged .mcp.json that gains or loses a plugin.json
manifest reclassified its MCP rows without ever reaching chat pins. Both
change comparisons now include source_path (IS NOT DISTINCT FROM).

Rename (lead decision): experiment fork-plugins -> fork-plugin-packs,
const ExperimentForkPlugins -> ExperimentForkPluginPacks, with
swagger/apidoc/site types regenerated accordingly; fork_plugin_* file
names are unchanged.

Validated in containers w6-r3val5/r3val5b/r3val5c (protoc 23.4 +
pinned plugins, sqlc fork 337309bfb9524f38466a5090e310040fc7af0203 with
SKIP_DUMP_SQL=1): agentcontext suite, targeted chatd and agentapi tests,
and builds of agent/... agentapi/... chatd/... codersdk/... all green.
EOF
)
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Round-5 fixes are on the new head 4846347 (pushed; PR head moved from b6161ee): emission negotiation via the push-response capability, drift-hash pack-subagent exclusion while fork-agent-definitions is off, source_path in both live-sync change comparisons, plus the fork-plugins -> fork-plugin-packs experiment rename. Threads 4533498689/4533498695/4533498700 replied and resolved; container-validated (w6-r3val5c, all green).

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4846347c21

ℹ️ 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".

Comment thread agent/agentcontext/push.go Resolved
Comment thread agent/agentcontext/resolve.go Resolved
Comment thread docs/reference/api/schemas.md Resolved
Round 6 of the codex review loop on PR #156 (threads 4534564265,
4534564269, 4534564274).

Reconnect leak (P1, 4534564265): a long-lived agent that re-established
its dRPC connection against an older replica reused the Manager with the
previous connection's advertised flag still set, so the initial push of
the new connection led with the pack-bearing snapshot before the new
peer's response could reset the capability. RunPush now resets the
advertised flag at entry and re-resolves before the first push, so every
connection starts pack-free and earns the capability back from its own
peer.

Root-pack leak (P1, 4534564269): a scan root that is itself a pack
stamped its top-level AGENTS.md and .mcp.json before the gated emitPacks
call, so an older replica received pack-provided instructions and MCP
configuration marked with a marker it ignores. The capability gate now
covers the whole root-pack branch: without the advertisement nothing is
discovered from a pack root, top-level files included.

API artifacts (P2, 4534564274): the round-5 rename missed the
x-enum-varnames line in swagger.json (ExperimentForkPlugins) and the
value-list row in docs/reference/api/schemas.md (fork-plugins); both now
carry the canonical fork-plugin-packs spelling, matching the committed
insertion style of 7f5983b without swag's map-order churn.

Validated in container w6-r3val6 (no network, warm caches): agentcontext
suite, targeted chatd and agentapi tests, and builds of agent/...
agentapi/... chatd/... codersdk/... all green.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Round-6 fixes are on the new head 665ce22 (pushed; PR head moved from 4846347): every push connection now starts unadvertised with a pre-push resync, the root-pack branch is gated end to end (a pack root contributes nothing before the capability, top-level files included), and the two stale rename artifacts (swagger.json x-enum-varnames, schemas.md value list) now carry fork-plugin-packs / ExperimentForkPluginPacks. Threads 4534564265/4534564269/4534564274 replied and resolved; container-validated (w6-r3val6, all green, no network).

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 665ce22e9a

ℹ️ 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".

Comment thread agent/agentcontext/push.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Round 7 of the codex review loop on #156 (threads 4534780508,
4534780514, 4534780521):

- Reconnection reset republishes a non-mutating negotiation snapshot:
  Snapshot gains CapabilityGeneration, resyncNegotiating bumps it and
  re-publishes with SnapshotError "plugin-pack capability
  renegotiating", PushContextStateRequest carries capability_generation
  (proto field 7), and PushContextState skips HydrateAndMarkChatsDirty
  while it is nonzero. A no-op reconnect can no longer dirty chats
  pinned to the pack-inclusive hash; the settling push (generation 0)
  re-pins normally.
- Pack agent rows are omitted entirely while the fork-agent-definitions
  capability is unadvertised. applyCaps count cap is index-based, so
  previously excluded rows still consumed slots and could starve live
  MCP/ACP provider rows. PushContextStateResponse gains
  fork_agent_definitions (field 101), wired from the experiment via
  agentapi Options and workspaceagentsrpc.
- Pack manifests whose SourcePath exceeds the 1024-byte transport limit
  (coderd/agentapi rejects the whole snapshot, and pushWithRetry would
  retry a permanently-invalid request) are dropped before emission.

Validated in containers w6-r3val8 (proto regen + steps green) and
w6-r3val9c (steps green); w6-r3val9b step 1 failed on a wrong Source
path in a new test, disclosed to ops and fixed.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Round-7 fixes are on the new head 465f92d (pushed; PR head moved from 665ce22): the reconnect reset now publishes a non-mutating negotiation snapshot (Snapshot.CapabilityGeneration, request field capability_generation, HydrateAndMarkChatsDirty skipped while nonzero), pack agent rows are omitted before cap accounting while the fork-agent-definitions capability is unadvertised (response capability fork_agent_definitions, field 101), and packs whose manifest path exceeds the 1024-byte transport limit are dropped before emission. Threads 4534780508/4534780514/4534780521 replied and resolved; container-validated (w6-r3val8 regen + w6-r3val9c, all green).

Xum posted this comment on behalf of @ibetitsmike.

Round 8 of the codex review loop on #156 (threads 4535979811,
4535979823):

- The DRPC push adapter now maps resp.GetForkAgentDefinitions() into
  PushResponse, so the production path advertises the capability the
  peer reported instead of only the in-memory test path.
- RunPush settles a negotiation push (nonzero capability generation)
  with a generation-zero successor resync even when neither capability
  flipped: a no-flip reconnect previously left the non-mutating
  negotiation snapshot in place, so chats created while disconnected
  stayed unhydrated and MCP/ACP live-sync stalled until an unrelated
  resolver event.

Validated in container w6-r3val10 (agentcontext, chatd, agentapi steps
and build all green).
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Round-8 fixes are on the new head 6adf7da (pushed; PR head moved from 465f92d): the DRPC push adapter now forwards resp.GetForkAgentDefinitions() so the production path advertises the definitions capability (thread 4535979811), and a negotiation push now always settles with a generation-zero resync even when no capability flips, so a no-flip reconnect can no longer leave chats unhydrated or stall MCP/ACP live-sync (thread 4535979823). Both threads replied and resolved; container-validated (w6-r3val10, all green, no network).

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6adf7da13a

ℹ️ 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".

Comment thread coderd/agentapi/context.go Resolved
Comment thread coderd/agentapi/context.go Resolved
…on rejects

Round 9 of the codex review loop on #156 (threads 4536229387,
4536229396):

- A negotiation push (capability_generation != 0) now persists
  nothing: no snapshot row, no resource upserts, no stale deletes,
  no chat state. The previous persist-but-skip-hydration behavior
  left the temporary pack-free snapshot as the agent's latest, so a
  chat created or refreshed during the reconnect window pinned a
  hash the settling push immediately dirtied. Create- and
  refresh-time hydration now keep consuming the last settled
  snapshot and its resources as one consistent pair; the settling
  push (generation 0, guaranteed by the round-8 settle resync)
  persists the settled inventory and defines the baseline.
- The rejected (replay or out-of-order) response now carries both
  advertised capability fields, not just fork_plugin_packs: the
  agent reads a zero capability as a retraction and would resync
  without pack rows until the next accepted response.

Agent-side doc comments updated to the probe design; no agent
behavior change. Validated in container w6-r3val11 (agentcontext,
chatd, agentapi steps and build all green).
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Round-9 fixes are on the new head 7a9736d (pushed; PR head moved from 6adf7da): a negotiation push is now a pure capability probe that persists nothing (no snapshot row, no resource upserts, no stale deletes, no chat state), so create- and refresh-time hydration keep consuming the last settled snapshot and its resources as one consistent pair and can no longer pin a hash the settling push immediately dirties (thread 4536229387), and the rejected response now carries both advertised capability fields so a dropped push no longer reads as a retraction (thread 4536229396). Both threads replied and resolved; container-validated (w6-r3val11, all green, no network).

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a9736d61d

ℹ️ 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".

Comment thread agent/agentcontext/push.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Comment thread agent/proto/agent.proto Resolved
Comment thread agent/agentcontext/push.go Resolved
…ent resolves

Round-10 codex review findings on 7a9736d:

- agent/agentcontext/push.go: the connection-start capability reset now
  also fires while a negotiation window is already open (sticky flag),
  and a failed reset resync returns an error instead of only logging,
  so a connection whose rebuild failed never pushes the retained
  pack-bearing snapshot as settled inventory and the still-open window
  makes the next connection retry the reset. advertise() gains a
  negotiated argument that closes the window once the probe was
  processed, even when the response carries no capabilities, and a
  single settle trigger covers window close and capability flips.
  (codex 4536654735)

- agent/agentcontext/manager.go: every snapshot published while the
  negotiation window is open carries a nonzero capability generation.
  Both publish sites (Resync and resolveAndBroadcast) capture the flag
  when the resolve starts, so a watcher- or provider-triggered resolve
  that starts inside the window publishes a probe even if it finishes
  after the window closes; the first generation-zero publish after the
  close is capability-complete. (codex 4536654704)

- agent/agentcontext/fork_plugins.go: addPackWatchDirs also watches the
  directory containing a nested manifest (.claude-plugin/plugin.json),
  which fsnotify cannot see from the pack root; without it manifest
  edits went unnoticed until an unrelated event. Watcher regression
  test TestWatcher_FiresOnNestedPackManifestEdit. (codex 4536654717)

- agent/proto/agent.proto (+ regenerated agent.pb.go, comment-only):
  the capability_generation contract now states the negotiation push is
  a non-persisting capability probe; only its generation-zero successor
  is stored. (codex 4536654727)

Validation: container w6-r3val12 (golang:1.26.10-bookworm, protoc 23.4
regen + go test agentcontext, chatd targeted, agentapi push, build)
STEP0-4 all rc=0; regenerated agentsocket.pb.go byte-identical.

Closes codex review threads 4536654735, 4536654704, 4536654717, 4536654727.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Round-10 fixes are on the new head 85cb26b (pushed; PR head moved from 7a9736d): the capability reset now also fires while a negotiation window is open and a failed reset resync fails the connection instead of letting the retained pack-bearing snapshot be pushed (thread 4536654735), every resolve started inside the window is stamped as a probe at publish time in both publish sites (thread 4536654704), addPackWatchDirs watches the directory holding nested manifests so their edits fire (thread 4536654717), and the proto/Snapshot comments now describe the non-persisting probe contract (thread 4536654727). All four threads replied and resolved; container-validated in w6-r3val12 (protoc 23.4 regen + STEP1-4, all rc=0, agent.pb.go comment-only, agentsocket.pb.go byte-identical).

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 85cb26b3b3

ℹ️ 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".

Comment thread agent/agentcontext/push.go Resolved
Comment thread agent/agentcontext/push.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
…ly, watch manifest candidates

Round-11 codex review findings on 85cb26b:

- push.go: a capability reset whose resync pass was superseded by a
  concurrent resolve gets the previously published snapshot back from
  Resync's stale-epoch path, which can be the retained pack-bearing
  generation-zero inventory. RunPush now fails the connection when the
  reset returns a settled (generation-zero) snapshot; the negotiation
  window stays open, so the next connection retries the reset.
  (codex 4537198965)

- push.go: advertise swaps the response's capabilities in while the
  window is still open, then closes the window and settles with a
  synchronous Resync instead of an asynchronous Trigger, so no resolve
  can publish a generation-zero snapshot from the reset defaults in the
  gap between window close and the settling pass. (codex 4537198976)

- fork_plugins.go: addPackWatchDirs also watches existing nested
  manifest candidate directories (.claude-plugin/, .cursor-plugin/) of
  the scan root and its child directories, whether or not a manifest
  parses there, so creating or restoring plugin.json fires an event.
  (codex 4537198982)

Tests: TestRunPush_SupersededResetFailsConnection (deterministic gate
on Resolver.MCPResources parks the reset resolve behind a newer manual
resync) and TestWatcher_FiresWhenNestedPackManifestAppears. Also moves
TestWatcher_FiresWhenDeclaredPackContainerAppears' doc comment back
onto its function.

Validation: container w6-r3val13 STEP1-4 all rc=0 (agentcontext suite,
chatd targeted, agentapi push, build).
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Round-11 fixes are on the new head c87dff7 (pushed; the PR head moved from 85cb26b):

  • A capability reset whose resync was superseded by a concurrent resolve now fails the connection instead of pushing the stale-epoch snapshot it got back (thread 4537198965).
  • advertise swaps the capabilities in before it closes the window, then settles with a synchronous resync (thread 4537198976).
  • Existing nested manifest candidate directories are watched even when no manifest parses there (thread 4537198982).

All three threads have replies and are resolved. Container-validated in w6-r3val13 (STEP1-4 all rc=0).

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c87dff7e1b

ℹ️ 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".

Comment thread coderd/workspaceagentsrpc.go Resolved
Comment thread agent/agentcontext/push.go Resolved
Comment thread agent/agentcontext/push.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Comment thread agent/agentcontext/resolve.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Comment thread coderd/x/chatd/fork_plugin_drift.go Resolved
Comment thread agent/agentcontext/resolve.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Comment thread agent/agentcontext/fork_plugins.go Resolved
Resolves the conflict in coderd/x/chatd/fork_agent_definitions.go: main
extracted the definition parsing loop into parseAgentDefinitionResources,
and this branch filters pack-contributed rows before parsing. The
resolution keeps the fork-plugin-packs filter in workspaceAgentDefinitions
and calls the extracted helper.
The agent type catalog from main (#188) parses workspace agent context
rows directly and copied only BodyKind, Body and Status, so it bypassed
the fork-plugin-packs filter: with the experiment off it listed pack agent
types that spawn_agent does not offer. agentRowDefinitions now carries
SourcePath into the converted rows and runs filterPackResources before
parsing, matching workspaceAgentDefinitions.

TestAgentRowDefinitionsGatesPackAgents covers both experiment states.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Head a6f9fee merges main (1a88b7c) into this branch. While resolving the conflict in fork_agent_definitions.go, I kept filterPackResources and then called main's extracted parseAgentDefinitionResources. This head also adds a fix of its own: main's new agent type catalog (fork_agent_type_catalog.go) skipped the pack filter, so it now goes through agentRowDefinitions, which carries SourcePath and applies the gate (TestAgentRowDefinitionsGatesPackAgents). The round-11 fixes from c87dff7 are included.

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: a6f9feea81

ℹ️ 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".

…s, skip subagent drift when definitions are off

- agentcontext: track whether a push connection has been established and
  reset capability negotiation on the first connection after an agent
  restart, so the probe runs even when the manager already published a
  settled snapshot. Only the generation-0 push clears the initial flag,
  and an unimplemented push RPC closes the negotiation window.
- agentcontext: treat writes inside a pack's declared agents container as
  relevant watcher events and watch those directories.
- chatd: exclude every subagent row from the drift hash while
  fork-agent-definitions is disabled, matching the catalog, context and
  listing gates.

Addresses Codex review comments 4537652618, 4537652671 and 4537652692.
Validated in containers w6-r3val15 (agentcontext, chatd, agentapi tests,
build) and w6-r3val15b (agent tests on an internal network).
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Head 8d940e5d7b fixes three round-12 findings: the probe now runs on the first push connection after an agent restart, writes in a pack's declared agent containers are now relevant watcher events, and drift skips subagent rows while agent definitions are off. All 50 threads are resolved.

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d940e5d7b

ℹ️ 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".

Comment thread agent/agentcontext/push.go Resolved
…test

Capability negotiation now settles synchronously on the first
connection, so TestRunPush_AdvertisedPacksTriggerResync could write its
file before Run's watcher registered its watches and then wait forever
for a watcher-driven push (fork-ci agent-sdk on 8d940e5). Drive the
re-resolve with Manager.Resync like the sibling push tests.

Validated in container w6-r3val16: the fork-ci agent-sdk command and
-count=20 over every TestRunPush_ test.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Head 8d56c345b7 adds only a test fix: TestRunPush_AdvertisedPacksTriggerResync now drives its re-resolve with Manager.Resync, which removes a race with watcher registration that showed up in fork-ci. All 51 threads are resolved.

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d56c345b7

ℹ️ 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".

Comment thread coderd/x/chatd/fork_plugin_gate.go Resolved
Comment thread agent/agentcontext/defaults.go Resolved
@ibetitsmike
ibetitsmike marked this pull request as ready for review November 11, 2026 13:37
@ibetitsmike
ibetitsmike merged commit cd278dc into main Nov 11, 2026
9 checks passed
@ibetitsmike
ibetitsmike deleted the mike/plugin-packs-1-manifests branch November 11, 2026 14:39
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum merged this PR on behalf of @ibetitsmike.

Merged as a squash of head 9d35956d05, on top of main 58ebf1b392 (#199).

  • CI: fork-ci run 43037910250 passed on the exact head. The lead merged main into the branch with update-branch; this PR's changed lines match the UAT'd head 8d56c345b7 exactly.
  • UAT: UAT156 passed on a fresh branch server at 8d56c345b7 (plugin pack install, context popup, and the pack lifecycle). The leak audit was clean and the server is down.
  • Codex: the last rounds raised only P2 findings, which the lead dropped under the fork's scope rule (no defensive bikeshedding). 53/53 threads are resolved.
  • Size: the PR is large (+3166/-269); the size follow-up is tracked in pstack plan: 38 of 113 merged plan PRs exceed the 500-line limit, and fork-ci has no size check #171.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant