Skip to content

Comments

Peering manual review#9

Open
V-Conet wants to merge 4 commits intobingxin666:v1-hot-potatofrom
V-Conet:main
Open

Peering manual review#9
V-Conet wants to merge 4 commits intobingxin666:v1-hot-potatofrom
V-Conet:main

Conversation

@V-Conet
Copy link

@V-Conet V-Conet commented Jan 24, 2026

No description provided.

@V-Conet V-Conet changed the title 节点审批 Peering manual review Jan 24, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a manual peer request review system for DN42 network peering. When a node has the VERIFY flag enabled, new peer requests are queued for manual approval by privileged users instead of being automatically created.

Changes:

  • Adds VERIFY configuration flag to agent nodes to enable manual review mode
  • Implements a peer request queue system with approval/denial workflow for privileged users
  • Adds /peer_request command for privileged users to manage pending requests
  • Includes a bug fix for parsing bird protocol output when lines lack colons

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
server/commands/peer/peer_requests.py New module implementing the peer request queue, approval/denial logic, and command handler
server/commands/peer/info_collect.py Modified to check verification flag and queue requests instead of auto-creating peers when required
agent/commands/peer.py Adds VERIFY flag to pre_peer response and fixes bird output parsing bug
agent/base.py Loads VERIFY configuration from agent config
agent/agent_config.example.json Adds VERIFY field to example configuration
server/main.py Registers peer_request command in command list
server/commands/help.py Adds help text for peer_request command
server/commands/init.py Imports new peer_requests module
README.md Updates TODO to mark peer approval feature as completed

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

PORT = raw_config["PORT"]
SECRET = raw_config["SECRET"]
OPEN = raw_config["OPEN"]
VERIFY = raw_config["VERIFY"]
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The VERIFY configuration field should use the .get() method with a default value for backwards compatibility with existing agent configurations that don't have this field. This prevents a KeyError when loading older config files. For example: VERIFY = raw_config.get("VERIFY", False)

Suggested change
VERIFY = raw_config["VERIFY"]
VERIFY = raw_config.get("VERIFY", False)

Copilot uses AI. Check for mistakes.
import requests
import tools
from base import bot, db, db_privilege
import base
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Module 'base' is imported with both 'import' and 'import from'.

Copilot uses AI. Check for mistakes.
from datetime import datetime, timezone
from uuid import uuid4

import base
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Module 'base' is imported with both 'import' and 'import from'.

Copilot uses AI. Check for mistakes.
_pending_requests = pickle.load(f)
if not isinstance(_pending_requests, dict):
_pending_requests = {}
except BaseException:
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except block directly handles BaseException.

Suggested change
except BaseException:
except Exception:

Copilot uses AI. Check for mistakes.
headers={"X-DN42-Bot-Api-Secret-Token": config.API_TOKEN},
timeout=10,
)
except BaseException:
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except block directly handles BaseException.

Suggested change
except BaseException:
except requests.RequestException:

Copilot uses AI. Check for mistakes.
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