fix: workspace review decision toasts survive "Sync now"; publish refusals carry a code

SA
3h ago
+0-0

Issue for this PR

No GitHub issue: found in an end-to-end run of workspace review (#1685, #1716) against a local backend, web app and the VS Code extension.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

  • Decision toasts in the TUI survive "Sync now".
    • The bug: the TUI shows one toast at a time (packages/tui/src/ui/toast.tsx, currentToast). "Sync now" announces the skill and knowledge decisions it finds as events, and then shows its own "Synced: 0 team rules, 0 pending review." summary, which replaced the decision toast at once.
    • The decision was already recorded as shown, so the person never saw "approved" or "rejected — reason", and it never came back. The guard that hides the summary only looked at rule notices (pull.notices).
    • The fix: decisions now go through one toaster per TUI (decisionToaster in rules.tsx).
      • Decisions that arrive within 300 ms are shown as one toast: five are named and the rest counted. Before, the second replaced the first.
      • "Sync now" skips its summary when a decision was shown, or is waiting to be, since it started. Problems (sync skipped, proposals kept queued, a failed pull) are still shown.
  • skill publish --json refusals carry a code. A refusal the command explains now includes its stable code (review_disabled, too_many_requests, not_workspace_owner, …) next to error, as #1716 described. Before, the review-off refusal had only the message.
  • Docs: the code field in configure/skills.md.

How did you verify your code works?

  • Unit: bun test test/cli/tui/rules-requests.test.ts has 5 passing tests: one decision's text is unchanged, a combined toast is a warning when any decision is a rejection or removal, five named then "and N more", and the toaster's shownSince while a toast is held and after it is shown. bun run typecheck is clean, and the marker guard (analyze.ts --markers --strict) passes.
  • Wider suites: test/cli/tui, test/altimate/rules, test/altimate/workspace have 1886 passing tests. One test fails, datamate_manager write that races the link, and there is one unhandled error in review.test.ts (which passes on its own). Both happen the same way on a clean main checkout.
  • End to end against a local backend:
    • Before: the owner rejected a member's skill, the member chose "Sync now", and only "Synced: …" appeared. A screen watcher polling every 250 ms never saw the decision.
    • After: the owner approved one skill and rejected another. "Sync now" showed one warning toast naming both, with the reason, and no summary replaced it.
    • With review off, skill publish cost-guard --json printed "code": "review_disabled" and exited 1.

Cost side effects

None. No new requests: the toaster only changes how decisions already received are shown.

Screenshots / recordings

Before: "Sync now" after a rejectionAfter: two decisions after "Sync now"

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR
  • I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"

🤖 Generated with Claude Code


Summary by cubic

Fixes review decision toasts in the TUI being replaced by the "Sync now" summary, and adds a stable code to skill publish --json refusals.

  • Decisions that arrive together within 300 ms are shown as one toast (five named, the rest counted); "Sync now" skips its summary when a decision was shown since it started. Problems are still shown.
  • skill publish --json refusals now include a stable code (review_disabled, too_many_requests, not_workspace_owner, bundle_too_large) next to error.
  • Documents the code field in configure/skills.md.

Summary by CodeRabbit

  • New Features
    • JSON skill publish errors now include stable codes for known refusal reasons, such as disabled reviews, rate limits, ownership issues, or oversized bundles.
    • Review decision notices can be combined into a single notification, with a warning style when any decision is rejected or a non-rule item is retired.
  • Improvements
    • /rules Sync avoids showing a success message when review activity was already reported.