Skip to content

improve: avoid repeated chat setup work when one agent refreshes - #148264

Closed
steipete wants to merge 1 commit into
mainfrom
codex/team-chat-metadata-reuse-20260914
Closed

steipete wants to merge 1 commit into
mainfrom
codex/team-chat-metadata-reuse-20260914

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #147137

What Problem This Solves

Chat metadata refresh for one agent repeated command and model-catalog preparation for every unchanged agent, adding avoidable latency to chat reads on multi-agent Gateways.

User Impact

Agent-local metadata refresh does less work before waiting chat reads can complete. Global refresh, authority changes, and shutdown retain their existing publication fences.

Why This Change Was Made

Carry forward settled neutral projections and command lists only when their config, plugin generation, agent owner, auth revisions, catalog identity/status, and skill version still match. Explicit invalidation or failure discards this reuse opportunity. Personal-account projections remain request-local. The reusable read wrapper captures its required facts separately so it does not retain older generations.

Evidence

The real published-owner regression fails on the original code: replacing one owner in a 64-agent fixture produces 128 builds instead of 65. The repaired test covers 1/64-agent entries/list layouts, explicit invalidation, unavailable owners, and roster changes. All 66 focused checks pass, including metadata refresh, auth deadlines, shutdown, personal accounts, and a bounded GC child that verifies retired owners and session projections are collectible while current reads still work.

A local Node 26.8.2 synthetic workload used 32 models and 64 small sessions per agent with unmodified command/model projection implementations. At 16 agents, median one-owner refresh fell from 166.9 ms to 20.6 ms across four observations per condition; preparation fell from 16 command/catalog pairs to one. Full-roster refresh still rebuilds all 16. Native worker ownership and shutdown passed.

These local measurements establish redundant preparation cost. They do not establish the cause of production multi-second stalls or remove the global refresh wait. Isolated Gateway client proof and exact-head CI are still pending.

Keep ready command and neutral model projections for unchanged agents during agent-local metadata refresh. Preserve global and per-agent freshness fences, explicit invalidation, personal-account isolation, and shutdown ownership. Bind reusable reads outside generation settlement scopes so retired owners and session projections remain collectible.
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 14, 2026 13:09
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 5, 2026, 1:54 PM ET / 17:54 UTC (Revision 4).

ClawSweeper review

What this changes

The branch reuses unchanged agents’ prepared commands and model metadata across refreshes and adds regression and memory-retention coverage.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: cross-refresh reuse remains distinct from the merged startup and session-list improvements, and no verified merged PR supersedes this contribution.

Priority: P2
Reviewed head: 8a2eea2f00554a470eedfd4d3f1bd171d19caa8c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The pinned patch has focused guards and useful regression coverage, with no concrete introduced defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER classification exempts the ordinary external-contributor gate. The captured Node workload supports preparation savings, but the earlier requested Gateway-client trace remains pending validation; tests are supplemental. No persisted-data model changes occur.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER classification exempts the ordinary external-contributor gate. The captured Node workload supports preparation savings, but the earlier requested Gateway-client trace remains pending validation; tests are supplemental. No persisted-data model changes occur.
Evidence reviewed 11 items Pinned introduced change: The verified merge-base-to-head delta adds predecessor reuse guarded by config/plugin versions, agent-owner identity, auth revisions, catalog identity/status, skills version, and projection freshness. Session projections are not carried forward.
Current main still resets agent preparation: Main prepares commands on demand and bounds its caches to 64 entries, but changed generation facts create new agent and projection maps. Consequently, subsequently requested unchanged agents can repeat preparation; this branch’s cross-generation reuse is not present.
Latest release comparison: The inspected v2026.9.8 source likewise uses demand-driven preparation and initializes empty caches on changed generations. GitHub’s annotated tag resolves to fc23bc8; it does not establish that cross-refresh reuse shipped.
Findings None None.
Security None None.

How this fits together

Gateway chat metadata combines published model-owner facts, commands, and session account selections for chat clients. Refresh and invalidation determine which prepared results those clients can reuse.

flowchart TD
  A[Published agent facts] --> B[Chat metadata refresh]
  C[Config and plugin versions] --> B
  B --> D{Unchanged agent facts?}
  D -->|Yes| E[Reuse settled preparation]
  D -->|No| F[Prepare commands and models]
  E --> G[Current chat metadata response]
  F --> G
  H[Request account selection] --> G
Loading

Before merge

  • Resolve merge risk (P1) - The head conflicts with main; no resolved combined patch has been reviewed to establish that reuse preserves demand-driven preparation, bounded retention, and request-time account selection.
  • Complete next step (P2) - Rebase onto current main while preserving lazy bounded preparation and request-time account selection, obtain fresh review of the resolved patch, and complete the previously requested redacted Gateway-client validation.
Agent review details

Security

None.

PR surface

Source +52, Tests +181, Other +4. Total +237 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 3 92 40 +52
Tests 4 185 4 +181
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 4 0 +4
Total 9 281 44 +237

Review metrics

Metric Value Why it matters
Code growth by responsibility production net +52; tests/support net +181; test tooling net +4 Production growth implements guarded reuse and removes generation-retaining read closures; most added code validates work bounds and collection.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep reuse inside main’s existing demand-driven metadata owner, carrying forward only settled unchanged preparation within its cache bounds and freshness fences.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep reuse inside main’s existing demand-driven metadata owner, carrying forward only settled unchanged preparation within its cache bounds and freshness fences.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: prepare two agents, replace one owner, refresh, then read the unchanged agent; main creates empty preparation caches and rebuilds that agent on demand. No runtime reproduction was executed.

Is this the best way to solve the issue?

Unclear for the final landing patch: guarded reuse is sensible, but it must be adapted to main’s lazy bounded caches rather than preserving the older eager generation model.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d511ab92b63a.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded multi-agent metadata performance improvement, with no demonstrated urgent runtime regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied MEMBER classification exempts the ordinary external-contributor gate. The captured Node workload supports preparation savings, but the earlier requested Gateway-client trace remains pending validation; tests are supplemental. No persisted-data model changes occur.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • fuller-stack-dev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Adapt reuse to main’s bounded on-demand caches and obtain fresh review of the resolved patch.
  • Complete the previously requested redacted Gateway-client trace showing unchanged-agent reuse, correct responses, and explicit invalidation.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed September 17, 2026, 12:59 AM ET / 04:59 UTC sha unknown :: needs real behavior proof before merge. :: none
  • reviewed September 27, 2026, 3:56 AM ET / 07:56 UTC (Revision 2) sha unknown :: blocked before merge. :: none
  • reviewed September 27, 2026, 3:56 AM ET / 07:56 UTC (Revision 3) sha unknown :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 27, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 5, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

The eager whole-roster refresh this benchmark targeted has been replaced by demand-driven per-agent preparation (#149716), with further startup command reuse in #175674. Closing the stale implementation; additional cross-generation reuse would need evidence against the current path.

Closed in a sweep of stale maintainer PRs (no activity for 7+ days). Reopen with a current reproduction if this still matters.

@steipete steipete closed this Oct 21, 2026
@RomneyDa
RomneyDa deleted the codex/team-chat-metadata-reuse-20260914 branch October 22, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant