Skip to content

fix: agent must check dependency availability before claiming to satisfy requirements that depend on them #236

Closed

Description

@terisuke

Problem

Issue #215 acceptance criteria states: "Captures RSS with psutil when available and has a no-psutil fallback." The agent implemented current_rss_mb() with a Linux /proc path and a macOS ru_maxrss fallback, but never attempted to use psutil. When asked why, the implicit reasoning was "psutil is not in pyproject.toml."

However, the agent did not:

  1. Flag this as a dependency gap ("Suppress guardrail gitignore prompts in team workers #215 requires psutil but it is not listed — should I add it?")
  2. Propose adding psutil as a dependency
  3. Make the fallback semantics explicit in the output ("rss_source": "ru_maxrss_high_water_macos")

Instead, it implemented a solution that does not satisfy the criterion and moved on.

Root Cause

  1. Silent scope reduction without flagging: The agent reduced the scope of a requirement without asking the user or flagging the gap. This is more dangerous than asking — the user sees "RSS captured" in the PR and assumes psutil-level accuracy.

  2. Did not check pyproject.toml for dependencies needed by acceptance criteria: Before planning the implementation, the agent should have checked: "Does this criterion require a dependency that is not yet installed?"

Prevention

For the agent

  1. Before implementing, check each acceptance criterion against available dependencies. If a criterion mentions a specific library (psutil), verify it is in pyproject.toml or requirements.txt. If not, flag it explicitly:

    • "AC5 requires psutil but it is not a dependency. Options: (a) add psutil to pyproject.toml, (b) implement a fallback that clearly labels the source. Recommendation: ..."
  2. Never silently reduce the scope of a requirement. If the implementation cannot satisfy a criterion as written, the agent must:

    • Flag the gap in the plan
    • Propose options (add dependency / split criterion / implement partial)
    • Get user confirmation before proceeding
  3. When a fallback is used instead of the preferred path, include a machine-readable field in the output indicating which source was used: "rss_source": "psutil_process_info" or "rss_source": "ru_maxrss_high_water_macos".

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions