自動化が止まっても毎日デプロイを止めない――失敗・権限切れ・仕様変更から人の手順へ戻す方法 #AI - Qiita
@boraemon2000

Keep Daily Deployments Going Even When Automation Stops—How to Return to a Manual Process After Failures, Expired Permissions, and Specification Changes

  • AI
  • GitHub
  • Deploy Now
  • Automation
  • Project Management
0
Posted at 2026-11-10
TAG40@@

Keep Daily Deployments Going Even When Automation Stops—How to Return to a Manual Process After Failures, Expired Permissions, and Specification Changes

自動化の異常を検知して安全に人の手順へ戻す

In the previous article, we classified the work that remains each day into three options: “delegate it to AI or a system,” “have a person continue it,” and “stop doing it.”

Automating small aggregation and verification tasks lightens the burden of deploying every day. However, automation is not equipment that will run forever once it has been built.

  • Credentials expire
  • The input file format changes
  • The screen or API specifications change
  • The network is temporarily unavailable
  • Items that require AI cannot be extracted
  • The automated process succeeds, but the result is incorrect
  • The person responsible changes, leaving no one who can fix it

What matters is not that automation must never be stopped.

It is to quickly detect anomalies, stop automated processing, and safely return to a procedure that people can understand.

This article organizes automation into five stages—“Detection,” “Stopping,” “Switchover,” “Recovery,” and “Resumption”—so that even non-engineers can work with it. It also establishes operating practices for daily deployments using AI, GitHub, and Deploy Now so that you do not lose your judgment when anomalies occur.

Automation needs both a “standard procedure” and a “fallback procedure”

When looking only at normal operation, automation appears as follows.

Collect input → Have AI organize it → Produce the verification results → Have a person approve → Publish

Actual operations require a different route.

Detect the anomaly → Stop automated processing → Check the scope of impact → Switch to the manual procedure → Fix the cause → Retest on a small scale

Without this route, the moment automation stops, you will not even know what the work involves.

Before introducing automation, document the following two things:

  1. The procedure used before automation
  2. The minimal procedure for when automation cannot be used

The minimal procedure does not need to reproduce all the work that was done previously.Limit the scope to only the work needed to make safe publishing decisions that day.

Classify anomalies into four types

自動化の異常を実行失敗・権限切れ・仕様変更・結果異常の4種類へ分ける

“It didn’t work” alone is not enough to determine the next action. Classify anomalies into four types.

Type Examples Initial response
Execution failure Connection failure, timeout, interruption midway Check the status without rerunning
Expired permissions Authentication expiration, access denied Check the scope and validity period of the permissions
Specification change Changes to field names, storage locations, or response format Check differences between the input and output
Abnormal result A success message is displayed, but the count or content is abnormal Cross-check against the source data

Execution failure

The processing itself does not complete.

Unable to connect Time limit exceeded No response midway through Required file cannot be found

If you rerun it immediately, it may result in duplicate registration or duplicate publishing. First check “how far the execution had progressed.”

Expired permissions

A state in which locations that were readable until yesterday can no longer be read or written to.

Authentication has expired Permission for the target repository was revoked Ownership changed due to a change in the person responsible It has been reduced to read-only permission

Do not immediately restore broad permissions just because you see a permissions error. Check the required targets and operations, and restore only the minimum scope.

Specification change

Even if the processing runs, the form of the input or output no longer matches.

The name of an input field changed The save folder was moved A required field was added The response order changed The position of the control on the screen changed

Specification changes are anomalies that are difficult to detect unless previous assumptions are compared with the current state.

Abnormal result

The state that warrants the most attention is when “success” is displayed but the result is incorrect.

There should be five items, but there are only four Yesterday’s results are mixed in Files outside the target scope are being modified It appears confirmed, but the actual public URL is outdated Important unverified items have disappeared from the AI summary

Verify the item count, update timestamp, target scope, and expected content, rather than just checking the exit code or success indicator.

Look at “whether it finished correctly,” not “whether it ran”

Three types of evidence are used to detect anomalies.

1. Evidence of execution

Check whether processing started and ended.

Start time End time Success or failure Targets processed Error details

2. Evidence of results

Check whether the expected deliverables exist.

Files created Number of items processed Last update time Public URL Scope of changes

3. Semantic evidence

A person checks whether the results meet the objective.

