Skip to content

fix(dgw): ignore bad agent_tunnel.db when tunnel is off - #2071

Closed
irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 1 commit into
masterfrom
fix/agent-tunnel-import-tunnel-off
Closed

irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 1 commit into
masterfrom
fix/agent-tunnel-import-tunnel-off

Conversation

@irvingoujAtDevolution

Copy link
Copy Markdown
Contributor

With the agent tunnel off, a 2026.3 agent_tunnel.db that can't be imported no longer stops the Gateway from starting; the failure is logged as a warning. The import still runs when the tunnel is off, so turning the tunnel back on later keeps the enrolled Agents. With the tunnel on, a failed import still stops the start.

Follow-up to this review on #2039.

With the agent tunnel off, a 2026.3 agent_tunnel.db that can't be
imported no longer stops the Gateway from starting; the failure is
logged as a warning. The import still runs when the tunnel is off, so
turning the tunnel back on later keeps the enrolled Agents. With the
tunnel on, a failed import still stops the start.
Copilot AI balanced review requested due to automatic review settings October 13, 2026 17:11
@irvingoujAtDevolution

Copy link
Copy Markdown
Contributor Author

Why not just skip the import when the tunnel is off: GatewayDb::open creates gateway.db on every start, and once it exists the import ignores agent_tunnel.db for good (upgrade.rs). So someone who used the tunnel on 2026.3, turned it off and then upgraded would lose their Agents when turning it back on. Keeping the import and only tolerating its failure avoids that.

Ran the debug build locally with a broken and a valid agent_tunnel.db:

Tunnel agent_tunnel.db Result
off garbage starts, warning logged, /jet/health 200
on garbage refuses to start, same as before
off valid 2026.3 imported into gateway.db
on valid 2026.3 imported

Note

LLM-assisted content (no human feedback).

@github-actions

Copy link
Copy Markdown

Let maintainers know that an action is required on their side

  • Add the label release-required Please cut a new release (Devolutions Gateway, Devolutions Agent, Jetsocat, PowerShell module) when you request a maintainer to cut a new release (Devolutions Gateway, Devolutions Agent, Jetsocat, PowerShell module)

  • Add the label release-blocker Follow-up is required before cutting a new release if a follow-up is required before cutting a new release

  • Add the label publish-required Please publish libraries (`Devolutions.Gateway.Utils`, OpenAPI clients, etc) when you request a maintainer to publish libraries (Devolutions.Gateway.Utils, OpenAPI clients, etc.)

  • Add the label publish-blocker Follow-up is required before publishing libraries if a follow-up is required before publishing libraries

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Creating gateway.db after an ignored failure prevents future import retries when the tunnel is re-enabled.

1 open finding
What changed in this PR

Allows Gateway startup to continue when a legacy Agent Tunnel database import fails while tunneling is disabled.

Changes:

  • Makes import failures conditional on Agent Tunnel state.
  • Logs ignored failures as warnings.
File Description
devolutions-gateway/​src/​service.rs Handles legacy database import failures during startup.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +284 to +288
Err(error) if conf.agent_tunnel.enabled => return Err(error),
// The agent tunnel is off, so a bad old file must not stop the Gateway.
Err(error) => warn!(
error = format!("{error:#}"),
"Failed to import the 2026.3.0 agent tunnel database, continuing because the agent tunnel is disabled"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants