Repository navigation
fix: reduce first-reply delays when starting conversations - #398
Merged
Merged
Conversation
devSejung
marked this pull request as ready for review
October 26, 2026 19:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_modifyflag 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 originalnode scripts/platformclaw-check.mjs --changedstopped 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, officialnode 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:
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 FORBIDDENbefore 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-argumentgetProviderEnvVarsretains 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.