All required fields are present No out-of-scope items have been modified No unchecked items are hidden Users can operate it normally A rollback point is recorded

It is important to distinguish between “successful execution” and “successful operation.”

Define stop conditions first

To operate automation safely, write the stop conditions before the success conditions.

Stop if there are zero input items Stop if there is any difference from the expected item count, even if only one Stop if even one out-of-scope file is detected Stop if an authentication or authorization error occurs Stop if the same process has already been run Stop if a rollback point cannot be obtained Do not publish without human approval

Stopping is not a failure. It is normal behavior that prevents progress when there is insufficient information to make a judgment.

Operations eligible for automatic re-execution

  • Temporary read failure
  • Retrieval operations that do not modify the source data
  • Verification operations that do not add results even when repeated

Operations that should avoid automatic re-execution

  • Publishing
  • Sending
  • Deletion
  • Overwriting
  • Billing
  • Registration with an external service
  • Recovery operations

For the latter, resume only after a person has checked the current state.

Decisions to switch to a manual procedure

異常検知から停止・影響確認・人の手順への切り替えを行う

When an anomaly occurs, there is no need to stop daily work until the repair is complete. Switch to a safe, minimal procedure.

Return to the manual procedure if any of the following applies.

  • The cause cannot be explained within 10 minutes
  • It is unclear how far the automated process has progressed
  • The number of results does not match expectations
  • Processing cannot continue unless permissions are expanded
  • It affects production, deletion, overwriting, and external publishing
  • The same anomaly occurred twice in succession
  • The source data and results cannot be cross-checked

To prevent the switching decision from relying on the “operator’s intuition,” it will be pinned to the control panel.

Create a manual fallback card

There is no time to search for a lengthy procedure manual when an anomaly occurs. Prepare a card that can be read on a single screen or page.

# Manual Fallback: Daily Deployment ## Trigger Conditions - Automated validation fails - Count mismatch - Permission error - Out-of-scope changes are detected ## Stop These First - Automated publishing - Automated writing - Automated rerunning ## Current Status - Last known good point: - Changes this time: - Scope completed: - Scope not yet executed: ## Minimum Manual Procedure 1. Check the changed files on GitHub 2. Check the main screens in the preview 3. Record any unverified items 4. Record the commit to roll back to 5. Publish after Human Approval 6. Verify normal operation once using the public URL ## Prohibited - Do not rerun while the cause is unknown - Do not expand permissions in bulk - Do not overwrite the source data - Do not delete unverified items

The card should state not only “what to do,” but also “what not to do.”

Freeze the State When Switching

When switching from automatic to manual mode, record the state first.

Time the anomaly was detected Last time it was normal Processes executed Targets changed Targets not yet changed Error displayed Whether a rerun occurred Person making the decision

If possible, also retain logs and screen records. However, if they contain credentials, secrets, or personal information, do not share them as-is.

Beginning an investigation without freezing the state may allow further operations to alter the evidence, making it impossible to determine the cause.

Procedure for Recovering from Expired Permissions

For permission errors, check in the following order.

  1. Which operation was denied?
  2. Whether it involved reading, writing, or publishing
  3. Which repository, folder, or service was the target?
  4. What was the previous authorized scope?
  5. Was it due to expiration, a configuration change, or a change of owner?
  6. Can it be reconnected with least privilege?
  7. Does the read-only test succeed?

Make the first test read-only, such as retrieving a list.

Connection verification → Read the target list → Confirm that the expected record is visible → Perform a verification that does not involve writing → If necessary, perform a limited write test

Do not attempt to publish to production immediately after restoring permissions.

Criteria for identifying specification changes

Specification changes are easier to find by adding a “shape check” to the routine checklist.

Items to check Criteria for saving
Input Required field names, item count, and format
Output File name, save destination, and column names
Screen Main operations and expected results
Permissions Read and write targets
AI output Required headings, sources, and unverified indicator

You do not need to compare everything every time. Perform a quick check before processing.

Whether all required fields are present Whether the save destination exists Whether the target item count is not zero Whether the expected heading is present Whether permissions are limited to the required scope

If any prerequisite is no longer valid, stop without beginning processing.

Anomaly detection when using AI

AI output may vary in wording even for the same input. Therefore, check the required conditions rather than performing an exact full-text match.

