Repository navigation
copper-cloud 0.13.1: device agent relay fixes - #10
Merged
Merged
Conversation
…cap, non-reading agents, disabled users) - Re-delivery: a call stays pending when its stream ends without a reply; every stream a device (re)attaches gets each request still pending on its link again (same id, deadline_ms = time left), oldest first. Pending calls still fail after the 15 s offline grace. - Per-link cap: at most 8 calls in flight per link (DeviceAgentTuning::max_pending_per_link); one more answers at once, isError "Copper on <device> is busy with other calls; try again shortly." (status busy). - Each relayed call waits in its own task: it ends at its deadline / cancel / revoke / shutdown whether or not the agent reads its SSE answer; hub progress is a bounded try_send (32) and the agent's progress buffer is bounded (32, newest dropped), so a slow reader never holds up a frames POST or other calls. - Disabling or deleting a user (admin API) closes their streams with `revoked`, fails their calls (status user_revoked) and drops their rate-limit buckets (the hub's own per-token GCRA replaces governor there). `copper-cloud admin disable-user` / `delete-user` work on the database; a user sweep (10 s, only while the hub holds anything) reaches the running server. - Tests: re-delivery after a dropped and a superseded stream, busy cap (JSON + SSE), an agent that never reads (16 MiB progress flood, other calls proceed, cancel at the deadline), admin API and CLI disable/delete; hub unit tests. - Docs: api.md (re-delivery, busy, slow readers, revoked), admin-api, architecture, security, operations; CHANGELOG + docs/v0.13.1.md; version 0.13.1.
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 the four low-severity issues found in the 0.13.0 device agent relay review. No migrations; 0.13.0 ⇄ 0.13.1 is a binary swap either way.
deadline_ms= time left, oldest first), right afterhello. The phone already answers a seen request id with its stored reply. Calls with no stream still fail after the 15 s offline grace. —hub.rs(attachre-delivers;Pendingkeeps the frame + deadline). Test:a_replaced_stream_gets_the_pending_request_again(stream A dropped mid-call → B gets the same id → reply on B → result in < 10 s of a 60 s deadline; then the superseded-while-open case).DeviceAgentTuning::max_pending_per_link); one more answers at once withisError"Copper on is busy with other calls; try again shortly." (statusbusy), nothing sent to the device. —hub.rs(begin→Result<Call, Refused>),mcp.rs. Test:calls_past_the_per_link_cap_answer_busy_at_once(JSON + SSE, any token, room again after a reply).try_send(32) and the agent's progress buffer is bounded (32, newest dropped), so a frames POST never waits. —mcp.rs(relaytask,relayed,answer_stream). Test:an_agent_that_never_reads_its_answer_still_ends_at_the_deadline(raw TCP agent with a 4 KiB receive buffer never reads; 16 MiB of progress; every POST returns at once; another agent's call goes through;cancelat the deadline and the hub is empty). This test fails on 0.13.0 (nocancelever reaches the device).revoked, fails their calls (statususer_revoked) and drops their rate-limit buckets (the hub's own per-token GCRA replacesgovernorthere, so buckets can be dropped per user). The CLI (admin disable-user/delete-user) is another process that only touches the database, so a user sweep (every 10 s, a single query, only while the hub holds anything) brings the running server in line. —hub.rs(revoke_user,users),mod.rs(revoke_user,sweep_users,start_user_sweep),app.rs,admin_api.rs. Tests:admin_api_disable_and_delete_close_the_users_streams_and_calls,cli_disable_and_delete_reach_the_running_server_through_the_sweep.Docs:
api.md(re-delivery, busy, slow readers,revoked),admin-api.md,architecture.md,security.md,operations.md(statusesbusy,user_revoked; CLI note),CHANGELOG.md,docs/v0.13.1.md; version 0.13.1.Validation (native PostgreSQL):
cargo fmt --all -- --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace: 259 passed, 0 failed (device_agent 22/22, five runs at--test-threads=4; core device_agent units 19/19).