6760 Commits

Author SHA1 Message Date
YueGuobin
89da58fe1b
fix: promote skills/prompts load logs to INFO level
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 13:46:36 +08:00
YueGuobin
c5af9ce389
fix: load packet analysis protocols during skills initialization
- Add reload_packet_analysis_protocols() call in _ensure_skills_manager()
- PACKET_ANALYSIS_REGISTRY was empty because it was never loaded
2026-05-12 13:41:52 +08:00
YueGuobin
67b3b778b8
feat: add PacketAnalysisSkillsTool
- Register packet_analysis_skills as a LangChain tool for LLM
- LLM can query protocol field definitions before calling packet_analysis
- Follows the same pattern as DeviceSkillsTool and InjectionSkillsTool
2026-05-12 13:37:59 +08:00
YueGuobin
2a38816d3d
fix: remove remaining quoted example from tool input docstring 2026-05-12 13:30:18 +08:00
YueGuobin
b991125c6c
fix: use shlex.split for tshark_args parsing
- Replace str.split() with shlex.split() to handle quoted arguments
- LLM may pass args with or without quotes, both work correctly now
2026-05-12 13:29:31 +08:00
YueGuobin
e0c2d64b7c
feat: add packet analysis workflow to tool description
- Update PacketAnalysisTool.description with step-by-step workflow
- Instruct LLM to query packet_analysis skills first, then construct tshark_args
2026-05-12 13:13:24 +08:00
YueGuobin
2c5cfdbee8
refactor: remove old PacketCaptureTool, replaced by PacketAnalysisTool
- Delete packet_capture_tools.py (analyze_packets with packet_number)
- PacketAnalysisTool is more flexible and can do everything the old tool could
- Update tool registration to use only PacketAnalysisTool
- Cleaner, more unified packet analysis interface
2026-05-12 10:19:25 +08:00
YueGuobin
84b9742045
feat: add protocol-oriented packet analysis tool
- Add PacketAnalysisTool that accepts user-provided tshark arguments
- LLM constructs tshark commands based on protocol knowledge from skills
- Add PACKET_ANALYSIS_REGISTRY for protocol definitions
- Add load_packet_analysis_protocols() to SkillsLoader
- Add get_packet_analysis_protocol() and list functions to registry
- Register PacketAnalysisTool in teaching and lab automation modes
- Update SkillsManager to reload packet analysis protocols

Related: GNS3-Skills commit 7bc45d2
2026-05-12 09:59:10 +08:00
YueGuobin
6596011799
docs: add roadmap docs for planned features
Close GitHub issues and document as roadmaps instead:
- #2731: user preferences API
- #2732: server settings REST API
- #2733: injection fault tracking
- packet analysis: protocol-oriented analysis architecture
2026-05-12 00:03:07 +08:00
YueGuobin
a408148073
feat: require superadmin for /reload/skills endpoint
Only administrators can reload skills from the external repository.
Non-admin users receive 403 Forbidden.
2026-05-11 22:59:28 +08:00
YueGuobin
ae1a444677
fix: remove background init timeout and allow skills reload retry
- Remove 5s thread.join() timeout so git clone/pull is not truncated
- Remove _init_complete flag, reset _init_in_progress on failure instead
- Let /reload/skills API retry initialization after network failure
- Raise GIT_HTTP_LOW_SPEED_LIMIT from 1 KB/s to 10 KB/s

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 22:51:57 +08:00
YueGuobin
27051a89ad
deps: add PyYAML and GitPython to ai-requirements.txt
Add missing dependencies for the external skills repository feature:
- PyYAML>=6.0.0: for loading YAML skill files
- GitPython>=3.1.0: for Git operations (clone/pull) on skills repo

These dependencies are required by the SkillsManager and SkillsLoader
classes introduced in commit e68cc17e.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 15:59:52 +08:00
YueGuobin
e68cc17ed5
feat: add fault injection system and external skills repository
## Summary

Add a complete fault injection system for GNS3 Copilot, migrate all
skills from local Python files to an external Git repository with
hot reload support, and restructure Copilot API under /copilot/.

## Key Changes

### Fault Injection
- New troubleshooting_injection mode with InjectionSkillsTool
- 368 fault scenarios across 39 protocol categories
- Context-based filtering (LLM must pass topology protocols)

### External Skills Repository
- SkillsManager: Git clone/pull, version tracking, smart updates
- SkillsLoader: YAML skills + Markdown prompts from external repo
- Hot reload via POST /copilot/reload/skills
- Configurable via gns3_server.conf

### Architecture
- API unified under /copilot/ prefix
- SkillsManager moved from Controller to agent module
- Lazy initialization with startup background preload
- Per-command Git timeout, smart update checks
- Forbidden commands hot-reloadable from external repo
- 32 INFO logs downgraded to DEBUG
2026-05-11 01:24:55 +08:00
Jeremy Grossmann
534bb5eded
Merge pull request #2728 from yueguobin/feature/disable-deepseek-thinking-mode
fix: Disable DeepSeek thinking mode to avoid reasoning_content errors
2026-05-09 22:41:27 +08:00
YueGuobin
156072118f
fix: Disable DeepSeek thinking mode to avoid reasoning_content errors
DeepSeek models (deepseek-v4-flash/pro) enable thinking mode by default,
which returns reasoning_content that must be passed back to the API in
subsequent requests. This causes 400 errors in multi-turn conversations
when the reasoning_content is not properly handled.

