Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/skills/deep-read-issue/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Capture per issue:
- **Surface package MATURITY explicitly** (`stable` / `deprecated` / `experimental` / `pre-release 0.x` / `beta`). If the reporter is on anything that isn't a stable current release, say so loudly — the orchestrator must put this in the card's FIRST SENTENCE (What line), not bury it, so Nathan can tell at a glance it may be a "just migrate/upgrade" case and NOT tag engineering. Output e.g. `MATURITY: deprecated (@copilotkitnext)` or `MATURITY: pre-release 0.x (@ag-ui/*)`.
- **`@copilotkitnext/*` = DEPRECATED (the useAgent-era experimental v2 line).** As of 2026-06-18 the `@copilotkitnext/*` packages are deprecated on npm and merged into `@copilotkit` v2 — `@copilotkitnext/core` → `@copilotkit/core`, `@copilotkitnext/react` → `@copilotkit/react-core/v2`, `@copilotkitnext/runtime` → `@copilotkit/runtime/v2` (last publish 1.54.1; current `@copilotkit` is on the 1.6x line). **Two things follow:** (1) a reporter on `@copilotkitnext/*` is on a dead package → the version line should note `(deprecated — migrate to @copilotkit/*/v2)` and the fix plan should first check whether the bug is already gone in current `@copilotkit` v2 (often it's a "just migrate" case, not a code fix); (2) **cite the exact subpackage the reporter used, never the bare scope `@copilotkitnext`** (which isn't a valid package). Also note: coding agents frequently *invent* `@copilotkitnext` from training data because it was real during useAgent development — so only report it when the REPORTER'S OWN text uses it; don't let an agent's guess put it on the card.
- **Maintainer status, quoted.** Any comment from a MEMBER / OWNER / COLLABORATOR (check authorAssociation) that states status — "fixed in 1.60.1", "closing, reopen if not", "this is a real bug", a Linear/ENT-#### ref, "PR up". Quote it with author + date.
- **Ignore the support bot for status.** `copilotkit-support-bot` / getorca "Recommended Solutions" are auto-generated guesses, NOT maintainer status or confirmation. Note bot advice only if a human endorsed it.
- **Ignore support bots for status.** Auto-generated "Recommended Solutions" comments, from `copilotkit-support-bot` or any other account, are guesses, NOT maintainer status or confirmation. Note bot advice only if a human endorsed it.
- Whether the *reporter* confirmed the fix (vs a maintainer closing speculatively).
- Cross-references (Discord threads, related issues, sibling-repo dup).
- **TRUE COMMUNITY (by subject, not repo).** Decide whether the issue is really a CopilotKit or an AG-UI problem from *what is actually broken*, not which repo it was filed in. **Trigger:** an `ag-ui` issue whose subject/repro is a **CopilotKit** bug (it says CopilotKit chat/runtime/component breaks, or the fix shipped in a CopilotKit release) is **MIS-FILED → attribute to CopilotKit** (and the reverse). Output `COMMUNITY: CK | AG-UI` + `MIS-FILED: yes/no (filed in <repo>, true owner <product>, because <broken artifact>)`. **Caveat:** ownership of the broken *tool* wins over mere mentions — `create-ag-ui-app` failing is AG-UI's even though it scaffolds CopilotKit. Flag every mis-filed issue so the orchestrator lists it on the right page only. (Precedent the agent previously MISSED: `ag-ui#1891` "Illegal invocation" — an `HttpAgent` bug that breaks CopilotKit chat, fixed in CopilotKit 1.60.1 → it's CopilotKit's, not AG-UI's.)
Expand Down
19 changes: 7 additions & 12 deletions apps/discord-bot/src/lib/shadow-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
import type { ThreadChannel, Message } from 'discord.js';

