Skip to content

GitStateMonitor reports the agent's own changes as human activity #234

@shellicar

Description

@shellicar

Bug

GitStateMonitor.takeDelta() takes a snapshot and diffs against the previous one in a single call. This means the delta includes everything that changed since the last call -- including the agent's own commits, file edits, and tool use from the previous turn.

The agent sees its own work reported back as if the human did it.

Root cause

The API is takeDelta() which combines snapshot + diff into one operation, called once per loop iteration before the query. There is no separate post-query snapshot, so the baseline always includes whatever state existed at the start of the previous query, not at the end of it.

Expected behaviour

Two separate operations:

  1. takeSnapshot() -- called after the agent finishes a query, capturing post-agent state as the baseline
  2. getDelta() -- called before the next query, diffing against that baseline to capture only human activity between turns

This was the original requirement: snapshot before and after the query so the delta isolates human changes.

Introduced in

Commit 259e987 (PR #225, "Coworking mode: git state delta between turns"). Pre-existing, not caused by the SDK refactor.

Impact

Every turn after the first, the system reminder includes a <system-reminder> block describing the agent's own file changes, commits, branch switches, etc. as if they were external human activity. This is misleading context that wastes tokens and could confuse the model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions