mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6284] [MERGED] fix(node): don't stamp InboundsAdoptedAt when the sync adopted nothing #6209
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6209
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6284
Author: @yzxcj797
Created: 8/22/2026
Status: ✅ Merged
Merged: 8/22/2026
Merged by: @MHSanaei
Base:
main← Head:fix/empty-tags-false-adoption-6283📝 Commits (3)
4771733fix(node): don't stamp InboundsAdoptedAt when the sync adopted nothing9bb0049restore atomicBool tests; trim comment to repo 2-line cap21e585etrim syncCanAdopt comment to the 2-line cap📊 Changes
2 files changed (+54 additions, -1 deletions)
View changed files
📝
internal/web/job/node_traffic_sync_job.go(+11 -1)📝
internal/web/job/node_traffic_sync_job_test.go(+43 -0)📄 Description
Fixes #6283.
Root cause
syncOnestampsInboundsAdoptedAton any clean sync, but in selected mode with an empty tag list the snapshot is emptied byFilterNodeSnapshotbeforeSetRemoteTrafficsees it — the sync adopts nothing, the flag is stamped anyway, and the reconcile sweep (gated on the flag since200ea091, the fix for #5898) then treats the node's unadopted pre-existing inbounds as "deleted locally" and removes them. Registering a working node first and choosing tags afterwards — the natural safe order — destroys the node's inbounds, exactly as the issue's state table shows.Fix
Gate the stamp on the sync actually being able to adopt: the new
syncCanAdoptInbounds(n, adoptedAliases)requires, in selected mode, at least one selected tag or adopted alias (both are admitted by the snapshot filter); other modes always adopt. The natural follow-up sync — after the operator selects tags — then performs the real first adoption and stamps the flag correctly.Test
TestSyncCanAdoptInbounds(table-driven): all mode adopts; selected+tags adopts; selected-empty+alias adopts; selected-empty+no-aliases adopts nothing (the reported bug). Bothinternal/web/serviceandinternal/web/jobpackages pass their full suites.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.