You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Agent-driven runs of dev-tools tests still consume too much context from the default PHPUnit output stream. Even small failures can produce long terminal payloads with repeated progress, summary, and diagnostic lines, forcing agents to spend unnecessary context just to understand what failed.
This is especially visible in interactive agent sessions and agent-triggered workflows where the goal is to extract actionable PHPUnit results with minimal noise. The broader structured-output direction is already tracked in #248, but PHPUnit has a package-built path that can improve this problem sooner.
Proposal
Integrate ergebnis/phpunit-agent-reporter into the PHPUnit execution path used by DevTools so agent contexts can consume compact, agent-oriented PHPUnit output instead of the default verbose stream.
The integration should reuse DevTools runtime-environment detection so the reporter is enabled only when appropriate, while preserving the current human-readable PHPUnit behavior for regular CLI and CI usage.
Goals
Reduce context consumption for agent-driven PHPUnit runs.
Preserve the current PHPUnit output contract for maintainers running the command manually.
Keep the tests command deterministic across agent and non-agent execution contexts.
Expected Behavior
When dev-tools tests runs in a detected agent environment, PHPUnit uses ergebnis/phpunit-agent-reporter (or an equivalent supported integration path) so failures, counts, and summaries are emitted in a compact format that is easier for agents to consume.
When the same command runs in a normal terminal or standard CI context, DevTools preserves the current PHPUnit output behavior unless an explicit opt-in mode is introduced.
Implementation Strategy
Evaluate the supported integration path for ergebnis/phpunit-agent-reporter in the currently supported PHPUnit version range.
Isolate the decision of whether agent reporting is enabled behind runtime-environment aware collaborators instead of inlining package-specific checks into the command flow.
Keep TestsCommand focused on orchestration while delegating agent-reporter resolution/configuration to a dedicated collaborator if the logic becomes non-trivial.
Verify compatibility with coverage, cache, bootstrap, filter, progress, and output-mode behavior already supported by the tests command.
Do not expand this issue to Rector, ECS, phpDocumentor, PhpMetrics, or other non-PHPUnit tools.
Do not change human-readable PHPUnit output for normal terminal usage unless that behavior is explicitly guarded and documented.
Benefits
This gives agent-driven PHPUnit runs a smaller and more actionable output surface, reduces wasted context in interactive and automated agent sessions, and delivers a focused improvement without waiting for the full structured-output initiative in #248.
Acceptance Criteria
Functional Criteria
Agent-detected PHPUnit runs use ergebnis/phpunit-agent-reporter or an equivalent supported integration path.
Non-agent PHPUnit runs preserve the current default PHPUnit output behavior.
Coverage, cache, bootstrap, filter, progress, and exit-code behavior remain compatible with the current tests command.
Focused tests cover agent and non-agent execution paths.
Documentation is updated when command behavior or runtime expectations become user-visible.
Architectural / Isolation Criteria
MUST: The core logic MUST be isolated into dedicated classes or services instead of living inside command or controller entrypoints.
MUST: Responsibilities MUST be separated across input resolution, domain logic, processing or transformation, and output rendering when the change is non-trivial.
MUST: The command or controller layer MUST act only as an orchestrator.
MUST: The implementation MUST avoid tight coupling between core behavior and CLI or framework-specific I/O.
MUST: The design MUST allow future extraction or reuse with minimal changes.
MUST: The solution MUST remain extensible without requiring major refactoring for adjacent use cases.
MUST: Argument and option resolution MUST be validated separately from command execution logic.
MUST: Console formatting and rendering MUST stay separate from domain processing.
MUST: Exit behavior, error messaging, and generated output MUST remain deterministic and testable.
Problem
Agent-driven runs of
dev-tools testsstill consume too much context from the default PHPUnit output stream. Even small failures can produce long terminal payloads with repeated progress, summary, and diagnostic lines, forcing agents to spend unnecessary context just to understand what failed.This is especially visible in interactive agent sessions and agent-triggered workflows where the goal is to extract actionable PHPUnit results with minimal noise. The broader structured-output direction is already tracked in #248, but PHPUnit has a package-built path that can improve this problem sooner.
Proposal
Integrate
ergebnis/phpunit-agent-reporterinto the PHPUnit execution path used by DevTools so agent contexts can consume compact, agent-oriented PHPUnit output instead of the default verbose stream.The integration should reuse DevTools runtime-environment detection so the reporter is enabled only when appropriate, while preserving the current human-readable PHPUnit behavior for regular CLI and CI usage.
Goals
testscommand deterministic across agent and non-agent execution contexts.Expected Behavior
When
dev-tools testsruns in a detected agent environment, PHPUnit usesergebnis/phpunit-agent-reporter(or an equivalent supported integration path) so failures, counts, and summaries are emitted in a compact format that is easier for agents to consume.When the same command runs in a normal terminal or standard CI context, DevTools preserves the current PHPUnit output behavior unless an explicit opt-in mode is introduced.
Implementation Strategy
ergebnis/phpunit-agent-reporterin the currently supported PHPUnit version range.TestsCommandfocused on orchestration while delegating agent-reporter resolution/configuration to a dedicated collaborator if the logic becomes non-trivial.testscommand.Requirements
ergebnis/phpunit-agent-reporterthrough a supported path for the active PHPUnit version.testscommand features such as coverage, cache, bootstrap, filter, and exit-code handling MUST remain compatible.testscommand usage and for workflows that execute PHPUnit through DevTools.Non-goals
Benefits
This gives agent-driven PHPUnit runs a smaller and more actionable output surface, reduces wasted context in interactive and automated agent sessions, and delivers a focused improvement without waiting for the full structured-output initiative in #248.
Acceptance Criteria
Functional Criteria
ergebnis/phpunit-agent-reporteror an equivalent supported integration path.testscommand.Architectural / Isolation Criteria