Skip to content

Full triage, approvals, investigation agent, knowledge and gated execution - #6

Merged
AshMT merged 5 commits into
mainfrom
claude/fervent-gates-vkhqj9
Sep 23, 2026
Merged

AshMT merged 5 commits into
mainfrom
claude/fervent-gates-vkhqj9

Conversation

@AshMT

@AshMT AshMT commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Follows #5. Five commits on top of what that merged.

What's in it

Triage engine (8a5867c): category, impact × urgency priority, queue routing, summary, suggested reply and next steps; deterministic signals (security/fraud, outage, VIP, after-hours, repeat requester); tenant recognition by client domain and M365 tenant with cross-client and personal-address detection; duplicates, similar tickets and incident clustering; multi-user roles, invitations and an audit log; approvals with one or two approvers, expiry and optional auto-approval; execution plans built from CIPP's API; read-only CIPP lookups feeding plan prechecks.

UI (7289a0c): magpie redesign; triage queue, ticket detail, approvals, incidents, people; per-dimension calibration (action, category, priority).

Investigation, knowledge, execution (282637a, e6865c2):

  • Investigation agent (off by default): OpenAI-compatible tool calling with read-only tools confined to the ticket's own client. Recommendations and findings are checked against what the lookups actually returned.
  • Knowledge: runbooks per client or general, cited on tickets; SuperOps KB sync when the schema exposes one.
  • Execution (off by default; per-action and per-client allowlists; SWOOP_DISABLE_EXECUTION kill switch): dry run first, values resolved against the live tenant with ambiguous, dynamic, AD-synced and role-assignable groups refused, writes sent once and never retried, results read back from the tenant, one live run per proposal, unknown outcomes block retries until a person records them, temporary passwords encrypted and revealed once. Failures and unknown outcomes are audited and noted on the ticket.
  • Identity: authorised contacts per client; approvers record how they verified the requester for password, MFA, account-enable and mailbox changes. Auto-approval never covers these.

Container (6fefcf7): honours PUID/PGID and fixes data-folder ownership on start.

Testing

  • 384 backend tests and 9 frontend tests, plus lint and typecheck. CI green on e6865c2.
  • End to end in Chromium against mock SuperOps and AI endpoints and a stateful fake CIPP: investigate → approve → dry run → live group add read back from the tenant; password reset with an identity check and a one-time reveal (the password is in no note, log or database file); a non-allowlisted client blocked.
  • Not yet run against a real CIPP. Do dry runs against a test tenant before allowing live runs (first item in TODO.md).

🤖 Generated with Claude Code

https://claude.ai/code/session_017Q4siuyiAoEj7Qwd4r6Fkv


Generated by Claude Code

The previous image switched from running as root to running as the `node`
user. A data folder created by the older, root-running image is root-owned,
so after the upgrade SQLite could not create its journal and startup failed
with "attempt to write a readonly database". This was hit on a real Unraid
install.

The container now starts as root only long enough to make /app/data owned by
PUID:PGID, then drops to that user with su-exec before starting Swoop. It
follows the PUID/PGID convention Unraid and most self-hosting guides expect
(Unraid defaults 99/100; the image defaults to 1000/1000). An upgrade can no
longer strand an existing install this way.

Details:
- Only paths with the wrong owner are changed, so a large database is not
  rewritten on every start.
- The data folder is set to no access for others: it holds encrypted
  credentials and ticket contents.
- PUID=0 is refused, so the app can never be configured to run as root.
- If the container is already started unprivileged (docker run --user), the
  entrypoint runs the command directly instead of failing.

Tested with a stubbed su-exec: root-owned files from the old image get fixed,
already-correct ownership is left alone, defaults apply when unset, PUID=0 and
non-numeric values are refused, and a non-root start runs directly. The image
itself could not be built in this environment (no Docker daemon).

README gains an Unraid section with the exact template settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Q4siuyiAoEj7Qwd4r6Fkv
… approvals

Triage now answers the questions a dispatcher asks, not just which of nine
identity actions a ticket resembles:

- Category, impact and urgency from the model; priority computed from an
  impact x urgency matrix; queue from per-tenant routing; summary, a reply
  for the requester and next steps for the technician.
- Deterministic signals that can raise but never lower: security patterns
  (phishing, compromise, MFA fatigue, malware, payment-detail fraud),
  organisation- and team-wide outage language, VIP requesters, out-of-hours
  routing to on-call, repeat requesters.
- Tenant recognition: clients own email domains and a Microsoft 365 tenant.
  Tickets match on requester domain when the company is unknown, and a
  request that reaches into another client's tenant, or comes from a
  personal address, is flagged and escalated.
- TF-IDF similarity for duplicates, related tickets and reviewed examples
  shown to the model; bursts of similar problem tickets become incidents,
  cross-client bursts flagged as likely upstream.
- Read-only CIPP lookups of the target user (GET only) feeding prechecks.
- Execution plans built from CIPP's real endpoint schemas; never executed.
- Multi-user accounts with viewer/reviewer/approver/admin roles, one-time
  invite links, per-request session checks with real revocation, and an
  audit log.
- Approval policy: one or two approvers, expiry, optional auto-approval for
  clean high-confidence actions; decisions posted to the ticket.

