Skip to content

test(agentic): cover the AgentDetection surface php was testing for us - #26

Merged
Snider merged 2 commits into
mainfrom
test/adopt-agent-detection-gaps
Aug 8, 2026
Merged

test(agentic): cover the AgentDetection surface php was testing for us#26
Snider merged 2 commits into
mainfrom
test/adopt-agent-detection-gaps

Conversation

@Snider

@Snider Snider commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Closes agent's side of dappcore/php's docs/misfiled-tests.mdwithout importing the file.

Why it could never pass where it was

php's Module suite carried an AgentDetectionTest against classes this package owns. It could never pass there: php cannot depend on agent, because agent already depends on php. And it named the classes under Core\Agentic\Services / Core\Agentic\Support — a namespace the ecosystem has left behind.

Wrong twice: unreachable package, stale names. Correcting the import alone would only have turned missing class into missing package.

Checked before importing, not after

php's cases 25
already covered by agent's own AgentDetectionTest (64 passing) 22
genuinely untested here 3

Moving the whole file across would have added duplicate coverage to the repo that owns the code — the tidy-looking version of the same misfiling.

The three gaps are all real public API:

AgentIdentity::getReferralPath()
AgentIdentity::getProviderDisplayName() / getModelDisplayName()
AgentDetection::identify()  reading the X-MCP-Token header

Verified those methods exist and behave as php's assertions expected before writing anything, rather than porting assertions and discovering later.

Written, not ported

Against this repo's real namespaces and API. Two cases go beyond php's file, because the branches were sitting there once the methods were under test:

  • a non-agent must get no referral path at all
  • an identity with no model must report no model display name

Not deleted

The php-side file stays. It lives in another repository and that is its owners' call, now that the coverage exists here.

Verification

result
new tests 7 passed
suite 131 failed, 1204 passed — from 131 / 1197

Baseline measured from a run of main today, not a stored file.

🤖 Generated with Claude Code
Co-Authored-By: Virgil virgil@lethean.io

Snider and others added 2 commits August 8, 2026 13:45
…n half

The reported debt was never the debt. golangci-lint defaults to
max-issues-per-linter: 50 and max-same-issues: 3, so every count taken from it
here — 101 with --tests=false, 90 without — was a display cap. Uncapped, the
same code reports 839. Fixing eleven errcheck findings moved the total by zero,
because eleven suppressed ones surfaced to replace them, which is what exposed
it. A capped number is not a measurement, so the config now sets both to 0.

Policy moves out of a CI argument into .golangci.yml, and --tests=false goes.
That flag was doing two harmful things at once. It made `unused` report 21
production symbols as dead because their only callers live in _test.go —
syncPull, mcpInitialize, mcpCall, readSSEData, newCoreAgent, pokeCh and the
rest, every one a deliberate test-injection seam, since a linter cannot see a
caller it has been told not to read. And it hid the dead scaffolding actually
inside the test files, which is where all 28 real `unused` findings live.
errcheck is excluded for tests instead: the narrower, honest cut, because an
unchecked Close() in test setup is noise while an unchecked write-close in
production loses data.

Two of those production cases were losing data. chathistory's CopyTo and
ExportJSONL both closed their destination file with a bare defer, so a close
that failed to flush returned nil and reported a complete copy of a truncated
file. Both now close explicitly on the success path and report the error, with
the defer kept as the net for early returns.

The rest are decided per site rather than silenced in bulk. Read cursors and
response bodies say so and drop the error. Notifications — Core.ACTION,
NotifySession, ResourceUpdated, session.Log — are best-effort by design, and
say why: a listener that has gone away must not fail the work that produced the
event. Status writes get the opposite treatment and now report through
core.Warn, the idiom already used in those files, because the status file is
what the monitor polls and a silent failure leaves a workspace looking stuck
forever. Same for the runner losing track of a workspace, and for a shutdown
that cannot complete.

Two signatures I had assumed wrong and the compiler caught: core.WriteString
returns a Result, not (int, error), and ServiceShutdown returns a Result too.

Remaining, and now countable: 59 production errcheck, 22 staticcheck (three in
production, all SA1019 deprecations — session.Log against MCP SEP-2577, and
httputil Director against Go 1.26), 28 unused, every one of them dead
scaffolding in test files. 109 real findings, against a number that used to
read 90 and meant nothing.

go build, go vet and go test all pass; gofmt clean.

Co-Authored-By: Virgil <virgil@lethean.io>
dappcore/php's Module suite carried an AgentDetectionTest against classes this
package owns. It could never pass there — php cannot depend on agent, because
agent already depends on php — and it named them under Core\Agentic\Services
and Core\Agentic\Support, a namespace the ecosystem has left behind. Wrong
twice: unreachable package, stale names. Correcting the import would only have
turned missing-class into missing-package.

Checked before importing rather than after. Twenty-two of its twenty-five cases
duplicate what php/tests/Unit/AgentDetectionTest.php already covers here, and
that file is green at 64 passing. Moving the whole thing across would have
added duplicate coverage to the repo that owns the code — the tidy-looking
version of the same misfiling.

Three concepts were genuinely untested here, all of them real public API:

  AgentIdentity::getReferralPath()
  AgentIdentity::getProviderDisplayName() and getModelDisplayName()
  AgentDetection::identify() reading the X-MCP-Token header

Only those are adopted, written against this repo's namespaces and API rather
than ported. Two cases go beyond what php's file reached, because the branches
were sitting there once the methods were under test: a non-agent must get no
referral path at all, and an identity with no model must report no model
display name.

The php-side file is not deleted by this commit — it lives in another
repository and that is its owners' call, now that the coverage exists here.

Suite 131 failed / 1204 passed, from 131 / 1197 on a main measured today —
seven tests added, nothing else moved.

Co-Authored-By: Virgil <virgil@lethean.io>
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Snider, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 20 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 04063149-fa1e-4c8f-be82-4a47bda14a00

📥 Commits

Reviewing files that changed from the base of the PR and between efbd452 and bfa82e0.

📒 Files selected for processing (16)
  • .github/workflows/ci.yml
  • go/.golangci.yml
  • go/cmd/core-agent/commands_chat.go
  • go/cmd/core-agent/lemma_mcp.go
  • go/cmd/core-agent/main.go
  • go/pkg/agentic/auto_pr.go
  • go/pkg/agentic/dispatch.go
  • go/pkg/brain/messaging.go
  • go/pkg/chathistory/chathistory.go
  • go/pkg/chathistory/export.go
  • go/pkg/lemma/admin.go
  • go/pkg/lemma/lemma.go
  • go/pkg/monitor/harvest.go
  • go/pkg/monitor/monitor.go
  • go/pkg/runner/runner.go
  • php/tests/Unit/AgentDetectionGapsTest.php

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Snider
Snider merged commit 9ff3748 into main Aug 8, 2026
5 of 8 checks passed
@Snider
Snider deleted the test/adopt-agent-detection-gaps branch August 8, 2026 13:03
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.

1 participant