Skip to content

fix: reduce first-reply delays when starting conversations - #398

Merged
devSejung merged 2 commits into
mainfrom
fix/prepared-plugin-metadata-reuse
Oct 26, 2026
Merged

devSejung merged 2 commits into
mainfrom
fix/prepared-plugin-metadata-reuse

Conversation

@devSejung

@devSejung devSejung commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Closes #397 — repeated plugins preparation delays the first reply in new conversations.

Additional instructions

This is a same-repository branch; maintainers with repository write access can update it. GitHub's fork-only maintainer_can_modify flag reports false for this PR even though creation requested true.

What Problem This Solves

Fixes an issue where users starting a new conversation would wait for the first reply while plugins information is repeatedly prepared during model authentication and tool readiness. The measured reproduction uses the actual compiled Chromium UI, PlatformClaw BFF, SQLite, and Linux Gateway, with repository fixtures for employee authentication and the model.

Why This Change Was Made

Carry the existing prepared runtime's metadata through its request-local scope, and forward the selected config/workspace to auth and media consumers. Separate derived auth-alias and setup caches by the effective metadata generation so overlapping old/new runs cannot share a stale result; reuse the existing lifecycle, weak ownership, and bounded caches.

Catalog source planning moves to its own owner module to preserve the module-size gate. This adds no dependencies, config/environment switches, protocol/schema versions, global snapshot replacement, workspace-matching exceptions, or credential-result caching.

User Impact

New conversations avoid redundant plugins discovery. Current credentials, auth pins, workspace trust, plugin subsets, policy, and generation checks remain authoritative. Skills loading, eligibility, watchers, and existing VM target/remote-skills cache behavior are unchanged.

This improves the measured Gateway path; actual company/assigned-VM latency is not established by this development reproduction.

Evidence

Validation base: 8977cb4ba0503ae2be7efb1012bb3bbb8bf37af2 (latest fetched main when work was frozen). Reviewed candidate patch SHA-256: b73ead456ebffe8d86a0d854d163e3ec7be9a0530e279cf4a67edb23d9883fe2.

Code commit: 8b066cdf39257eb34db2e613f7b885bef8c958bf. All 49 committed file blobs match the reviewed/tested frozen manifest. Main was fetched again before pushing: this commit is one ahead, zero behind.

Hosted CI run 40390049196 is attached to that exact head and remains pending at Ready handoff. Local validation below is complete; hosted CI success is not yet claimed.

Linux: Ubuntu 22.04, Node 24.18, pnpm 11.15.1, separate task-owned source/dependencies/state. The focused generation/auth/setup matrix passed 201 tests in 15 files. After static-only cleanup, the affected auth-owner/alias 17 tests and setup-scope 3 tests passed again. The preceding implementation checkpoint also passed 732 unique focused/sibling tests in 34 files; these totals overlap and are not added together.

All 36 commands in the required changed-surface plan have passing evidence: core/plugins product and test tsgo, formatting/lint, API manifest/exports/surface, dead exports, trust/boundary/storage guards, and runtime import cycles (0). The original node scripts/platformclaw-check.mjs --changed stopped at lint; retained passing gates plus the original failed/affected/unrun commands were completed after removing a shadowed local name and redundant test generic. Both failures remain in the task evidence; no gate/assertion/skip flag was weakened. Two fresh reviews verified those final edits preserve runtime behavior.

Normal pnpm build, official node scripts/build-all.mjs sourcePerformance, pnpm ui:build, and the coding-agent-contract/control-plane package builds all passed. The comparison runtime was built after the normal full build and its UI assets rebuilt before launch.

Independent built-in source reviews found two generation-cache defects in the initial candidate. Real-owner Linux regressions reproduced three auth-alias/pin failures and two setup-generation failures before the repair; both ordering directions and an implicit-workspace A/B/A collision are covered. The repaired patch has no remaining actionable P0–P2 findings in those reviews. Built-in reviewers were used under repository policy; no external review runner pass is claimed. Security CODEOWNERS review remains required before landing.

Actual Chromium UI before/after, same fixture topology and observers, three repeated samples per side:

Measurement Main Final candidate
Send → visible assistant, median 9135.1 ms 1704.2 ms
Metadata materializations per repeated sample 55 4
Metadata interval union in send → first event, median 6602.172 ms 660.975 ms
Session-create RPC, median 120.6 ms 132.9 ms
First observed chat → visible assistant (one sample) 13729.2 ms 8917.5 ms

All four final conversations displayed the expected fixture reply; no browser page errors. Tool count 58, full tool schemas, and the 22 available-skills descriptor blocks match across all before/after samples after normalizing only the task filesystem root. This checks the fixture prompt inventory, not every skill's execution or eligibility in other environments. Screenshots were inspected locally; no proof assets are committed.

The final run still has four metadata materializations (three under skill-snapshot preparation and one without a resolved diagnostic parent), and the first observed reply still takes about 8.9 seconds. These remaining costs are not claimed necessary or solved. The initial provisioning login request exceeded the unchanged 30-second browser limit on both revisions; task SQLite confirmed the agent binding active before the idempotent login retry, outside the measured conversation windows.

Limits: sample zero is the first observed chat after provisioning, not a fully cold OS/process/VM test. Repeated samples wait for final response and chat-pane idle. Runs are sequential, not randomized; host load can vary. The same diagnostic/browser observers were used; observer overhead was not separately calibrated. The fixture reports models.authStatus FORBIDDEN before dispatch on both sides; session creation, sending, and replies succeed without relaxing authorization. Actual VM connection/auth/network, remote filesystem/skills behavior, target/folder UI switching, and external model TTFT remain unmeasured.

Existing follow-up GUIDANCE-ENV-HINT-SINGLETON: no-argument getProviderEnvVars retains its first resolved hints for the module lifetime. Dynamic media/setup env-var hints need a separate scoped-guidance repair; current credential resolution uses explicit lookup inputs and is not that hint cache. This PR does not claim all plugins-derived guidance is generation-aware.

AI-assisted implementation; independent built-in source review and primary-owned Linux checks. Production/test LOC counted separately: production net +234 (including the canonical source extraction and two owner-cache repairs), tests net +1032, generated API hash 2 lines changed. Runtime logs, databases, credentials, user workspaces, and proof assets are excluded from this branch.

@devSejung
devSejung marked this pull request as ready for review October 26, 2026 19:48
@devSejung
devSejung merged commit f6d6f08 into main Oct 26, 2026
75 checks passed
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.

[Bug]: starting new conversations repeats plugins preparation before the first reply

2 participants