Skip to content

fix(codex): settle plugin activation, align plugin/list with codex 0.144, bound discovery per turn - #108311

Merged
steipete merged 2 commits into
mainfrom
claude/codex-group4-activation-settle
Jul 15, 2026
Merged

steipete merged 2 commits into
mainfrom
claude/codex-group4-activation-settle

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

#107305 — With codexPlugins configured, every embedded-Codex turn stalled on blocking plugin/list RPCs ("plugin/list timed out" / LOCAL_REQUEST_CANCELLED), and the curated marketplace was never found so activation never settled. Three compounding causes:

  1. Contract drift vs codex 0.144: OpenClaw sent cwds: [] plus explicit marketplaceKinds in places — at the pinned 0.144.4, any explicit kinds disable the automatic global remote catalog (codex-rs/app-server/src/request_processors/plugins.rs:549-582; test plugin_list.rs:2483-2529), and the missing-marketplace check only recognized the legacy openai-curated name, not the current openai-curated-remote.
  2. Activation outcomes were ephemeral: marketplace_missing/plugin_missing produced only in-memory results, so the recovery predicate re-triggered the full blocking discovery + install + refresh chain on every turn (provenance: the repeat-recovery behavior traces to docs(changelog): credit recent contributor fixes #100562).
  3. Each discovery RPC got a full request timeout, so sequential timeouts could consume the entire turn's startup.

#106719 hardening — the investigated deadlock mechanism was disproven in source (capability probes never enter the native-config fence; all requests are bounded), but raw callers could still issue guarded thread requests with no timeout and no abort signal, an unbounded fence hold.

Why This Change Was Made

  • Params alignment: curated queries omit cwds and marketplaceKinds (omitted → local + automatic global remote catalog at 0.144.4, where cwds: [] and omitted are equivalent — plugins.rs:539-551); the shared curated predicate now recognizes openai-curated-remote; the local protocol type marks cwds optional.
  • Settled negatives: a process-local CodexPluginMetadataCache (coalesced loads, per-runtime invalidation on plugin/install, identity-keyed by the same appCacheKey as the app-inventory cache, 1h freshness window matching that sibling cache) lets inventory + activation share one plugin/list snapshot and lets terminal negatives settle; the thread-lifecycle recovery predicate rechecks only genuinely recoverable keys. Two review-driven guards: fail-open responses are never cached (at 0.144.4 a remote-catalog fetch failure with omitted kinds only warns — "returning local marketplaces only" — with empty marketplaceLoadErrors, plugins.rs:664-700, so snapshots settle only when the curated marketplace itself is present), and workspace-directory queries bypass the cache entirely because workspace plugins are activated outside OpenClaw with no invalidation signal.
  • Bounded discovery: the whole plugin-config build shares one deadline (derived from the existing appServer request timeout, no new config key) with remaining-budget propagation per RPC and a fail-closed deny-all apps patch + diagnostic on timeout, so the base Codex turn continues. Safe because plugin/list is un-serialized upstream and late responses are dropped by the client.
  • Fence invariant: guarded thread requests must carry a finite timeout or abort signal; fence semantics (post-write holds until process exit) intentionally unchanged.

User Impact

  • Embedded-Codex turns with configured plugins no longer hang or burn a full request timeout per turn once a plugin/marketplace is genuinely missing; the curated marketplace is found again on codex 0.144+.
  • Externally-activated workspace plugins become visible on the next turn, and remote-catalog additions within an hour.
  • Plugin discovery failures degrade to plugin-apps-disabled-for-this-turn instead of stalling the turn.

Evidence

  • Focused suites (all pass): plugin-activation/inventory/thread-config/metadata-cache + client + attempt-startup + thread-lifecycle + run-attempt (updated + new tests: params shape with no cwds/kinds for curated queries, openai-curated-remote recognition, negative outcome settles with no re-issued plugin/list on the next turn, install invalidation, fail-open response not cached, TTL expiry, workspace bypass, deadline deny-all fallback, guarded-request invariant).
  • Strict Testbox gates from the implementation round: formatting, production/test typechecks, lint, import cycles, database guard — all green.
  • Autoreview (Codex gpt-5.6-sol, xhigh): clean after three review-driven fixes (fail-open cache poisoning, process-lifetime staleness → sibling-matching TTL, workspace external-activation recoverability), each verified against pinned codex-rs 0.144.4 source before fixing.

Fixes #107305
Closes #106719

(#106719's reported deadlock mechanism could not be reproduced in current source: capability probes never enter the native-config fence and every control RPC is bounded — provider-capabilities.ts, command-rpc.ts, native-config-fence.ts:61-101. The unbounded-guarded-request window that remained is closed by this PR. Please reopen with a repro on a current build if the stall persists.)

…144, bound discovery per turn

- plugin/list curated queries omit cwds and marketplaceKinds (0.144 semantics:
  explicit kinds disable the automatic global remote catalog; cwds:[] never
  suppressed it), and the missing-marketplace check recognizes the current
  openai-curated-remote wire name via the shared predicate (#107305)
- curated plugin/list snapshots settle in a process-local metadata cache
  (coalesced, invalidated on install/identity change/restart, 1h freshness
  window matching the app-inventory cache) so a missing marketplace or plugin
  no longer re-runs blocking discovery RPCs on every embedded-Codex turn;
  fail-open local-only responses (upstream warns without a load error when the
  remote catalog fetch fails) are never cached, and workspace-directory
  queries stay live because external activation has no invalidation signal
- the whole plugin-config build shares one bounded startup deadline with
  remaining-budget propagation per RPC and a deny-all apps fallback, so a hung
  plugin/list cannot consume the turn (#107305)
- guarded thread requests (start/resume/fork under the native-config fence)
  must carry a finite timeout or abort signal, closing the unbounded-fence-hold
  window for raw callers (#106719 hardening)
…local

Deadline behavior tests exercise the production provider composition instead
of a test-only export.
@steipete
steipete merged commit 9d4610c into main Jul 15, 2026
104 checks passed
@steipete
steipete deleted the claude/codex-group4-activation-settle branch July 15, 2026 13:40
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Jul 15, 2026
…moves, harden npm metadata parsing (#108336)

* fix(plugins): keep official plugin config across bundled-to-external moves, harden npm metadata parsing

- doctor --fix and plugin auto-enable treat official-catalog plugin ids as
  known configuration even when the external package is not installed yet, so
  a bundled-to-external transition (codex) no longer silently drops the
  plugins.allow entry and unregisters the agent harness; garbage ids are still
  pruned, and the codex-specific diagnostic suppression in the doctor scan is
  replaced by the generic official-catalog rule (#107226)
- npm view metadata normalization handles object and multi-version array
  output, flat dist.* keys and nested dist objects, absent openclaw blocks,
  selects the maximum satisfying semver (publication order is not semver
  order), fails closed when a recognized range has no satisfying entry, and
  names the missing fields in the error (#107842)

The #107219 register-crash fix (lazy binding-store opening so plugin
registration never touches runtime.state under the base runtime) landed with
#108311 alongside its regression test.

* style: format install-source-utils imports
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 16, 2026
…144, bound discovery per turn (openclaw#108311)

* fix(codex): settle plugin activation, align plugin/list with codex 0.144, bound discovery per turn

- plugin/list curated queries omit cwds and marketplaceKinds (0.144 semantics:
  explicit kinds disable the automatic global remote catalog; cwds:[] never
  suppressed it), and the missing-marketplace check recognizes the current
  openai-curated-remote wire name via the shared predicate (openclaw#107305)
- curated plugin/list snapshots settle in a process-local metadata cache
  (coalesced, invalidated on install/identity change/restart, 1h freshness
  window matching the app-inventory cache) so a missing marketplace or plugin
  no longer re-runs blocking discovery RPCs on every embedded-Codex turn;
  fail-open local-only responses (upstream warns without a load error when the
  remote catalog fetch fails) are never cached, and workspace-directory
  queries stay live because external activation has no invalidation signal
- the whole plugin-config build shares one bounded startup deadline with
  remaining-budget propagation per RPC and a deny-all apps fallback, so a hung
  plugin/list cannot consume the turn (openclaw#107305)
- guarded thread requests (start/resume/fork under the native-config fence)
  must carry a finite timeout or abort signal, closing the unbounded-fence-hold
  window for raw callers (openclaw#106719 hardening)

* chore(codex): keep plugin metadata types and deadline builder module-local

Deadline behavior tests exercise the production provider composition instead
of a test-only export.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 16, 2026
…moves, harden npm metadata parsing (openclaw#108336)

* fix(plugins): keep official plugin config across bundled-to-external moves, harden npm metadata parsing

- doctor --fix and plugin auto-enable treat official-catalog plugin ids as
  known configuration even when the external package is not installed yet, so
  a bundled-to-external transition (codex) no longer silently drops the
  plugins.allow entry and unregisters the agent harness; garbage ids are still
  pruned, and the codex-specific diagnostic suppression in the doctor scan is
  replaced by the generic official-catalog rule (openclaw#107226)
- npm view metadata normalization handles object and multi-version array
  output, flat dist.* keys and nested dist objects, absent openclaw blocks,
  selects the maximum satisfying semver (publication order is not semver
  order), fails closed when a recognized range has no satisfying entry, and
  names the missing fields in the error (openclaw#107842)

The openclaw#107219 register-crash fix (lazy binding-store opening so plugin
registration never touches runtime.state under the base runtime) landed with
openclaw#108311 alongside its regression test.

* style: format install-source-utils imports
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…144, bound discovery per turn (openclaw#108311)

* fix(codex): settle plugin activation, align plugin/list with codex 0.144, bound discovery per turn

- plugin/list curated queries omit cwds and marketplaceKinds (0.144 semantics:
  explicit kinds disable the automatic global remote catalog; cwds:[] never
  suppressed it), and the missing-marketplace check recognizes the current
  openai-curated-remote wire name via the shared predicate (openclaw#107305)
- curated plugin/list snapshots settle in a process-local metadata cache
  (coalesced, invalidated on install/identity change/restart, 1h freshness
  window matching the app-inventory cache) so a missing marketplace or plugin
  no longer re-runs blocking discovery RPCs on every embedded-Codex turn;
  fail-open local-only responses (upstream warns without a load error when the
  remote catalog fetch fails) are never cached, and workspace-directory
  queries stay live because external activation has no invalidation signal
- the whole plugin-config build shares one bounded startup deadline with
  remaining-budget propagation per RPC and a deny-all apps fallback, so a hung
  plugin/list cannot consume the turn (openclaw#107305)
- guarded thread requests (start/resume/fork under the native-config fence)
  must carry a finite timeout or abort signal, closing the unbounded-fence-hold
  window for raw callers (openclaw#106719 hardening)

* chore(codex): keep plugin metadata types and deadline builder module-local

Deadline behavior tests exercise the production provider composition instead
of a test-only export.
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…moves, harden npm metadata parsing (openclaw#108336)

* fix(plugins): keep official plugin config across bundled-to-external moves, harden npm metadata parsing

- doctor --fix and plugin auto-enable treat official-catalog plugin ids as
  known configuration even when the external package is not installed yet, so
  a bundled-to-external transition (codex) no longer silently drops the
  plugins.allow entry and unregisters the agent harness; garbage ids are still
  pruned, and the codex-specific diagnostic suppression in the doctor scan is
  replaced by the generic official-catalog rule (openclaw#107226)
- npm view metadata normalization handles object and multi-version array
  output, flat dist.* keys and nested dist objects, absent openclaw blocks,
  selects the maximum satisfying semver (publication order is not semver
  order), fails closed when a recognized range has no satisfying entry, and
  names the missing fields in the error (openclaw#107842)

The openclaw#107219 register-crash fix (lazy binding-store opening so plugin
registration never touches runtime.state under the base runtime) landed with
openclaw#108311 alongside its regression test.

* style: format install-source-utils imports
steipete added a commit that referenced this pull request Oct 10, 2026
Drop generation counters for metadata responses crossing cache invalidation
and stop recursively retrying a failed shared load for each waiting caller.
Retain identity partitioning, request coalescing, incomplete-response checks,
TTL expiry and ordinary post-install invalidation.

Best-effort tradeoffs accepted: a pending response may repopulate the cache
after invalidation until TTL expiry or the next invalidation. A failed load
now rejects its joiners; the next ordinary request can try again. These guards
originated with the cache in #108311, not a reported race requiring them.

Keep the independent app-inventory and catalog lifecycle guards: their
history records real multi-agent, disconnect and list/event ordering defects.
steipete added a commit that referenced this pull request Oct 11, 2026
Drop generation counters for metadata responses crossing cache invalidation
and stop recursively retrying a failed shared load for each waiting caller.
Retain identity partitioning, request coalescing, incomplete-response checks,
TTL expiry and ordinary post-install invalidation.

Best-effort tradeoffs accepted: a pending response may repopulate the cache
after invalidation until TTL expiry or the next invalidation. A failed load
now rejects its joiners; the next ordinary request can try again. These guards
originated with the cache in #108311, not a reported race requiring them.

Keep the independent app-inventory and catalog lifecycle guards: their
history records real multi-agent, disconnect and list/event ordering defects.
steipete added a commit that referenced this pull request Oct 11, 2026
Drop generation counters for metadata responses crossing cache invalidation
and stop recursively retrying a failed shared load for each waiting caller.
Retain identity partitioning, request coalescing, incomplete-response checks,
TTL expiry and ordinary post-install invalidation.

Best-effort tradeoffs accepted: a pending response may repopulate the cache
after invalidation until TTL expiry or the next invalidation. A failed load
now rejects its joiners; the next ordinary request can try again. These guards
originated with the cache in #108311, not a reported race requiring them.

Keep the independent app-inventory and catalog lifecycle guards: their
history records real multi-agent, disconnect and list/event ordering defects.
steipete added a commit that referenced this pull request Oct 11, 2026
Drop generation counters for metadata responses crossing cache invalidation
and stop recursively retrying a failed shared load for each waiting caller.
Retain identity partitioning, request coalescing, incomplete-response checks,
TTL expiry and ordinary post-install invalidation.

Best-effort tradeoffs accepted: a pending response may repopulate the cache
after invalidation until TTL expiry or the next invalidation. A failed load
now rejects its joiners; the next ordinary request can try again. These guards
originated with the cache in #108311, not a reported race requiring them.

Keep the independent app-inventory and catalog lifecycle guards: their
history records real multi-agent, disconnect and list/event ordering defects.
steipete added a commit that referenced this pull request Oct 11, 2026
* refactor(codex): simplify plugin metadata cache invalidation

Drop generation counters for metadata responses crossing cache invalidation
and stop recursively retrying a failed shared load for each waiting caller.
Retain identity partitioning, request coalescing, incomplete-response checks,
TTL expiry and ordinary post-install invalidation.

Best-effort tradeoffs accepted: a pending response may repopulate the cache
after invalidation until TTL expiry or the next invalidation. A failed load
now rejects its joiners; the next ordinary request can try again. These guards
originated with the cache in #108311, not a reported race requiring them.

Keep the independent app-inventory and catalog lifecycle guards: their
history records real multi-agent, disconnect and list/event ordering defects.

* refactor(codex): simplify metadata and startup lifecycles

Treat overlapping metadata, plugin and desktop changes as best effort instead
of maintaining revision fences, stale-result certificates, installation-winner
protocols and whole-operation retries. Preserve bounded caches, account and
workspace identity, signed executable validation, private binding authority,
FIFO operations and ordinary shutdown settlement.

Remove native-config request fencing and its delayed response/exit handoff.
Keep current authorization immediately before wire effects, one idempotent
write, and explicit rejection if authority returns without admitting work.
Keep failed fingerprint reads retryable and watcher registration recovery
bounded to one retry, without restoring convergence or retry state machines.

Re-evaluate every original KEEP decision under the sharpened provenance bar.
Synthetic race tests are removed with the retired paths; meaningful security,
public contract, durability and normal lifecycle tests remain.

No configuration, protocol, schema, retention or permission changes.

* chore(codex): remove stale import after rebase

* fix(codex): settle shared delivery before releasing clients

* refactor(codex): remove dead helpers and keep registration lazy

* fix(codex): preserve account readiness and clarify cache tradeoffs

* test(codex): retire removed configuration-wait coverage

* fix(codex): satisfy settlement predicate lint after simplification

* fix(codex): preserve load authority and watcher recovery
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…68813)

* refactor(codex): simplify plugin metadata cache invalidation

Drop generation counters for metadata responses crossing cache invalidation
and stop recursively retrying a failed shared load for each waiting caller.
Retain identity partitioning, request coalescing, incomplete-response checks,
TTL expiry and ordinary post-install invalidation.

Best-effort tradeoffs accepted: a pending response may repopulate the cache
after invalidation until TTL expiry or the next invalidation. A failed load
now rejects its joiners; the next ordinary request can try again. These guards
originated with the cache in openclaw#108311, not a reported race requiring them.

Keep the independent app-inventory and catalog lifecycle guards: their
history records real multi-agent, disconnect and list/event ordering defects.

* refactor(codex): simplify metadata and startup lifecycles

Treat overlapping metadata, plugin and desktop changes as best effort instead
of maintaining revision fences, stale-result certificates, installation-winner
protocols and whole-operation retries. Preserve bounded caches, account and
workspace identity, signed executable validation, private binding authority,
FIFO operations and ordinary shutdown settlement.

Remove native-config request fencing and its delayed response/exit handoff.
Keep current authorization immediately before wire effects, one idempotent
write, and explicit rejection if authority returns without admitting work.
Keep failed fingerprint reads retryable and watcher registration recovery
bounded to one retry, without restoring convergence or retry state machines.

Re-evaluate every original KEEP decision under the sharpened provenance bar.
Synthetic race tests are removed with the retired paths; meaningful security,
public contract, durability and normal lifecycle tests remain.

No configuration, protocol, schema, retention or permission changes.

* chore(codex): remove stale import after rebase

* fix(codex): settle shared delivery before releasing clients

* refactor(codex): remove dead helpers and keep registration lazy

* fix(codex): preserve account readiness and clarify cache tradeoffs

* test(codex): retire removed configuration-wait coverage

* fix(codex): satisfy settlement predicate lint after simplification

* fix(codex): preserve load authority and watcher recovery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

1 participant