This commit disables thinking mode by passing extra_body={"thinking": {"type": "disabled"}}
as an explicit parameter to DeepSeek models, preventing the reasoning_content
field from being generated.

Modified:
- create_base_model(): Add extra_body parameter with thinking mode disabled
- create_title_model(): Add extra_body parameter with thinking mode disabled

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 22:31:50 +08:00
grossmj
8b3d136a84
Update packages in requirements.txt 2026-05-09 18:41:02 +08:00
grossmj
97bf94e06e
Merge branch '2.2' into 3.0
# Conflicts:
#	CHANGELOG
#	gns3server/compute/iou/iou_vm.py
#	gns3server/crash_report.py
#	gns3server/utils/asyncio/telnet_server.py
#	gns3server/version.py
#	requirements.txt
#	setup.py
2026-05-09 18:23:00 +08:00
Jeremy Grossmann
32959f1e04
Merge pull request #2724 from yueguobin/fix/import-project-skip-offline-computes
fix: Skip offline compute nodes during project import
2026-05-09 13:59:53 +08:00
YueGuobin
5c7018283f
fix: Skip offline compute nodes during project import
When importing a project, the round-robin logic would attempt to distribute
nodes across all configured compute resources, including offline ones. This
caused import failures when any remote compute was unreachable.

This fix filters the compute list to only include connected computes before
round-robin distribution. If no remote computes are connected, all nodes
are assigned to the local compute.

This matches the approach used in project._get_disconnected_computes() and
prevents the issue where importing a project fails with:
"Cannot connect to compute 'X' with request POST /projects"

Fixes issue introduced in commit 90e3a8d6 (2017) which added round-robin
load balancing without considering offline compute nodes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 13:46:58 +08:00
Jeremy Grossmann
ae2fa31c5e
Merge pull request #2721 from yueguobin/feature/list-node-files-api
feat: Add API endpoint to list node files with metadata
2026-05-09 00:04:16 +08:00
YueGuobin
b4220d55c6
fix: Import status module in project.py
Fix F821 undefined name 'status' error by importing the status
module from fastapi. This resolves build errors when using
status.HTTP_403_FORBIDDEN and status.HTTP_404_NOT_FOUND.
2026-05-08 23:58:43 +08:00
Guobin Yue
cd732ab4b5
Merge branch '3.0' into feature/list-node-files-api 2026-05-08 23:51:56 +08:00
Jeremy Grossmann
14c2172f1b
Merge pull request #2722 from yueguobin/fix/console-stopping-error
fix: Handle connection errors when stopping node console
2026-05-08 23:43:39 +08:00
YueGuobin
3752b2bac8
fix: Handle connection errors when stopping node console
Add exception handling in stop_wrap_console to gracefully handle
ConnectionResetError, BrokenPipeError, and OSError when waiting
for console writer to close.

This prevents 500 errors when stopping QEMU nodes if the console
connection is reset before the writer finishes closing.

Fixes race condition where QEMU process exits and closes connections
before the console writer cleanup completes.
2026-05-08 23:30:41 +08:00
YueGuobin
e6df144ae8
refactor: Remove MD5 calculation from node files listing
Remove MD5 checksum calculation from the node files API since
disk image files are dynamic and change frequently. MD5 calculation
was also causing significant performance overhead.

Changes:
- Remove md5sum field from NodeFile schema
- Remove MD5 calculation from list_node_files method
- Improve error handling for timestamp conversion
- Simplify code by removing lambda functions

Performance improvement:
- Response time reduced from ~0.5-1s to ~0.017s (30-60x faster)
- Especially beneficial for large files and multiple files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 23:05:40 +08:00
YueGuobin
fae7b2eabe
fix: Export NodeFile schema to schemas module
Add NodeFile to the schemas __init__.py exports to fix
import error when starting the server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 22:58:45 +08:00
YueGuobin
51a4c73e21
feat: Add detailed metadata to node files listing
Enhance the node files API to include comprehensive file metadata:
- File size in bytes
- File creation time (ISO 8601 format)
- File modification time (ISO 8601 format)
- File extension

Create new NodeFile schema to support these additional fields
while keeping the existing ProjectFile schema for backward compatibility.

This provides users with better information to manage and identify
files in the Web UI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 22:57:19 +08:00
YueGuobin
5b75d633aa
feat: Add API endpoint to list node files
Implement issue #2719 - Add API endpoint to list project files

- Add GET /v3/projects/{project_id}/nodes/{node_id}/files endpoint
- Add list_node_files() method to Project class
- Add security checks to prevent path traversal
- Filter out .ghost temporary files
- Return file paths with MD5 checksums
- Require Node.Audit privilege