/**
* Shadow mode allows Outpost to run alongside Orca without double-posting.
* Shadow-mode handlers for the Discord bot.
*
* When SHADOW_MODE=true:
* - Tickets are created in the Outpost DB as normal
* - AI responses are generated but NOT posted to Discord
* - Shadow responses are logged for quality comparison against Orca
*
* This enables a parallel-run validation period before full cutover.
* When SHADOW_MODE=true, the bot records tickets through these handlers instead
* of the normal ingest flow. The AI response is held back by the worker, which
* reads SHADOW_MODE itself, so set the flag on the worker too. See "Shadow mode
* (staging safety)" in docs/deployment.md.
*/
export function isShadowMode(): boolean {
return process.env.SHADOW_MODE === 'true';
Expand Down Expand Up @@ -48,7 +46,7 @@

console.log(
`[Shadow Mode] Logged response for ticket ${response.ticketId} ` +
`(${response.responseTimeMs}ms)`,
`(${response.responseTimeMs}ms)`,
);
}

Expand Down Expand Up @@ -115,10 +113,7 @@

return ticket.id;
} catch (error) {
console.error(
`[Shadow Mode] Failed to create ticket for thread ${thread.id}:`,
error,
);
console.error(`[Shadow Mode] Failed to create ticket for thread ${thread.id}:`, error);
return null;
}
}
Expand All @@ -129,7 +124,7 @@
export async function handleShadowMessage(
message: Message,
ticketId: string,
threadId: string,

Check warning on line 127 in apps/discord-bot/src/lib/shadow-mode.ts

View workflow job for this annotation

GitHub Actions / Lint, Typecheck & Test

'threadId' is defined but never used. Allowed unused args must match /^_/u
): Promise<void> {
try {
await prisma.message.create({
Expand Down
19 changes: 10 additions & 9 deletions docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,16 @@ to verify agent behavior without replying to real users.
`SHADOW_MODE` is read by **more than one service**, and each one gates a different point
in the flow. Set it consistently across an environment rather than on a single service:

| Service | What the flag changes |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `outpost-discord-bot` | At ingest. `thread-create.ts` and `message-create.ts` call `isShadowMode()` and divert to `handleShadowThreadCreate` / `handleShadowMessage`, recording the ticket and a shadow response silently instead of running the normal visible flow (`src/lib/shadow-mode.ts`). |
| `outpost-worker` | At post-back. The `AI_RESPONSE` handler checks the flag immediately before `adapter.postResponse` and persists the response as a shadow `Message` row instead of posting (`queue/src/handlers/ai-response.ts`). Also gates `ONBOARDING_DIGEST`, which posts a daily digest straight to Discord via `DISCORD_DIGEST_CHANNEL_ID` over raw REST. |

For Discord either gate alone is enough to stop a post, so they are belt-and-braces. The
worker's gate is the one that covers **every** platform (GitHub, Slack, Teams) plus the
digest job, because that is where the adapter call lives — so a staging environment must
have it set on `outpost-worker`, not only on a bot.
| Service | What the flag changes |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `outpost-discord-bot` | At ingest. `thread-create.ts` and `message-create.ts` call `isShadowMode()` and divert to `handleShadowThreadCreate` / `handleShadowMessage`, recording the new ticket or reply (and, for a new thread, queueing its AI response) instead of running the normal flow (`src/lib/shadow-mode.ts`). The shadow response row itself is written by the worker. |
| `outpost-worker` | At post-back. The `AI_RESPONSE` handler checks the flag immediately before `adapter.postResponse` and persists the response as a shadow `Message` row instead of posting (`queue/src/handlers/ai-response.ts`). Also gates `ONBOARDING_DIGEST`, which posts a daily digest straight to Discord via `DISCORD_DIGEST_CHANNEL_ID` over raw REST. |

The bot's gate does not stop the AI response: for a new thread the bot still queues the
`AI_RESPONSE` job, and a worker without the flag posts it. The worker's gate is the one that
covers **every** platform (GitHub, Slack, Teams) plus the digest job, because that is where
the adapter call lives — so a staging environment must have it set on `outpost-worker`, not
only on a bot.

When adding any new outbound post path, check `SHADOW_MODE` before posting — otherwise
staging will deliver to real users regardless of the flag.
Expand Down
299 changes: 0 additions & 299 deletions scripts/__tests__/cutover.test.ts

This file was deleted.

Loading
Loading