Skip to content

Make AgentDetector::AGENT_ENV_VARS visible#15

Merged
joetannenbaum merged 1 commit into
laravel:mainfrom
cosmastech:make-agent-env-vars-visible
Apr 28, 2026
Merged

Make AgentDetector::AGENT_ENV_VARS visible#15
joetannenbaum merged 1 commit into
laravel:mainfrom
cosmastech:make-agent-env-vars-visible

Conversation

@cosmastech

@cosmastech cosmastech commented Apr 28, 2026

Copy link
Copy Markdown

Make the mapping of agent env to enum visible. If you feel strongly that this should remain protected, I can add a getter for it.

Why is this helpful? If you look at the test helper function in pao https://github.com/laravel/pao/blob/1.x/tests/Pest.php#L7-L13, if I tell an agent other than Claude Code to run the test suite, it will forward those environment variables to the test runner. Therefore I have to manually 😨 run the tests.

It would be helpful if that bit of code could be changed to:

    $env = [
        'AI_AGENT' => $withAgent ? '1' : false,
    ];
    foreach(array_keys(AgentDetector::AGENT_ENV_VARS) as $key) {
        $env[$key] = false;
    }

@joetannenbaum joetannenbaum merged commit fb26cb3 into laravel:main Apr 28, 2026
21 checks passed
@joetannenbaum

Copy link
Copy Markdown
Contributor

Thanks!

@cosmastech cosmastech deleted the make-agent-env-vars-visible branch April 28, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants