Why AI automated execution needs approval and rollback, and how to design for it
公開日 2026-08-13 · 更新日 2026-08-13 · 最終検証日 2026-08-13
結論
The reason approval and rollback matter isn't that the AI makes mistakes — it's that production state can change without anyone noticing, which is the biggest failure mode. The design should include nine elements: a pre-change snapshot, an approval gate, separation between dry-run and actual execution, a target allowlist, idempotency, a rollback procedure that exists before execution, audit logs, staged rollout, and a kill switch. The rule for drawing the line is simple: don't automate what you can't roll back.
この文書の適用条件
| 対象製品 | AI operations workflows in general (not tied to any specific orchestrator product) |
|---|---|
| 確認バージョン | A design-level explanation independent of product version (the snapshot example assumes SQL Server 2012 or later) |
| 適用環境 | AWS, Azure, on-premises |
| 必要権限 | Snapshot capture requires connection access to the target instance. Workflow definitions require edit access |
| 実行影響 | Read-only (the commands in this article do not change state) |
| 再起動 | Not required |
| 最終検証日 | 2026-08-13 |
そのまま実行できるコマンド
- 対象
- Your organization's ops automation workflow definitions
- 権限
- Edit access to the workflow definition
- 変更作業
- None (this is a sample definition)
- Production実行
- Not applicable (design sample)
# 対象: 自組織の運用自動化ワークフロー定義
# 権限: ワークフロー定義の編集権限
# 変更作業: なし(定義の記述例)
# Production 実行: 該当なし(設計サンプル)
workflow: sample-log-maintenance
# 実行対象を明示的に限定する。ここに書かれていないホスト・DBには一切触れない
scope:
allowlist_hosts: [LEGACY-SQL01]
allowlist_databases: [SampleDB]
deny_if_role: [primary-replica-source]
# 実行前に必ず状態を保存する。保存に失敗したら以降のステップへ進まない
pre_snapshot:
- id: capture-config
command: dump-configuration
required: true # 失敗時は abort(スキップ不可)
retention: 30d
steps:
- id: check-log-usage
kind: read
dry_run: false # 参照のみなので dry-run の概念が無い
requires_approval: false
idempotent: true
rollback: not-required # 状態を変えないため
- id: apply-parameter-change
kind: write
dry_run: true # まず差分だけを出力して人が読む
requires_approval: true # dry-run の出力を見た人が承認して初めて本実行
approvers: [ops-oncall, dba-lead]
approval_expires_in: 2h # 古い承認で実行されないように失効させる
idempotent: true # 同じ入力で2回流しても結果が変わらない
rollback:
exists: true # 存在しない場合、この step は定義エラーとして拒否する
command: restore-configuration --from capture-config
verified_at: 2026-08-13
- id: never-auto
kind: write
requires_approval: true
auto_execute: forbidden # 承認があっても自動実行経路からは呼ばない
# 段階的展開: 1台 → 一部 → 全体。各段で停止条件を評価する
rollout:
stages: [canary(1), partial(25%), full]
halt_on: [error_rate_increase, unexpected_diff, snapshot_missing]
# 停止スイッチ: これを立てると進行中の実行も次のステップに進まない
kill_switch:
flag: /etc/ai-ops/HALT
honored_between_steps: true
# 状態記録: 各ステップの結果を永続化し、再開時に完了済みを再適用しない
state_store:
key: run_id + step_id
values: [pending, running, succeeded, failed, rolled_back, skipped]
resume_policy: skip-succeededThree points matter in this definition. First, a step where rollback.exists is false should be rejected at the definition stage. Second, approvals should expire, so a stale approval can't be used to execute after circumstances have changed. Third, state_store ensures a resume or retry doesn't double-apply a change that already succeeded.
- 対象
- SQL Server 2012 or later / Amazon RDS for SQL Server
- 権限
- Connection access to the target instance (sys.configurations is readable by default)
- 変更作業
- None (read-only)
- Production実行
- Allowed
-- 対象: SQL Server 2012 以降 / Amazon RDS for SQL Server
-- 権限: 対象インスタンスへの接続権限(sys.configurations は既定で参照可能)
-- 変更作業: なし(参照のみ)
-- Production 実行: 可能
SELECT
SERVERPROPERTY('MachineName') AS machine_name,
SYSDATETIMEOFFSET() AS captured_at,
c.configuration_id,
c.name,
c.value, -- 設定された値
c.value_in_use, -- 実際に効いている値
c.is_dynamic, -- 再起動なしで反映されるか
c.is_advanced
FROM sys.configurations AS c
ORDER BY c.name;If value and value_in_use differ, the setting has been changed but is pending a restart. Save both in the snapshot — with only one, you can't tell which value to roll back to.
- 対象
- Your ops host (anywhere with connectivity to the target DB)
- 権限
- Connection access to the target DB and write access to the output directory
- 変更作業
- None (does not change DB state; only writes files)
- Production実行
- Allowed
# 対象: 自組織の運用ホスト(対象DBへ接続できる場所)
# 権限: 対象DBへの接続権限と、保存先ディレクトリへの書き込み権限
# 変更作業: なし(DBの状態は変更しない。ファイルのみ出力)
# Production 実行: 可能
SNAP_DIR=/var/lib/ai-ops/snapshots
RUN_ID=sample-run-0001
mkdir -p "$SNAP_DIR/$RUN_ID"
# 1) 変更前の構成を保存する(保存に失敗したら以降へ進まない)
sqlcmd -S LEGACY-SQL01 -U sample_user -d SampleDB -i capture_configuration.sql -o "$SNAP_DIR/$RUN_ID/before.txt" || exit 1
# 2) 変更を適用する(承認済みの場合のみ。ここでは実行しない)
echo "apply step は承認後に別経路で実行する"
# 3) 変更後に同じクエリを流し、差分を人が読める形で残す
sqlcmd -S LEGACY-SQL01 -U sample_user -d SampleDB -i capture_configuration.sql -o "$SNAP_DIR/$RUN_ID/after.txt"
diff -u "$SNAP_DIR/$RUN_ID/before.txt" "$SNAP_DIR/$RUN_ID/after.txt" > "$SNAP_DIR/$RUN_ID/diff.txt"
# 4) 差分が空でないこと(=意図した変更が入ったこと)と、想定外の行が無いことを確認する
cat "$SNAP_DIR/$RUN_ID/diff.txt"Never put passwords directly on the command line. Pass credentials via environment variables or a secret store. Store snapshots somewhere still readable even if the target system goes down.
結果の読み方
| 列 | 意味 | 確認するポイント |
|---|---|---|
| Pre-change snapshot | Saving the state before a change is applied | Does execution abort if the save fails? Is the storage location readable even if the target is down? |
| Approval gate | A definition of who approves what, under what conditions | Is the approver a different person from the executor? Does the approval expire? |
| Dry-run / apply separation | Separating a run that only outputs a diff from a run that actually applies it | Is the dry-run output a human-readable diff? |
| Target scope restriction | An explicit allowlist of target hosts/databases | Does execution refuse targets not on the allowlist, even if instructed? |
| Idempotency | Running with the same input multiple times produces the same result | Does a retry or resume avoid double-applying? |
| Rollback procedure exists beforehand | The way back is decided before execution | Are steps with no rollback defined rejected at the definition stage? |
| Audit log | A record of who executed it, when, with what input/output, and who approved it | Are all five fields present? Is it stored where it can't be altered after the fact? |
| Staged rollout | Expanding from one host → a subset → everything | Is a halt condition evaluated at each stage? Does it stop automatically on anomaly? |
| Kill switch | A means to stop an in-progress automated run | Who can trigger it? Has it been confirmed that, once triggered, the run doesn't advance to the next step? |
| State tracking (sequential execution) | Persisting the state of each step | Is it designed so a resume doesn't re-run steps that already succeeded? |
こういう状況で使います
- An automated process was supposed to be running, but no one can tell since when it stopped
- A production setting changed at some point, and no one can identify who changed it
- Retrying the same automated run caused the change to be applied twice
- You want to stop an automated run, but the only way is to kill the process
- Automated-run logs exist, but the approver and input values aren't recorded
- There's still a path where the real run executes without anyone looking at the dry-run output first
考えられる原因(可能性の高い順)
01
Detection and execution are wired into the same path
When an agent that detects an anomaly also executes the response itself, a detection error turns directly into a state change. Inserting approval between detection and execution keeps a false positive from changing state.
02
The execution target is resolved dynamically from instructions
Resolving a target host or database name from natural-language instructions can match an unintended target. Fixing the target statically via an allowlist closes this path.
03
Retries aren't idempotent
A retry after a timeout, or a resume after a partial failure, can reapply a change that already succeeded. Without per-step state tracking, there's no way to tell how far execution got.
04
Rollback is treated as something to 'figure out later'
An operation with no way back at execution time loses its options the moment it fails. Making the existence of a rollback procedure a precondition for execution structurally prevents this.
05
The application log is used as a substitute for an audit log
Application logs record what ran, but not who approved it or when. Without being able to reconstruct 'whose decision was this' after the fact, root-cause analysis becomes guesswork.
確認手順
- 1
List all automated runs
参照のみEnumerate the automated processes currently running and classify each as state-changing or read-only. Anything that can't be classified should be demoted to read-only for now.
- 2
Check whether each automated run has a rollback procedure
参照のみFor anything that changes state, check whether a way back is documented and whether it has ever actually been tried.
- 3
Check that all five audit-log fields are present
参照のみPick one recent automated run and try to reconstruct the executor, execution time, input, output, and approver.
- 4
Verify the kill switch in a test environment
中Raise the halt flag and confirm an in-progress run doesn't proceed to the next step. Do not do this in production.
- 5
Verify double-application on retry in a test environment
中Deliberately fail partway through, then resume, and confirm steps that already succeeded are not re-run.
対応方法
すぐに実施できる低リスクの対応
Temporarily demote state-changing automated runs to read-only
低Until the design is in place, automate only detection and proposal, and have a human execute. This lowers risk without stopping operation.
Define a target allowlist
低Enumerate the target hosts and databases and ensure nothing outside that list is ever executed against. This is the measure with the fastest payoff.
Provide a kill switch
低Allow automated execution to be stopped via a flag file or config value, and name who can trigger it.
事前検討が必要な変更
Separate dry-run from actual execution into distinct steps
中Dry-run only outputs a diff; actual execution acts only on an approved diff.
Implement an approval gate with expiring approvals
中Define the approver, the approval target, and an expiration. Without expiration, a stale approval could be used to execute after circumstances have changed.
Add per-step state tracking
中Persist each step's state and skip steps that already succeeded on resume. This is the minimum setup to survive a mid-sequence failure.
Write audit logs to a location that can't be altered
中Record executor, time, input, output, and approver in storage the executing agent itself cannot rewrite.
Introduce staged rollout
中Try on one host first, and widen scope only if halt conditions aren't triggered. The goal is to make simultaneous full rollout not the default.
専門家のレビューが必要な作業
Exclude non-rollback-able operations from the automated-execution path
専門家レビュー必須Define the operation classes listed below as out of scope for automated execution. Drawing this line incorrectly lets an irreversible operation run without approval, so this needs a design review before implementation.
Align approval-authority design with organizational accountability
専門家レビュー必須Who can approve is a matter of accountability, not technology. Define approvers for decisions involving service stoppage in agreement with the business side.
!注意事項
- Operations that must never be auto-executed without human approval: data deletion, KILL, SHRINK, forced failover, replication initialization, CDC reconfiguration, full index rebuilds, large-scale statistics updates, parameter changes, schema changes, DB restarts, firewall/permission changes, binlog resets, backup deletion.
- What these have in common is that they're either hard to undo or can drag in and halt other processing while running. Execute only after approval, and only after confirming the pre-change snapshot and rollback procedure.
- Don't make an operation a target for automation if no rollback procedure exists for it. 'Fix it by hand if it fails' is not a procedure.
- Sending an approval-request notification alone doesn't make an approval gate. The implementation must guarantee execution doesn't proceed until approval is actually granted.
- Staged rollout only works paired with halt conditions. Staged rollout without halt conditions just delays when a failure is discovered.
- Periodically check whether dry-run output is being approved without anyone actually reading it. A rubber-stamped approval is no different from having no approval at all.
バージョン・環境による違い
これで解決しない場合に確認すること
Pick one recent automated run and try to reconstruct the 5W1H
Test whether you can reconstruct who ran it, when, what, with what input, and under what approval — using only the logs.
Check that the approver isn't the same person as the executor
A setup where only the same person can approve is an approval gate in name only.
Check who can trigger the kill switch
Confirm whether the on-call person can stop it alone if something goes wrong in the middle of the night.
Check that the snapshot storage doesn't share a fate with the target
Storing it on the same server means the snapshot is lost along with that server if it's lost.
Decide when to review the allowlist
If the allowlist isn't updated as targets are added or removed, it drifts from reality.
この文書の根拠と限界
一般的な技術説明
The line between design elements and operation classes is a general operational design based on reversibility and blast radius. The SQL example is based on SQL Server's public sys.configurations specification. Only the 'GIIP's scope' paragraph describes GIIP's own operating model — it is not a customer case study. Incident-rate or prevention-effectiveness figures are not included because they cannot be verified.
よくある質問
How far can we automate?
Up to operations whose impact is reversible, whose targets are restricted by an allowlist, for which a rollback procedure exists before execution, and which leave an audit log. Anything missing even one of these four conditions should sit behind an approval gate.
Who approves?
Someone other than the executor. In addition, for operations that could involve stopping a service, include a business-side decision-maker as an approver alongside the technical owner — whether to stop something isn't a technical judgment call.
How should operations with no rollback be handled?
Exclude them from automated execution. If one must run, prepare a pre-change snapshot and an estimate of how long recovery (e.g., restoring from backup) would take, then have a human execute it.
If we have dry-run, is approval unnecessary?
No, it's still necessary. Dry-run is just a mechanism for showing a diff; whether it's okay to apply that diff is a separate judgment. Have a human read the dry-run output and approve based on that result.
If a partially-failed automated run is resumed, won't it double-apply?
Not if you persist state per step and skip already-succeeded steps on resume. Making each step idempotent also limits the damage if state tracking itself is ever lost.
What should an audit log record?
Five things: executor, execution time, what was executed, input/output, and approver. Store it somewhere the executing agent itself cannot rewrite.
この文書がカバーする質問
- How should sequential execution and state tracking be designed for AI workflows?
- How do you build an approval flow when delegating production operations to AI?
- I want a list of database operations that must not be automated
リスク表示の意味
- 参照のみデータと設定を変更しません。
- 低影響は限定的ですが、権限と負荷の確認が必要です。
- 中性能・ロック・コストに影響する可能性があります。
- 高障害・データ損失・復旧作業が発生する可能性があります。
- 専門家レビュー必須本番適用前に別途レビューが必須です。
GIIPの対応範囲
Everything above can be implemented without any specific orchestrator product. At GIIP, AI agents and human experts continuously monitor and operate multiple databases and roughly 30 web services across AWS and Azure; AI agents are allowed to execute only operations whose impact is reversible and whose targets are limited, and the operation classes listed above go through human approval. If you're not sure where to draw this line for your own organization, it's also possible to work it out starting from your current list of automated processes.
執筆・技術検証
GIIP プロダクション運用チーム
大規模Webサービス、SQL Server、Oracle、AWS、Azureの設計・移行・運用に約30年従事。x12largeクラスのAWS RDS for SQL Server環境12セット、約12万テーブルのOracle環境、約3TBのTiDBからAurora MySQLへの移行を経験。現在も複数のクラウドデータベースと約30のWebサービスを、AIエージェントと人間の専門家が継続的に監視・運用しています。
What database incidents AI agents can handle, and what humans must decide
We split incident response into phases to separate what AI can own (detection, triage, limited initial response) from what requires human judgment (irreversible actions, shutdown decisions), and provide read-only triage queries.
giipWhat is the difference between a coding agent and GIIP FDE Ops?
Coding agents and operations services differ in their "unit of work." We compare the boundary between the two across nine dimensions, with commands you can run to check your own organization.
ai-operationsWhat it takes to bring an AI-generated application to production
We organize the remaining work between "the code works" and "it can run in production" into 14 items, with commands for detecting hardcoded keys and auditing dependency vulnerabilities.
sql-serverHow to Check and Change MAXDOP and Cost Threshold for Parallelism in SQL Server
A procedure for checking and changing the degree of parallelism at the server, database, and query levels, along with the differences in scope and impact at each level.
関連サービス
Design the approval line for automated execution
同じ確認を複数の環境で継続する必要がある場合は、運用体制ごと相談できます。
Design the approval line for automated execution