Repository navigation
fix: composer picks up new project skills without a server restart #16750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,6 +131,20 @@ export const ServerProviderWorkspaceSnapshot = Schema.Struct({ | |
| }); | ||
| export type ServerProviderWorkspaceSnapshot = typeof ServerProviderWorkspaceSnapshot.Type; | ||
|
|
||
| /** | ||
| * How long a workspace's skill and command scan stays current. Nothing watches | ||
| * skill directories, so a composer opened after this rescans on use, and the | ||
| * server answers repeat requests inside the window from its cache. | ||
| */ | ||
| export const PROVIDER_WORKSPACE_SNAPSHOT_TTL_MS = 5 * 60_000; | ||
|
|
||
| export function isProviderWorkspaceSnapshotCurrent( | ||
| snapshot: Pick<ServerProviderWorkspaceSnapshot, "checkedAt">, | ||
| nowMs: number, | ||
| ): boolean { | ||
| return nowMs - Date.parse(snapshot.checkedAt) < PROVIDER_WORKSPACE_SNAPSHOT_TTL_MS; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Treat future server timestamps as stale on the client. If a client clock trails the server clock by 20 minutes, this predicate treats a completed snapshot as current for about 25 minutes. Opening either composer cannot request a rescan during that period, so new skills remain absent beyond the five-minute window. Require a non-negative age before applying the TTL; the existing request throttle can limit repeat requests when clocks differ. Based on learnings, window boundary checks must follow their intended inclusive or exclusive semantics. 🤖 Prompt for AI AgentsSource: Learnings |
||
| } | ||
|
|
||
| /** | ||
| * Availability of a configured provider instance from the runtime's POV. | ||
| * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
Track the request cooldown by scope, not by the last visited scope. Switching A → B → A within the TTL replaces A’s request record with B’s. If A’s snapshot appears stale, the composer sends another A request despite the stated per-scope cap.
apps/web/src/components/chat/ChatComposer.tsx#L2245-L2248: retain request timestamps by scope key and clear only the affected scope when its snapshot is invalidated.apps/mobile/src/features/threads/use-composer-command-menu.ts#L299-L302: apply the same per-scope tracking and invalidation.📍 Affects 2 files
apps/web/src/components/chat/ChatComposer.tsx#L2245-L2248(this comment)apps/mobile/src/features/threads/use-composer-command-menu.ts#L299-L302🤖 Prompt for AI Agents