Repository navigation
fix(agent): match the Python agent in rules refresh, key stamp and stats - #37
Merged
Merged
Conversation
This was referenced Oct 15, 2026
rennf93
added a commit
that referenced
this pull request
Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #36
I audited guard-agent-php against the Python agent (guard-agent 3.2.4) and fixed every divergence I could reproduce. Each behavior change has a test in
bin/test_agent.php(section "reference parity") that failed on main first.start()schedules the rules refresh only whenprojectIdis set (null or empty means none), likeclient.py:128-129.time.time_ns()in_buffer_redis.py:54. Reload keeps the reference semantics (keys walked in the order Redis returns them, no sort), and AGENTS.md no longer claims oldest-first.EventBuffer::getStats()gainsautoFlushRunning(always false, PHP has no background auto-flush), so the stats key set equals the reference set. The arrays are host-facing only and not serialized anywhere, so I kept camelCase and documented the mapping.guard-agent-php/User-Agent, theencryptiononError stage, that the Python, TS and Rust agents also sign the uncompressed body, and that persistence at flush, tick or shutdown is a documented deviation from the reference. README and docs/usage.md are corrected the same way.I did not change the persistence deferral (approved in #33). I did not touch CHANGELOG.md because release prep owns it.
I ran the
php -lsweep,composer validate --strict,bin/test_agent.phpagainst Redis (663 passed),bin/test_shutdown.php(9 passed), the coverage runner (100% reachable lines, no waiver line shifted because the edits keep the line numbers above them) andcomposer audit --locked, on PHP 8.5 locally.