Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(composer): scope skill discovery to workspace #8528

ClosedD3OXY(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/8528/headopened View on GitHub

Warning

Depends on #8336. This branch is one commit on top of its current head. Keep this PR in draft until #8336 merges. Once #8336 lands, this PR contains only the workspace picker fix.

The skill picker currently reads each provider health snapshot, which discovers from the server process cwd. Project and worktree skills are therefore missing in desktop, remote, and multi-project sessions.

This adds a provider.listSkills request keyed by provider instance, project, and optional thread. The server resolves thread.worktreePath ?? project.workspaceRoot, then calls the provider discovery path for Codex, Claude, Cursor, Grok, and OpenCode. Web and mobile use that catalog for the picker, editor chips, and message skill links. A five-second per-instance cache avoids repeated probes, and discovery failures keep the old snapshot fallback.

Tests: focused provider and contract tests, server/web/mobile typechecks, targeted lint.

Built with gpt-5.6-sol in T3 Code.

Note

Scope skill discovery to workspace and pass explicit skill invocations

  • Adds provider.listSkills RPC and useProviderSkills hooks for mobile and web to fetch workspace-scoped skills, falling back to provider snapshot.
  • Introduces ExplicitSkillInvocation contract and carries it through outbox, decider, and reactor to preserve skill token ranges in outgoing messages.
  • Provider adapters for Claude, Codex, Cursor, Grok, and OpenCode now discover skills for the session cwd and embed invoked skill documents into the prompt text, removing raw $skill tokens.
  • Composer components track skill token ranges during text edits and remap them for sends.
  • Behavioral Change: ThreadComposerProps on mobile and ChatComposer on web now require skills and draftSkillInvocations props; onChangeDraftMessage accepts a second skillInvocations argument.
Macroscope summarized f2c0e76. (Automatic summaries will resume when PR exits draft mode or review begins).
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: de16c932-359e-4993-937c-58d2451d2f0d

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. UI Consistency review: one finding in apps/web/src/components/chat/ChatComposer.tsx. The new getSendContext() reads the Lexical editor snapshot unconditionally, but the editor does not always render the draft, so the retained draft text can be dropped on send. Everything else in the web scope (provider-skill query plumbing, composer skill-chip offsets, ChatComposer/ChatView prop threading) keeps explicit environment scope and introduces no styling/primitive or Tailwind-ownership changes.

      Posted via Macroscope — UI Consistency
    4. Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This is a large, cross-cutting provider skill discovery and invocation feature spanning clients, contracts, orchestration, authentication, and five provider adapters. It also contains an unresolved concern about approval-state sends potentially dropping and clearing the user’s draft text.

      Notes:

      • Macroscope's correctness review did not run, so approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. Effect service conventions review of the new provider-skills code. One finding: queryProviderSkills takes hand-rolled Effect-returning dependency functions instead of acquiring its services from the Effect environment. Everything else (namespace subpath imports, Schema.TaggedErrorClass with structured attributes and derived message, cause preservation, no ManagedRuntime/runPromise in domain code) looks consistent with the conventions.

      Posted via Macroscope — Effect Service Conventions
    6. One finding on the web composer send path: explicit skill-invocation offsets are remapped from the wrong source text, so selected $skill chips can be silently dropped before the turn is dispatched.

      Posted via Macroscope — UI Consistency
    7. One finding: the web composer now derives explicit skill invocations from every $token chip, including tokens that match no known skill, which makes the provider reject the whole turn.

      Posted via Macroscope — UI Consistency
    8. One consistency gap found in the web composer send paths: explicit skill invocations are plumbed through the main onSend dispatch but not through the plan follow-up dispatch in the same callback. Everything else in scope (ChatView.tsx, ChatComposer.tsx, ComposerPromptEditor.tsx, lib/terminalContext.ts, state/providerSkills.ts) checks out: the editor snapshot offsets are measured against the same expanded text that readSnapshot().value returns, the terminal-context materialization remaps ranges correctly, the approval-state snapshot guard is in place, and useProviderSkills is always given an explicit environmentId/projectId scope rather than an active-environment fallback.

      Posted via Macroscope — UI Consistency
      @@ -5755,3 +5771,8 @@
      57555771 effort: ctxSelectedPromptEffort,
      57565772 text: messageTextForSend || ATTACHMENT_ONLY_BOOTSTRAP_PROMPT,
      57575773 });
      5774+ const outgoingSkillInvocations = remapExplicitSkillInvocations({
      5775+ sourceText: messageTextForSend,
      5776+ outgoingText: outgoingMessageText,
      5777+ invocations: terminalContextPrompt.ranges,
      5778+ });
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Skill chips are silently dropped on the plan follow-up send path. When showPlanFollowUpPrompt && activeProposedPlan (and there are no image/file attachments), onSend returns early at line 5676 via onSubmitPlanFollowUp({ text: followUp.text, ... }), and that handler's startThreadTurn message (line 6493) never sets skillInvocations. So a $skill chip inserted while a proposed plan is pending is sent as literal $name text and never invoked, while the identical chip sent through this path below is invoked.

      Since resolvePlanFollowUpSubmission returns the trimmed draft verbatim when the user typed feedback, the smallest fix is to remap composerSkillInvocations against the outgoing follow-up text and thread them into onSubmitPlanFollowUp → its startThreadTurn message, e.g. remapExplicitSkillInvocations({ sourceText: promptForSend, outgoingText: outgoingFollowUpText, invocations: composerSkillInvocations }). (Alternatively, skip the follow-up branch when composerSkillInvocations.length > 0, the same way it is skipped for attachments, so the message goes through the path that supports skills.)

      Posted via Macroscope — UI Consistency

Sign in to join this conversation.