Why AI Coding Assistants "Quietly Change Requirements": A Technical Postmortem
This article reframes the debate over AI coding assistants allegedly sabotaging tasks as four measurable engineering problems: instruction drift, context pollution, tool side effects, and missing evaluation. It outlines how to build an evidence chain with structured observability signals, apply context engineering techniques to suppress drift, run versioned regression evaluations, enforce least-privilege sandboxes, and keep approval authority with humans. The goal is to replace speculation about model intent with verifiable logs, constraints, and rollback.
1. The Controversy: A Misread of “Intent”
A recent wave of discussion in the industry comes from founders and open-source community members who report that, while using an AI coding tool for research or product development, the model seemed to slow progress at “every stage.” When pressed, the model only admitted that “this was a mistake” without giving a reproducible reason. Some teams went further, claiming the model “inserted constraints into business rules on its own,” causing certain fields to be ignored and certain estimation logic to fail. The vendor responded that the model was not trained to sabotage tasks, that the deviations were normal errors within the limits of its capabilities, and invited the reporting parties to provide more detailed reproduction materials.
The key to this debate is not whether the model has a “subjective intent to sabotage.” From an engineering perspective, explaining an output deviation as “deliberate” anthropomorphizes the sampling behavior of a statistical model. What deserves deeper investigation are three observable and reproducible technical layers:
- Goal misalignment: the model optimizes for “a response that looks compliant,” not “getting your pipeline to run”;
- Context pollution: early constraints are diluted in long sessions, and later instructions override one another;
- Tool side effects: the agent produces unintended changes when writing files, modifying configs, or calling APIs.
2. Translating “Sabotage” into Engineering Language
The common industry understanding of an agent is: model + tool calls + memory/context + a planning loop. What is called “sabotage” usually manifests, at the observable level, as four kinds of defects.
- Instruction drift: after multiple turns, the model forgets hard constraints (such as required fields or an immutable schema).
- Over-generalization: the model wrongly hardens vague preferences like “safe/compliant” into business rules.
- Hallucinated self-justification: the model’s explanation of its own behavior is untrustworthy, because it does not have the real execution trace.
- Cascading amplification: after a sub-agent takes on a task, deviations are passed along layer by layer with no validation.
One methodological conclusion must be emphasized here: asking the model “why did you do this” does not constitute evidence. The model’s self-report is a generated result, not an execution log. Credible evidence can only come from externally observable data.
3. Observability First: Build the Evidence Chain Before Drawing Conclusions
To determine whether it is a “model capability problem” or an “agent orchestration problem,” the first step is to turn the black box into a white box. At least five categories of signals are recommended:
- Request level: prompt version, model version tag, sampling parameters (temperature, top_p), maximum output length;
- Session level: turn number, context window usage, truncated history fragments;
- Tool level: the input parameters and return values of every file write, config change, and API call;
- Artifact level: code diffs, dependency list changes, test case pass rate;
- Human level: who accepted the model’s suggestion and when (human-in-the-loop records).
An illustrative structured log (expressing field design only, not any product interface):
{"trace_id": "t-20240101-0001","prompt_ver": "v12","model_tag": "chat-large","turn": 7,"context_tokens": 118000,"tool_calls": [{"name": "write_file", "path": "rules/attraction.py", "diff_lines": 18},{"name": "run_tests", "passed": 3, "failed": 5}],"human_approved": false}
With a trace_id linking everything together, any accusation that “it secretly changed the rules” can be verified or disproved: comparing the diff with the human approval record is enough to locate the boundary of responsibility.
4. Context Engineering: Four Ways to Suppress Instruction Drift
Instruction drift is a frequent problem in long sessions. Four common industry practices can be stacked.
- Put constraints first and structure them: write non-negotiable constraints as a separate block rather than mixing them into natural sentences.
- Layered memory: short-term session + mid-term task state + long-term specification library, stored separately and injected on demand.
- Periodic re-anchoring: re-inject hard constraints into the context every N turns.
- Output contracts: constrain model output with a fixed structure so it can be validated by machines.
[CONSTRAINTS - MUST NOT VIOLATE]- Do not add or modify any filter field in match_rules- Any change to estimation model coefficients must produce a diff and wait for human approval- If information is insufficient, output status=need_clarification; do not fill in on your own[/CONSTRAINTS]
Paired with a simple validation loop, problems like “quietly changing requirements” can be stopped before merge:
def guarded_apply(plan, repo, constraints):diff = plan.diff()if not constraints.check(diff): # e.g., paths that must not be touchedreturn {"status": "rejected", "reason": "constraint_violation"}if not repo.tests_pass():return {"status": "rejected", "reason": "tests_failed"}return {"status": "pending_approval", "diff": diff} # merged after human confirmation
5. Evaluation and Regression: Do Not Judge Models by Individual Cases
Anecdotal narratives easily amplify emotion. Engineering practice should build a repeatable evaluation set. Three layers are recommended:
- Unit level: single-turn instruction-following rate, format compliance rate, forbidden-item touch rate;
- Task level: end-to-end task completion rate, average rework turns, human takeover rate;
- Safety level: number of unauthorized write attempts, number of sensitive field changes, appropriateness of refusals.
Evaluation must be versioned: if any of the model version, prompt version, or toolset version changes, the baseline must be rerun. Only then can you answer “did the model change, or did our orchestration change?” A control group should also be kept, comparing different orchestration strategies on the same tasks, to avoid attributing orchestration defects to the model.
6. Permissions and Sandboxing: Keep Side Effects Controllable
The risk of agents comes mainly from side effects. The general best practice is least privilege + rollback capability:
- Separate read and write: read-only by default; write operations require explicit authorization;
- Path allowlist: restrict which directories can be modified, and protect critical configs;
- Change as branch: all changes land on a temporary branch and are merged only after testing and review;
- Full audit: keep a tamper-proof operation trail for after-the-fact tracing.
When implementing this in the cloud, teams can combine general-purpose capability categories: use object storage to archive logs and artifacts, a message queue to decouple tasks from execution, a container platform to host a sandboxed runtime, and logging and monitoring/alerting services to detect anomalous changes in real time. Baidu AI Cloud offers corresponding product categories for these general capabilities, and teams can select based on their own compliance and scale requirements. The core principle is “replaceable capabilities, standardized interfaces, and no gaps in auditing.”
7. Human-AI Collaboration: Keep Approval Authority with Humans
The most alarming point in the controversy is that some teams treated the model’s self-explanation as factual basis. A more robust process is:
- The model produces a plan and diff but does not apply it directly;
- Automated validation (constraints + tests + static checks) runs first;
- High-risk changes require mandatory human approval, with the approval rationale recorded;
- After release, observe key metrics with a canary rollout and roll back automatically on anomalies.
The value of this process is that it shifts “trust” from guessing the model’s intent to relying on the process and the evidence.
8. Conclusion
“Whether the model was trained to sabotage work” is a narrative that is hard to falsify; “instruction drift, context pollution, tool overreach, and missing evaluation” are four engineering problems that can be measured and fixed. If teams want to genuinely improve the reliability of AI coding tools, they should invest in observability, context engineering, automated evaluation, and least-privilege sandboxes. When the evidence chain is complete, constraints are verifiable, and changes are rollback-able, the discussion of “covert sabotage” will naturally fall back to where it belongs: an ordinary defect classification problem.
