Add NEMO_EMAIL_MODE env var to gate email_blast permissions #35

Open
opened 2026-04-06 15:54:28 +00:00 by forgejo_admin · 0 comments

Type

Feature

Lineage

Standalone — safety gate identified during westside-email-agent buildout (2026-04-04). NEMO (Qwen 3.5:4b) should not have unrestricted email blast access.

Repo

forgejo_admin/westside-ai-assistant

User Story

As a superadmin, I want to control NEMO's email permissions via environment variable, so that I can restrict a small model to test-only sends until trust is earned.

Context

NEMO currently has an email_blast tool that can send to any audience. A 4B model should not have unrestricted access to blast real parents. The permission level should be controlled via deployment config (env var), not code changes.

Three modes:

  • disabled — email_blast tool not available, NEMO cannot send any emails
  • test_only — tool exists but forces test_email to an allowlist. Rejects blasts without test_email. DEFAULT.
  • full — unrestricted (future, after trust is earned)

File Targets

Files to modify:

  • app/config.py — add nemo_email_mode: str = "test_only" and nemo_test_emails: str = "draneylucas@gmail.com,marcusdraney23@gmail.com"
  • app/ai.py — check settings.nemo_email_mode before executing email_blast. In disabled mode, remove tool from TOOLS list. In test_only mode, force test_email param and reject if not in allowlist.

Files to modify in pal-e-deployments:

  • overlays/westside-ai-assistant/prod/deployment-patch.yaml — add NEMO_EMAIL_MODE=test_only and NEMO_TEST_EMAILS env vars

Acceptance Criteria

  • NEMO_EMAIL_MODE=disabled — email_blast tool not in TOOLS list
  • NEMO_EMAIL_MODE=test_only — email_blast works but only sends to addresses in NEMO_TEST_EMAILS
  • NEMO_EMAIL_MODE=full — unrestricted (existing behavior)
  • Default is test_only when env var not set
  • Attempting blast without test_email in test_only mode returns error message to GroupMe

Test Expectations

  • Unit test: disabled mode excludes email_blast from tools
  • Unit test: test_only mode rejects blast without test_email
  • Unit test: test_only mode rejects test_email not in allowlist
  • Unit test: full mode allows unrestricted blast
  • Run: pytest tests/ -v

Constraints

  • No code change needed to switch modes — just env var in deployment
  • Default must be test_only — fail safe, not fail open
  • Allowlist is comma-separated env var, same pattern as groupme_allowed_group_ids

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • sop-email-send — email safety rules
  • arch-email — email architecture
  • westside-ai-assistant#31 — the email_blast tool this gates
### Type Feature ### Lineage Standalone — safety gate identified during westside-email-agent buildout (2026-04-04). NEMO (Qwen 3.5:4b) should not have unrestricted email blast access. ### Repo `forgejo_admin/westside-ai-assistant` ### User Story As a superadmin, I want to control NEMO's email permissions via environment variable, so that I can restrict a small model to test-only sends until trust is earned. ### Context NEMO currently has an `email_blast` tool that can send to any audience. A 4B model should not have unrestricted access to blast real parents. The permission level should be controlled via deployment config (env var), not code changes. Three modes: - `disabled` — email_blast tool not available, NEMO cannot send any emails - `test_only` — tool exists but forces test_email to an allowlist. Rejects blasts without test_email. DEFAULT. - `full` — unrestricted (future, after trust is earned) ### File Targets Files to modify: - `app/config.py` — add `nemo_email_mode: str = "test_only"` and `nemo_test_emails: str = "draneylucas@gmail.com,marcusdraney23@gmail.com"` - `app/ai.py` — check `settings.nemo_email_mode` before executing email_blast. In `disabled` mode, remove tool from TOOLS list. In `test_only` mode, force test_email param and reject if not in allowlist. Files to modify in pal-e-deployments: - `overlays/westside-ai-assistant/prod/deployment-patch.yaml` — add `NEMO_EMAIL_MODE=test_only` and `NEMO_TEST_EMAILS` env vars ### Acceptance Criteria - [ ] `NEMO_EMAIL_MODE=disabled` — email_blast tool not in TOOLS list - [ ] `NEMO_EMAIL_MODE=test_only` — email_blast works but only sends to addresses in NEMO_TEST_EMAILS - [ ] `NEMO_EMAIL_MODE=full` — unrestricted (existing behavior) - [ ] Default is `test_only` when env var not set - [ ] Attempting blast without test_email in test_only mode returns error message to GroupMe ### Test Expectations - [ ] Unit test: disabled mode excludes email_blast from tools - [ ] Unit test: test_only mode rejects blast without test_email - [ ] Unit test: test_only mode rejects test_email not in allowlist - [ ] Unit test: full mode allows unrestricted blast - Run: `pytest tests/ -v` ### Constraints - No code change needed to switch modes — just env var in deployment - Default must be test_only — fail safe, not fail open - Allowlist is comma-separated env var, same pattern as groupme_allowed_group_ids ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `sop-email-send` — email safety rules - `arch-email` — email architecture - westside-ai-assistant#31 — the email_blast tool this gates
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo_admin/westside-ai-assistant#35
No description provided.