This allows users to discover dynamically created files
such as QEMU disk images created via the disk image API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 22:52:17 +08:00
grossmj
c3d23d7cae
Development on 2.2.60.dev1 2026-05-08 20:03:31 +08:00
grossmj
a1edf74fcf
Merge branch 'master' into 2.2 2026-05-08 19:49:53 +08:00
grossmj
59a95edd3d
Release v2.2.59 v2.2.59 2026-05-08 19:06:04 +08:00
grossmj
e34a7afe79
Sync appliances 2026-05-08 19:03:14 +08:00
Jeremy Grossmann
2dcbe0f1c2
Merge pull request #2717 from GNS3/bugfix/2709
Fix snapshot restore does not work after export/import of project
2026-05-08 18:59:37 +08:00
grossmj
b1c8ce8b58
Remove unneeded code 2026-05-08 18:56:56 +08:00
grossmj
b304511b5e
Fix snapshot restore does not work after export/import of project 2026-05-08 18:47:47 +08:00
grossmj
163d4e0534
Update requirements.txt & python_requires 2026-05-08 17:01:10 +08:00
grossmj
72f64ee60b
Warn to use 64-bit IOU images. Fixes #2716
32-bit IOU image support has been removed from the GNS3 VM.
2026-05-08 16:37:06 +08:00
Jeremy Grossmann
cd03abb7ed
Merge pull request #2669 from arl1984/fix/telnet-proxy-reader-cleanup-2344
Fix telnet console silent-proxy hang on non-ConnectionError exit (#2344)
2026-05-08 15:42:51 +08:00
grossmj
6551bf56f8
Tweak and merge changes from 3.0 branch 2026-05-08 15:36:40 +08:00
Jeremy Grossmann
e0860555ba
Merge pull request #2713 from yueguobin/fix/docker-container-deletion-error-handling
Fix: Improve Docker container deletion error logging
2026-05-07 22:17:23 +08:00
YueGuobin
822abbe671
Fix: Improve Docker container deletion error logging
When closing a Docker node, if container deletion fails, the error
is silently ignored. This can lead to stale containers remaining on
the system and causing 409 conflicts when reopening projects.

Changes:
- Distinguish between 404 (container already removed, normal) and
  other DockerError (deletion failed, needs attention)
- Log warning when deletion fails with error details
- Add comment explaining stale containers will be cleaned up on
  project open (via automatic 409 conflict resolution)

This improves observability without blocking project close operations.
The root cause of stale containers can now be diagnosed from logs.

Fixes #2708

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 12:45:05 +08:00
Jeremy Grossmann
3928377f80
Merge pull request #2710 from yueguobin/fix/compute-connection-timeout
Fix: Check compute connectivity before open() during project deletion
2026-05-07 11:36:45 +08:00
Jeremy Grossmann
0d88ff87e7
Merge pull request #2712 from yueguobin/fix/compute-reconnection-backoff
Fix: Add exponential backoff to compute reconnection attempts
2026-05-07 11:35:46 +08:00
YueGuobin
efe6913d69
Fix: Add exponential backoff to compute reconnection attempts
When a remote compute is unreachable, the controller now uses exponential
backoff for reconnection attempts: 5s, 10s, 20s, 40s, 80s, then caps at
300s (5 minutes). Previously it retried every 5 seconds indefinitely.

User-initiated operations (open project, start node) still trigger an
immediate connection attempt, so recovery is not delayed in practice.

Related: #2704
2026-05-07 11:17:55 +08:00
YueGuobin
f1b11e7cae
Fix: Check compute connectivity before node creation in open()
When opening a closed project with nodes on an offline remote compute,
open() would block for 120s trying to connect before eventually
failing. Now checks compute connectivity after loading the topology
file but before creating nodes, allowing immediate failure with a
clear error message.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-07 10:48:18 +08:00
YueGuobin
30ebde0cb0
Fix: Check compute connectivity before open() during project deletion
Previously the disconnected compute check ran after open(), which would
block for 120s trying to connect to unreachable remote computes before
rejecting the deletion. Now reads the topology file directly to extract
compute IDs and checks connectivity before calling open(), enabling
immediate rejection of deletions involving offline computes.

Also removes the redundant post-open() check since the early check
covers both opened and closed project states.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-07 09:58:20 +08:00
YueGuobin
8ecd449dd8
Fix: Add error logging when closing/deleting projects on computes
Previously errors during close() and delete_on_computes() were silently
swallowed without any logging, making it difficult to diagnose failures
when remote computes are unreachable.

- close(): log warning instead of silent pass
- delete_on_computes(): wrap HTTP DELETE in try/except with warning log

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-07 09:37:51 +08:00
YueGuobin
4d06b2b7b6
Fix: Skip add_compute for existing computes when opening projects 2026-05-06 13:24:27 +08:00
YueGuobin
0f4b0c567e
feat: add AI provider config files to .gitignore
Add deepseek, claude, gemini, and grok settings files to .gitignore to prevent accidental commits of local AI provider configurations.
2026-05-06 13:24:13 +08:00
Jeremy Grossmann
255d1e4057
Merge pull request #2705 from yueguobin/fix/project-deletion-compute-status-check
Fix: Check compute connection status before project deletion
2026-05-06 09:39:41 +08:00