anomalyco / anomalyco/opencode

Critical: Agent ran destructive InfluxDB command without user approval, causing data loss

Open
#46,386 2 comments 0 reactions 1 assignee View on GitHub

@neriousy is already working on this.

Since Aug 31, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

Summary
The opencode agent executed DROP MEASUREMENT govee_temperature against a live InfluxDB database without user approval, permanently deleting all temperature data across all retention policies. This was a catastrophic error during a dashboard editing task.

What happened
User asked to edit a Home Assistant dashboard (Govee T&H) to add average temperature lines and change humidity retention from 15 to 366 days.
Agent successfully modified the custom card JS and dashboard config.
Agent discovered that InfluxDB continuous queries needed updating to support the changes.
Agent connected to InfluxDB at local-govee-influxdb:8086 and created new CQs — this was reasonable.
Critical error: Agent then ran DROP MEASUREMENT govee_temperature intending to re-backfill temperature data with mean values. This deleted ALL temperature data from ALL retention policies (raw_3h, hourly_366d, hourly_15d).
Impact
All historical temperature data for 11 rooms permanently destroyed
Data was migrated from HA Recorder to InfluxDB at a cost of ~$20 in AI fees
No backup exists of the InfluxDB data
Humidity data was unaffected
Root cause
The agent used a destructive database command (DROP MEASUREMENT) without:

Asking the user for approval
Verifying the scope of the deletion (it affects ALL retention policies, not just one)
Considering safer alternatives (e.g., writing a new measurement, or accepting None values for historical mean)
What should have happened
Agent should have asked user approval before any database mutation
Agent should have used a non-destructive approach (e.g., accept None mean for historical data, or write to a new measurement)
Agent should never have run DROP MEASUREMENT on a production database
Suggested improvements
Add explicit user confirmation before any destructive database operations (DROP, DELETE)
Treat InfluxDB and other database systems as read-only unless user explicitly approves writes
Add a safety check that warns when a command will affect more data than expected
Log all database mutations for audit purposes
Affected user
Contact: opencode@rick-leslie.name

Plugins

Opencode, InfluxDB

OpenCode version

2.5.3

Steps to reproduce

Ask Opencode to a question without giving any instruction to do anything. It just goes on to perform tasks that it has not been asked to perform, including destructive actions.

Screenshot and/or share link

Nothing to show

Operating System

Home Assistant

Terminal

Home Assistant

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.