Repository navigation
fix(agent): match the Python reference on responses, wire shape, persistence and stats - #26
Merged
Merged
Conversation
…istence and stats An encrypted 413 now halves the batch and re-encrypts each half. Only an explicit success:false or a truthy errors value is a partial failure; an unparseable or empty-object 200 and any unlisted status are retried at once without opening the breaker. The rules GET no longer counts 400/404/413/422 as breaker failures, and a cancelled context is never a breaker failure. The rules loop needs a project id, stop flushes under the backoff gates, and the failure rate counts events plus metrics. A rejected status push is a failed push. The wire always carries ip_address, action_taken, reason, metadata, tags, events, metrics and errors. The Redis persist backlog is capped at bufferSize in flight, warns once per episode and skips the write for an item that already left the buffer, and keys carry the wall-clock stamp. agentStats gains the reference keys, float epoch timestamps and the CLOSED/OPEN/HALF_OPEN spelling. Docs no longer claim the Python agent signs gzipped bytes or that encrypted payloads cannot be split, and AGENTS.md and CLAUDE.md are added. Closes #25
This was referenced 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 #25
I matched guard-agent-jvm to the Python reference agent (master ab52909) on the gaps listed in the issue. The agent already carries the Go 3.2.3 and 3.2.4 changes, so nothing from those releases is missing.
What changed:
success: falseor a truthyerrors. An unparseable or empty-object 200 and any unlisted status (202, 204, 3xx, 405, 408) are retried at once without opening the breaker.stopflushes under the backoff gates, and the failure rate counts events plus metrics.ip_address,action_taken,reason,metadata,tags,events,metricsanderrors. Optional string fields the reference sends as null are still omitted, which the API treats the same.bufferSize(the fixed 4 thread pool and 1024 queue are gone), one warning is logged per backlog episode, a write is skipped when the item already left the buffer, and keys carry the wall-clock epoch nanoseconds stamp (strictly increasing within the process) instead ofSystem.nanoTime().agentStatsgainsloop_failures,last_status_push_ok,buffer_stats.last_flush_time,buffer_stats.auto_flush_running,transport_stats.bytes_sent,transport_stats.failure_countandtransport_stats.session_closed.rules_last_updateis a float epoch (0.0 when none) and the breaker state isCLOSED,OPENorHALF_OPEN. This changes the stringsstatus().circuitStateandstats().circuitStatereturn.AGENTS.mdandCLAUDE.mdare added like the other agent repos.Tests:
src/test/resources/response_vectors.jsonandwire_shape.jsonare generated from the Python agent by the scripts next to them, andRefParityTestreplays them. Against master the new tests fail (for examplestamps [504995962182416, 504995964592500] outside the wall clock windowandan item outside the buffer must never be written ==> expected: <0> but was: <2>) and they pass here../gradlew build --no-daemon(spotless, detekt, 220 tests) passes.