All five required headings are present Each assessment references the source record Unknown items are labeled “Unknown” Publication, deletion, and recovery are not determined automatically Information not present in the record is not filled in

When instructing the AI, also specify how it should behave in the event of an anomaly.

If required input fields are missing, stop without filling them in by guesswork. List the names of the missing fields. Label any content that cannot be matched to a source record as “No source.” Do not perform publishing, deletion, overwriting, permission changes, or recovery; separate them as items requiring human judgment.

We prioritize making the state of uncertainty visible over producing plausible-looking results.

Do not immediately return to automated operations even after recovery

自動化を修正後に読み取り試験・1件試験・並行運用・承認を経て再開する

Even after fixing the cause, do not immediately return to normal operations. Pass through four gates.

Gate 1: Read test

Confirm whether the inputs can be obtained correctly without changing the targets.

Gate 2: Test with only one item

Check the output using one test item or one item with minimal impact.

Gate 3: Parallel operation with the manual procedure

Compare the automated results with the manual results.

Number of items Targets Content Processing time Unconfirmed items

Gate 4: Restart approval

A human verifies the cause, the changes made, the test results, the stop conditions, and the method for returning.

Return to standard operations after passing all four gates.

Separate what to monitor daily, weekly, and monthly

Daily

  • Last execution time
  • Success / Stopped / Failure
  • Number of targets
  • Difference from the expected count
  • Human verification results
  • Whether there was a manual switchover

Weekly

  • Recurrence of the same anomaly
  • Number of manual switchovers
  • Time required for recovery
  • False positives and false negatives
  • Missing stop conditions

Monthly

  • Permissions and connection destinations
  • Person in charge and contact information
  • Manual fallback card
  • How to record the last known-good point
  • Value of maintaining automation

Even when there are no anomalies, review the manual procedures monthly. This is because procedures that are not used tend to become outdated.

Do not use incident records to assign blame

The purpose of the record is not to identify who made the mistake, but to ensure that we can stop safely next time.

# Automation incident record - Date of occurrence: - Detection method: - Type: execution failure / expired access rights / specification change / abnormal result- Scope of impact: - Was automatic shutdown successful?: - Time switched to manual mode: - Cause: - Temporary measures: - Permanent measures: - Restart test: - Stop conditions to add next time:

Even if the cause was human action, we examine “which checks or stop conditions could have prevented it.”

Common failures

Not monitoring until an error appears

Even if a success message is displayed, the result may be incorrect. Check the number of items, timestamps, and target scope.

Rerunning immediately

The data may have been written partway through. Check the current progress before deciding.

Restoring broad permissions

If permissions are granted in bulk without investigating the cause, even unnecessary targets may end up being modified.

Returning to production immediately after the fix

Resume in the following order: read-only, single-item processing, concurrent operation, and approval.

Discarding the manual procedure

While the automation is functioning normally, update the manual fallback card.

Treating the automation stopping as a failure

Stopping when in a dangerous state is the correct safety behavior.

The first 7 days

Day 1

Choose one automated task and write down its inputs, outputs, and targets affected by changes.

Day 2

Write one example each of an execution failure, permission expiration, specification change, and abnormal result.

Day 3

Decide on three stop conditions.

Day 4

Summarize the minimum manual procedure on a card.

Day 5

Practice switching to manual mode without publishing or writing anything.

Day 6

Check the four gates for recovery after an incident.

Day 7

Place the status, stop conditions, manual card, and restart approval on the operations dashboard.

Summary

When incorporating automation into standard operations, ease of recovery during abnormal conditions is just as important as speed under normal conditions.

The key points are as follows.

  1. Leave the pre-automation procedure and the minimum steps for handling anomalies
  2. Classify anomalies as execution failures, permission expirations, specification changes, and abnormal results
  3. Review three types of evidence: execution, results, and meaning
  4. Write the stopping conditions before the success conditions
  5. If the cause cannot be explained, switch to the manual procedure
  6. Secure the current state before switching
  7. Restore permissions beginning with the minimum scope
  8. After recovery, resume through read-only access, a single item, parallel operation, and approval
  9. Update the manual fallback card regularly
  10. Treat stopping safely as normal operation

The first step is to select one task being automated and write in three lines, “At what state should it stop?”

Next, we will organize a method for compiling a daily deployment system that includes automation and manual fallback into handover documentation that can be continued even when the person in charge changes.