CopilotKit / CopilotKit/outpost

Retire the three unreachable postAiResponse helpers

Open
#259 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: integrations priority: low roadmap: later
Dominant language
TypeScript
Stars
7
Forks
3
Avg merge
7d 16h
Merged PRs (30d)
15

Description

Three fully-formed "post the AI answer to the platform" helpers exist and none of them is reachable:

  • apps/github-app/src/lib/github-poster.ts:36postAiResponsepostIssueComment / postDiscussionComment, real Octokit calls
  • apps/slack-bot/src/lib/slack-poster.ts:16postAiResponseclient.chat.postMessage
  • apps/teams-bot/src/lib/teams-poster.ts:26postAiResponsecontext.sendActivity (the file documents its own unreachability at lines 23-24)

Nothing imports any of them except github-poster.test.ts, so there's no live leak. The real path is the worker's PlatformAdapter, which is gated on shadow mode in packages/outpost/queue/src/handlers/ai-response.ts.

The problem is what happens next time someone needs a direct post. Each of these is one import away from being wired up, and none consults shadow mode, so the caller would silently bypass the gate — and docs/deployment.md:212 currently asks the author to remember by hand. That's the same shape as the bug #233 is fixing: enforcement by convention rather than by the predicate.

Two ways to go, and I lean toward the first:

  1. Delete them. The PlatformAdapter path in the worker is the real one, and dead code that looks live is worse than no code.
  2. Guard them, so a future caller inherits the check:
export async function postAiResponse(target: PostTarget, options: PostResponseOptions): Promise<void> {
    if (isShadowMode()) {
        console.log(`[GitHub App] Shadow mode — response for ${owner}/${repo} withheld`);
        return;
    }
    ...
}

Worth confirming nobody has a branch in flight that intends to use them before deleting. Depends on #233 if we take option 2.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by checking imports and related branches for apps/github-app/src/lib/github-poster.ts, apps/slack-bot/src/lib/slack-poster.ts, and apps/teams-bot/src/lib/teams-poster.ts; review github-poster.test.ts and the worker path in packages/outpost/queue/src/handlers/ai-response.ts. Confirm the intended choice with #233 and any in-flight work, then finish with no unreachable helpers or with shadow-mode guards consistently enforced, updating docs/deployment.md if needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.