One pipeline now serves both the poller and re-runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Q4siuyiAoEj7Qwd4r6Fkv
…imension calibration

Design: an Australian magpie in a dive as the mark, pied ink-and-feather
neutrals, the wing's teal-to-violet sheen as the accent and its red-brown
eye for what is urgent. New tickets swoop into the queue; loading and empty
states speak in the same voice. Motion respects reduced-motion.

New pages:
- Triage queue: each ticket's latest triage, most urgent first, with
  priority counts, open incidents, pending approvals and cross-client flags.
- Ticket detail: summary, suggested reply, next steps, flags, tenant
  recognition, the CIPP lookup, the execution plan with prechecks,
  approval, review of each dimension, and triage history.
- Approvals, Incidents, People (invitations, roles, audit log) and a
  public invitation page.
- Settings tabs for triage rules, approval policy and CIPP.
- Client recognition fields with domains suggested from past tickets.

Calibration now scores category and priority separately from the action,
and splits priority misses into over- and under-called. A review that only
corrects the priority no longer counts against the action.

Also fixes:
- The pre-paint theme script was inline and blocked by the app's own CSP,
  so dark-mode users saw a white flash. It is now a static file.
- Tickets that arrived before an incident was recognised are raised to the
  incident's priority when it forms.
- "Everyone in accounts" is a team, not the whole organisation.
- Changing a password keeps the current session while revoking the rest.

Docs: README rewritten around the triage, recognition, approvals, roles
and CIPP; PLAN.md's CIPP table corrected against CIPP's OpenAPI spec
(ExecAddMember, ExecRemoveMember and ExecEnableUser do not exist).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Q4siuyiAoEj7Qwd4r6Fkv
Swoop can now work a ticket the way a technician would, and — when an
operator deliberately turns it on — make the approved change itself.

Investigation (off by default):
- A tool-calling agent reads the client's Microsoft 365 tenant (user,
  groups, MFA, sign-ins, licence stock, group search), the runbooks, similar
  tickets, and the client and requester profile, then diagnoses and
  recommends.
- Every tool is scoped to the ticket's own client: the tenant comes from the
  client mapping, users only on the client's domains. A prompt-injected
  ticket gets a refusal, not another client's data.
- Its recommendation is grounded: a group or licence the tools never
  returned is dropped. It can confirm values for the action triage proposed;
  if it disagrees about the action, that is flagged and blocks
  auto-approval. It never introduces a new target.

Knowledge:
- Runbooks per client or for everyone, searchable, with client-specific
  ones ranked first; the SuperOps knowledge base is discovered by the schema
  probe and synced read-only. Relevant runbooks attach to every ticket.

Execution (off by default, allowlisted per action and per client, with an
install-wide SWOOP_DISABLE_EXECUTION kill switch):
- A separate write-only CIPP client, importable only by the executor (a
  test enforces it). Nothing the model wrote is sent: the executor resolves
  the user, group and licence against the live tenant and refuses anything
  ambiguous, dynamic, AD-synced, role-assignable or out of stock.
- Request bodies checked against CIPP-API's source: member object ids for
  EditGroup, LicensesToRemove for licence removal, ExecDisableUser plus
  session revocation for offboarding.
- A dry run before a live run; state re-read immediately before acting;
  every change read back from the tenant, because CIPP answers HTTP 200 for
  some failures.
- At most one live run per proposal (a partial unique index). A request
  without an answer is 'uncertain' and blocks retries until a person
  records what happened.
- Temporary passwords are pulled from CIPP's response, encrypted, shown
  once to an approver, wiped after 24 hours, and redacted everywhere else.

Identity:
- Clients have authorised contacts. An on-behalf change from anyone else is
  a plan blocker. Password resets, MFA resets, re-enabling an account and
  mailbox access need each approver to record how the requester's identity
  was confirmed, and can never run on auto-approval.

Also corrects the plan's CIPP payloads to match what CIPP actually reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Q4siuyiAoEj7Qwd4r6Fkv
Ticket page: investigation panel (findings, recommendation, lookup
timeline), relevant runbooks, and a "Carry it out" panel with dry run,
confirmed live run, read-back result, one-time password reveal, and
recording an unknown outcome. Approvers record how they verified the
requester for identity-sensitive changes; quick-approve skips those.

Settings gains Agent and Execution tabs (allowlists, dry-run gate, run on
approval, confirmation before going live). New Knowledge page for
runbooks and SuperOps KB sync. Clients take authorised contacts. The
audit log describes execution, runbook and investigation events.

Backend:
- Findings credited to a lookup that never ran are dropped as ungrounded.
- The proposal's execution state follows live runs only, so a later dry
  run cannot hide that a change was made.
- Failed, stopped and unknown-outcome live runs are audited and noted on
  the ticket, not just successes.
- Execution policy rejects clients from another tenant; allowlist changes
  are audited.
- Manual investigation respects the agent switch.
- Knowledge search can span all clients for the Knowledge page only.
- Approval notes record the identity check and whether Swoop will run it.

Docs: README sections for Knowledge, the agent, Execution and identity
checks; SWOOP_DISABLE_EXECUTION documented.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Q4siuyiAoEj7Qwd4r6Fkv
@AshMT
AshMT merged commit e342e7e into main Sep 23, 2026
2 checks 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.

2 participants