Skip to content

feat(slm): an admin page for the chat approval settings, with an audit record (#20465) - #20536

Closed
mrveiss wants to merge 3 commits into
mainfrom
issue-20465-chat-approval-settings
Closed

mrveiss wants to merge 3 commits into
mainfrom
issue-20465-chat-approval-settings

Conversation

@mrveiss

@mrveiss mrveiss commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Thinking Path

The maintainer asked for an admin option to auto-approve tool calls in chats that used an attached file. The setting from #20401 can only be changed through the generic API, and neither chat approval setting has a page or an audit record. An admin needs to see the risk where they change it, and the change has to leave a trail.

What Changed

  • New SLM admin panel ChatApprovalSettings.vue for chat.relaxed_approval_categories and chat.auto_approve_attachment_turns, with a route, a settings tab and en.json keys. Auto-approve is off by default and states the risk.
  • api/settings.py writes an audit row with who, old and new value when these two keys change. It covers only these keys, because the table also holds credential-adjacent settings whose values must not reach the audit log.
  • An audit failure leaves the change uncommitted.

Verification

  • Backend: 5 passed, including who, old and new on update, create and delete, and an audit failure leaving the change uncommitted. The writer and the database are stubbed, so a real row and its timestamp are not exercised.
  • Frontend: 8 passed, with reka-ui stubbed locally because it is not installed here; CI with the real package is the real check.
  • Not done: vue-tsc, oxlint, a browser. The auto-approve key's reader is in fix(chat): attached files reach the answer, and owners manage their own files (#20195) #20401; a malformed value reads as off on the panel.

Model Used

Claude Sonnet for the implementation, Claude Opus for coordination.

Closes #20465

Summary by CodeRabbit

  • New Features
    • Added an admin-only Chat Approvals settings page, where administrators can configure relaxed approval categories and enable automatic approval for tool calls in chats with attached files.
    • The page displays save status and reports errors if settings cannot be loaded or saved.
    • Changes to these approval settings are now recorded in the audit log, including who made the change and the previous and new values.

@mrveiss mrveiss added this to the M3 - Refined GUI complete milestone Nov 1, 2026
@mrveiss mrveiss added the phase:M3.9 Chat, Agents, Analytics and Settings screens label Nov 1, 2026
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The change adds an admin page to view and update chat approval settings. The backend records audited changes for the two settings, and tests cover the page, category alignment and audit behaviour.

Changes: Chat approval settings

Layer / File(s) Summary
Admin settings page and controls
autobot-slm-frontend/src/views/settings/admin/chatApprovalSettings.ts, autobot-slm-frontend/src/views/settings/admin/ChatApprovalSettings.vue, autobot-slm-frontend/src/router/index.ts, autobot-slm-frontend/src/views/SettingsView.vue, autobot-slm-frontend/src/locales/en.json, autobot-slm-frontend/src/views/settings/admin/ChatApprovalSettings.test.ts, autobot-slm-backend/tests/api/test_chat_approval_categories_in_sync_20465.py, repo_tests/slm_frontend_i18n_parity_test.py, repo_tests/no_tracked_key_material_test.py
The frontend defines parsers and controls for both settings, adds an admin route and navigation entry, and supplies English labels and messages. Tests cover parsing, loading, saving and category alignment. Repository test floors are updated.
Audited setting changes
autobot-slm-backend/api/settings.py, autobot-slm-backend/tests/api/test_chat_approval_settings_audit_20465.py
Create, update and delete operations record audit rows for the two approval settings before commit. Tests cover recorded values, excluded keys and audit failures.

Severity of issue fixed: Medium

Merge Risk: Moderate · previous review b1781

Regenerate the locale bundles and prevent incomplete or failed settings reads from becoming saved defaults before merging. The panel also needs accurate help and saved-state feedback, localized labels, and stronger verification of durable audit records.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Linked Issues check Warning Issue [#20465] requires an admin-only panel with i18n keys, both settings, the stated attachment-file risk, and a durable audit record for each change. The route uses admin: true; the panel loads an… Add an integration test that uses the real audit persistence path and database transaction. Change each audited setting and assert a durable row with the actor, timestamp, old value, and new value. Keep the existing failure-before-commit te…
Docstring Coverage Warning Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarises the main changes: an admin page for chat approval settings and audit records. It is specific and related to the changeset.
Out of Scope Changes check Passed The changed files support Issue [#20465]. The panel, route, settings tab, i18n keys, API audit handling, category synchronisation test, component tests, audit tests, and related repository guard thres…
Full details: Out of Scope Changes check

Explanation

The changed files support Issue [#20465]. The panel, route, settings tab, i18n keys, API audit handling, category synchronisation test, component tests, audit tests, and related repository guard thresholds implement or verify the requested settings and audit behaviour. No unrelated functional change is evident.

Full details: Linked Issues check

Explanation

Issue [#20465] requires an admin-only panel with i18n keys, both settings, the stated attachment-file risk, and a durable audit record for each change. The route uses admin: true; the panel loads and saves both keys; the risk alert and English keys are present. api/settings.py audits update, create, and delete operations with actor and old/new values before commit. However, the reported audit tests stub the audit writer and database. They do not verify a persisted audit row or its timestamp. The durable-record requirement is therefore not fully tested.

Resolution

Add an integration test that uses the real audit persistence path and database transaction. Change each audited setting and assert a durable row with the actor, timestamp, old value, and new value. Keep the existing failure-before-commit test.

Full details: Docstring Coverage

Explanation

Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 11 functions across 8 files. (3 skipped: 3 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 64943e3 and b1781ae.

Files selected for processing: 11

  • autobot-slm-backend/api/settings.py
  • autobot-slm-backend/tests/api/test_chat_approval_categories_in_sync_20465.py
  • autobot-slm-backend/tests/api/test_chat_approval_settings_audit_20465.py
  • autobot-slm-frontend/src/locales/en.json
  • autobot-slm-frontend/src/router/index.ts
  • autobot-slm-frontend/src/views/SettingsView.vue
  • autobot-slm-frontend/src/views/settings/admin/ChatApprovalSettings.test.ts
  • autobot-slm-frontend/src/views/settings/admin/ChatApprovalSettings.vue
  • autobot-slm-frontend/src/views/settings/admin/chatApprovalSettings.ts
  • repo_tests/no_tracked_key_material_test.py
  • repo_tests/slm_frontend_i18n_parity_test.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Notice: 29 open PRs — past the runaway threshold (25)

This is not a request to defer this PR. There is no cap on open PRs (#19397) -- nothing blocks opening or pushing a PR.

This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. Approved PRs land through the merge train the coordinator sequences (merge commits, never squash) -- check the open chore(merge-train) PR is moving, not each PR on its own
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Note

Follow-up findings are listed below so you can review them separately from inline comments.

Follow-ups (2)
Major (1)
Major · Test the committed audit row and its timestamp. · test_chat_approval_settings_audit_20465.py:115-119

autobot-slm-backend/tests/api/test_chat_approval_settings_audit_20465.py:115-119
Major · Data Integrity & Integration · Heavy lift

Test the committed audit row and its timestamp.

The settings tests replace create_audit_log with a collector that records arguments only. No test checks that a settings change commits an SlmNodeAuditLog row, or that its timestamp is set. A regression that removes db.add, the flush, or the timestamp default would still pass. The issue requires a durable audit record with a test, so this gap affects that requirement.

Add a test that runs a settings change through the real create_audit_log writer against a database session. Then assert the stored row and its timestamp.

Minor (1)
Minor · Translate the browser title for this route, or keep the English title by project… · index.ts:326

autobot-slm-frontend/src/router/index.ts:326
Minor · Functional Correctness · Poor tradeoff

Translate the browser title for this route, or keep the English title by project decision.

The router sets document.title from to.meta.title without calling t(). The new Chat Approvals literal therefore appears in English for every locale. The same is true for the existing route titles, so this change adds one more instance of an established pattern. Decide whether route titles are in scope for localization. If they are, add a title key and translate it in the afterEach hook for all routes.

As per path instructions: "Flag a user-facing string that is not routed through i18n."

Source: Path instructions

Nitpick comments: 1
autobot-slm-backend/tests/api/test_chat_approval_settings_audit_20465.py: 1

183-188: Trivial · Maintainability & Code Quality · Quick win

Assert the actor on the create and delete audit rows.

The create and delete test checks the audit actions, old_value and new_value. It does not check username or user_id. The update test checks both fields. A later change that drops or alters the actor at the create or delete call site would still pass this test.

🧪 Suggested test assertion
     assert [r["action"] for r in audit_rows] == ["setting.create", "setting.delete"]
+    assert [(r["username"], r["user_id"]) for r in audit_rows] == [("alice", "alice"), ("alice", "alice")]
     assert audit_rows[0]["extra_data"]["old_value"] is None

The current code records the actor correctly for these operations. The assertion adds coverage for the audit requirement that applies to each setting change. It does not fix a live defect.


Review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 64943e3 and b1781ae.

Files selected for processing: 11
  • autobot-slm-backend/api/settings.py
  • autobot-slm-backend/tests/api/test_chat_approval_categories_in_sync_20465.py
  • autobot-slm-backend/tests/api/test_chat_approval_settings_audit_20465.py
  • autobot-slm-frontend/src/locales/en.json
  • autobot-slm-frontend/src/router/index.ts
  • autobot-slm-frontend/src/views/SettingsView.vue
  • autobot-slm-frontend/src/views/settings/admin/ChatApprovalSettings.test.ts
  • autobot-slm-frontend/src/views/settings/admin/ChatApprovalSettings.vue
  • autobot-slm-frontend/src/views/settings/admin/chatApprovalSettings.ts
  • repo_tests/no_tracked_key_material_test.py
  • repo_tests/slm_frontend_i18n_parity_test.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Auto-sync: merging main into issue-20465-chat-approval-settings conflicts

The sync aborted the merge and pushed nothing. Conflicts are information, so it never resolves one itself. Below, for each conflicted file, are the commits that touched it on each side since the merge base 25ab945e81. Merge main in yourself and push; the label clears on the first run that finds this branch 0 behind.

repo_tests/autobot_has_no_pro_edition_19982_test.py

side commit subject issue refs
main 2c5b5b73f fix(train): reach floors return to mid-window on the merged tree (#20452) #20452
this branch baa91d4ce fix(frontend): re-pin the reach floors this branch moved (#20465) #20465

repo_tests/slm_frontend_i18n_parity_test.py

side commit subject issue refs
main ff713a4e3 fix(frontend): re-pin the reach floors this branch moved (#18278) #18278
this branch 5671bd5d0 fix(frontend): re-pin the reach floors this branch moved (#20465) #20465

@mrveiss

mrveiss commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20536 (head b1781ae): changes needed.

Read only. The audit is sound: it's flushed in the same transaction, for the two keys. Needed: conflicts with main; six CodeRabbit threads open, including en.json:3035 (Major, locale bundles) and the Saved banner; and autoApproveHelp warns that calls run without asking, while nothing on main reads chat.auto_approve_attachment_turns until #20401 lands. Land after #20401.

@mrveiss

mrveiss commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Review threads answered, fixes in the next head:

  1. Locales: fixed. SLM bundles regenerated with lift_locale_translations.py; check-locale-completeness.py passes.
  2. Help text ahead of its reader: not changing. The reader of chat.auto_approve_attachment_turns lands in fix(chat): attached files reach the answer, and owners manage their own files (#20195) #20401, which merges before this PR.
  3. Controls before load: fixed. Switches and Save stay disabled until both settings load, and stay disabled if a load fails.
  4. Failed GET read as absent: fixed in getSetting, which returns null only on 404 and throws otherwise. The Disposal and Findings panels now show an error rather than defaults; read, not tested.
  5. "Saved" not cleared: fixed for both switch types.
  6. Category names: fixed through settings.chatApprovalSettings.categories.*; stored identifiers unchanged.

The new vitest suites could not run here because reka-ui is not installed, so CI is the first run of them. slm_frontend_i18n_parity_test.py: 35 passed.

@mrveiss

mrveiss commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20536 (head baa91d4): approve, to land after #20401, whose reader makes the setting take effect.

Read only; not rendered. The threads are answered and the audit is unchanged. The new vitest suites run for the first time in CI.

@mrveiss

mrveiss commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Correction to my approval above: the code fixes check out, read at this head, but the six review threads still end on the bot's comment with no reply and are unresolved. Each needs its answer in its thread before this boards.

@mrveiss

mrveiss commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20536 (head 840d520): approve, landing after #20401.

Since the last approved head: a clean merge of main, threads resolved.

@github-actions github-actions Bot removed the sync-conflict Set by the branch sync (#19548) label Nov 2, 2026
@mrveiss

mrveiss commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Code review (code-reviewer pass) at 322b9a9

Verdict: APPROVE

Checked: the audit row is added with db.flush() inside the request transaction before commit(), so the change and its audit record land or roll back together (test pins the order and the fail-closed case); the audited key set is limited to the two chat-approval keys and other keys are tested as not audited; write routes keep ADMIN_CONFIG_WRITE; the panel route is admin-gated; all strings go through i18n keys (en plus ten locales); the panel disables its controls until both stored values were read, and getSetting now throws on non-404 so a failed read can no longer be saved over. The two other useSlmJsonSetting callers (disposal and findings panels) already catch a load error.

Severity File:line Issue Fix
low (non-blocking) autobot-slm-frontend/src/views/settings/admin/ChatApprovalSettings.vue (load/persist catch) On a failed load or save the alert shows the raw e.message (for example HTTP 503) rather than the translated failedToLoad / failedToSave text. Show the i18n string and log the message.
low (non-blocking) autobot-slm-frontend/src/views/settings/admin/ChatApprovalSettings.vue (save descriptions) The setting descriptions written on save are hardcoded English. They are stored data, not UI, so this is minor. Optional.
low (non-blocking) autobot-slm-backend/api/settings.py (AUDITED_SETTING_KEYS) The audit key set is a second list of the two keys that approval_baseline.py and the panel also name. A third place to update when a chat-approval setting is added. Consider importing the key constants from one shared module when one exists.

No blocking findings.

@mrveiss

mrveiss commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Train T82 (#20897) carries two train-side fix commits touching this work. efa0c60 moves T82 passengers, including the chat approval settings from #20465, onto the shared comment syntax and design tokens so the one-comment-stripper and raw-palette ratchets pass. 7ed68b0 re-measures the unconnected-code baseline (#20512) on the merged tree; the approval_gates routes this PR wires in are removed from it as now connected. Nothing needed from the author.

@mrveiss

mrveiss commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Landed on main via merge train #20897 (merge 19e62c8): commit 322b9a9 taken by the train is in main and the three-dot diff of this PR's head against main is empty. Closing.

@mrveiss mrveiss closed this Nov 6, 2026
timothybrush pushed a commit to timothybrush/AutoBot-AI that referenced this pull request Nov 6, 2026
@mrveiss
mrveiss deleted the issue-20465-chat-approval-settings branch November 8, 2026 10:29
@mrveiss

mrveiss commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Branch deleted after verification: every commit is in main and the branch shows 0 changed files against main. Restore it from this PR if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

phase:M3.9 Chat, Agents, Analytics and Settings screens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(slm): admin page for the chat approval settings, with an audit record

1 participant