[PR #6815] [CLOSED] [client] Diagnose empty vs corrupt state #29054

Open
opened 2026-08-05 08:07:22 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6815
Author: @pappz
Created: 7/17/2026
Status: Closed

Base: mainHead: diagnose-empty-vs-corrupt-state


📝 Commits (9)

  • 816d806 [client] Update gopsutil to v4 (#6688)
  • 7cd5c17 [client] Fix hanging status command during relay dial (#6694)
  • 08e46aa [management] fix: prevent reverse proxy domain from being pushed as DNS search domain (#6498)
  • 4d4cc55 [client] Recover from rosenpass key desync (#6714)
  • 3d87547 [client] Bump golang.org/x/crypto to v0.54.0 and Go toolchain to 1.25.12 (#6709)
  • 277d8e4 [proxy] enforce model allowlist for URL-routed providers (Bedrock/Vertex) (#6764)
  • f0eed75 [management] Remove proxy peer stale deduplication logic (#6768)
  • 3a2f773 [client] preserve WireGuard key on interactive re-login (#6777)
  • 540198e log state file size when unmarshal fails to distinguish empty from corrupt

📊 Changes

31 files changed (+1236 additions, -375 deletions)

View changed files

📝 client/internal/engine.go (+1 -1)
📝 client/internal/peer/conn.go (+41 -1)
📝 client/internal/peer/conn_test.go (+82 -0)
📝 client/internal/peer/wg_watcher.go (+10 -4)
📝 client/internal/peer/wg_watcher_test.go (+69 -3)
📝 client/internal/rosenpass/manager.go (+7 -4)
📝 client/internal/rosenpass/manager_test.go (+13 -13)
📝 client/internal/rosenpass/netbird_handler.go (+126 -36)
client/internal/rosenpass/netbird_handler_test.go (+250 -0)
📝 client/internal/rosenpass/seed.go (+17 -0)
📝 client/internal/statemanager/manager.go (+6 -0)
📝 client/ios/NetBirdSDK/login.go (+16 -1)
📝 client/system/process.go (+1 -1)
📝 client/system/process_test.go (+1 -1)
📝 e2e/agentnetwork/chat_test.go (+6 -3)
e2e/agentnetwork/guardrail_test.go (+168 -0)
📝 e2e/harness/agentnetwork.go (+11 -0)
📝 e2e/harness/client.go (+16 -0)
📝 go.mod (+10 -10)
📝 go.sum (+16 -16)

...and 11 more files

📄 Description

Describe your changes

When loadStateFile fails to unmarshal the state file, log whether the file is empty (0 bytes) or has malformed content, including the byte size.

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • This change does not modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — OR I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See CONTRIBUTING.md.

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features

    • Added support for Bedrock model requests in Agent Network provider flows.
    • Added model allowlist guardrails for Bedrock and Vertex providers.
  • Bug Fixes

    • Unknown or missing models are now blocked when an allowlist is enabled.
    • Improved relay connection handling during concurrent or slow connection attempts.
    • Improved WireGuard and Rosenpass recovery after repeated handshake failures.
    • Private service DNS zones no longer affect search-domain behavior.
    • Improved configuration loading for iOS authentication startup.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/6815 **Author:** [@pappz](https://github.com/pappz) **Created:** 7/17/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `diagnose-empty-vs-corrupt-state` --- ### 📝 Commits (9) - [`816d806`](https://github.com/netbirdio/netbird/commit/816d80602ffc024afb670dfe18766092701d2639) [client] Update gopsutil to v4 (#6688) - [`7cd5c17`](https://github.com/netbirdio/netbird/commit/7cd5c1732bb5374f21005073937c42f4d531e3c5) [client] Fix hanging status command during relay dial (#6694) - [`08e46aa`](https://github.com/netbirdio/netbird/commit/08e46aa62f3da6a4516dac68287084b736790214) [management] fix: prevent reverse proxy domain from being pushed as DNS search domain (#6498) - [`4d4cc55`](https://github.com/netbirdio/netbird/commit/4d4cc551fdd0b8824ae4caf44af6586d43c044df) [client] Recover from rosenpass key desync (#6714) - [`3d87547`](https://github.com/netbirdio/netbird/commit/3d87547d952f5ada9df987bbe4f0f6d54372d77c) [client] Bump golang.org/x/crypto to v0.54.0 and Go toolchain to 1.25.12 (#6709) - [`277d8e4`](https://github.com/netbirdio/netbird/commit/277d8e4c5352950e1ec4fbd21a3266f0412b09fe) [proxy] enforce model allowlist for URL-routed providers (Bedrock/Vertex) (#6764) - [`f0eed75`](https://github.com/netbirdio/netbird/commit/f0eed7564f3a9138962da1408986e4666d7137b5) [management] Remove proxy peer stale deduplication logic (#6768) - [`3a2f773`](https://github.com/netbirdio/netbird/commit/3a2f773d655d88d16ed953fc2a114a4e690a1b08) [client] preserve WireGuard key on interactive re-login (#6777) - [`540198e`](https://github.com/netbirdio/netbird/commit/540198ee99b9bab11416dd035444a0fef7fb4fe4) log state file size when unmarshal fails to distinguish empty from corrupt ### 📊 Changes **31 files changed** (+1236 additions, -375 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/engine.go` (+1 -1) 📝 `client/internal/peer/conn.go` (+41 -1) 📝 `client/internal/peer/conn_test.go` (+82 -0) 📝 `client/internal/peer/wg_watcher.go` (+10 -4) 📝 `client/internal/peer/wg_watcher_test.go` (+69 -3) 📝 `client/internal/rosenpass/manager.go` (+7 -4) 📝 `client/internal/rosenpass/manager_test.go` (+13 -13) 📝 `client/internal/rosenpass/netbird_handler.go` (+126 -36) ➕ `client/internal/rosenpass/netbird_handler_test.go` (+250 -0) 📝 `client/internal/rosenpass/seed.go` (+17 -0) 📝 `client/internal/statemanager/manager.go` (+6 -0) 📝 `client/ios/NetBirdSDK/login.go` (+16 -1) 📝 `client/system/process.go` (+1 -1) 📝 `client/system/process_test.go` (+1 -1) 📝 `e2e/agentnetwork/chat_test.go` (+6 -3) ➕ `e2e/agentnetwork/guardrail_test.go` (+168 -0) 📝 `e2e/harness/agentnetwork.go` (+11 -0) 📝 `e2e/harness/client.go` (+16 -0) 📝 `go.mod` (+10 -10) 📝 `go.sum` (+16 -16) _...and 11 more files_ </details> ### 📄 Description ## Describe your changes When loadStateFile fails to unmarshal the state file, log whether the file is empty (0 bytes) or has malformed content, including the byte size. ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [x] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] This change does **not** modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — **OR** I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See [CONTRIBUTING.md](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTING.md#discuss-changes-with-the-netbird-team-first). > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [ ] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__ <!-- codesmith:footer --> --- <a href="https://app.blacksmith.sh/netbirdio/codesmith/netbird/pr/6815"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v2.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v2.svg"><img alt="View with Codesmith" src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v2.svg"></picture></a> <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1786882317&installation_id=146802194&pr_number=6815&repository=netbirdio%2Fnetbird&return_to=https%3A%2F%2Fgithub.com%2Fnetbirdio%2Fnetbird%2Fpull%2F6815&signature=21d4648293e64699d3aefd49e01cf7ebfa5b9c8c0e2b4acfb8d40b202c4ddf10"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with Codesmith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"></picture></a> <sup>Need help on this PR? Tag <code>/codesmith</code> with what you need. Autofix is disabled.</sup> <!-- codesmith:autofix:disabled --> <!-- /codesmith:footer --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for Bedrock model requests in Agent Network provider flows. * Added model allowlist guardrails for Bedrock and Vertex providers. * **Bug Fixes** * Unknown or missing models are now blocked when an allowlist is enabled. * Improved relay connection handling during concurrent or slow connection attempts. * Improved WireGuard and Rosenpass recovery after repeated handshake failures. * Private service DNS zones no longer affect search-domain behavior. * Improved configuration loading for iOS authentication startup. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 08:07:22 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#29054