Skip to content

feat(api,admin): label every agent failure notification with the installation's name (CLEAN-167) - #141

Merged
maksymhryzodub-prog merged 1 commit into
mainfrom
feat/CLEAN-167-environment-label
Oct 15, 2026
Merged

maksymhryzodub-prog merged 1 commit into
mainfrom
feat/CLEAN-167-environment-label

Conversation

@maksymhryzodub-prog

@maksymhryzodub-prog maksymhryzodub-prog commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Jira: CLEAN-167. Stacked on #140 (CLEAN-165) — merge that first; this diff is the last commit only.

What it does

A Slack message about a failed agent now says which installation it came from. Set RANCH_ENVIRONMENT on the API deployment (dev, staging, prod-eu) and every channel-level message starts with it in brackets:

🔴 @channel [dev-mazda] Test Chatbot — incident #12 · down since 4:04 PM · OOMKilled
🔴 [dev-mazda] Agent failed: Test Chatbot            ← webhook
✅ [dev-mazda] Test notification from Ranch

Thread replies carry no label (they live inside the root). Unset: nothing changes — an install that never set it looks as it did.

How

  • infrastructure.environment in the settings catalogue, resolved by InfraConfigGateway.getEnvironment() the way api_public_url is: setting → RANCH_ENVIRONMENT → null. Trimmed; a settings outage yields null, so a notification still goes out, unlabelled.
  • AgentEventModule imports SettingModule; NotificationDestinationService.environment() is the one read, passed into renderRoot / renderOpened / renderClosed / renderTest. The label is escaped like any text that is not ours.
  • The destination view (API DTO, Settings → Notifications, get_notification_destination) reports environment, so the owner sees what messages will carry — and a hint to set the variable when it is empty.
  • .env.example and docs/operations/agent-events.md tell DevOps the variable and what it does.

Verified

  • api: bun run build; jest for agent/event + setting + tool-secrets (227) and the whole suite; eslint --quiet + Prettier on changed files. New specs: the label on every channel-level renderer and absent from replies; the flow on the bot (root and rewrites labelled, thread not) and on the webhook; getEnvironment precedence, trimming and the null cases.
  • admin: bun test slices (195), npx nuxt typecheck, bun run locale:check.
  • Not run live: the label through a real Slack post — the renderers are the ones the live proof of feat(api,admin): Slack bot transport — one message per incident, the story in its thread, the state as a reaction (CLEAN-165) #140 exercised, with one string prepended.

Twin consoles

admin changed (the view's one line). app has no agent/event sub-slice: nothing to mirror.

For DevOps

Add to the API deployment: RANCH_ENVIRONMENT=<short name of the cluster>. No restart beyond the rollout; the owner can override it in settings.

🤖 Generated with Claude Code

@maksymhryzodub-prog
maksymhryzodub-prog added this pull request to stack #142 October 15, 2026 12:12
Base automatically changed from feat/CLEAN-165-slack-bot-transport to main October 15, 2026 12:13
…allation's name (CLEAN-167)

RANCH_ENVIRONMENT on the API — or the infrastructure.environment setting
over it — puts "[dev-mazda] " at the start of every channel-level
message: the bot's root and its rewrites, the webhook's two messages,
the test. Thread replies stay unlabelled; they live inside the root.
Unset, nothing changes.

The destination view reports the label in force so the owner sees it in
Settings → Notifications and through get_notification_destination.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@maksymhryzodub-prog
maksymhryzodub-prog force-pushed the feat/CLEAN-167-environment-label branch from 1ecefef to 56001ea Compare October 15, 2026 12:13
@maksymhryzodub-prog
maksymhryzodub-prog merged commit 1dfed26 into main Oct 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant