Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf59bd1f

Browse files
committed
Allow connecting when lifecycle is created
If the agent status is "connected" but the lifecycle state is "created",still allow connecting.Fixes#450.
1 parent1ea0cb8 commitf59bd1f

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55
##Unreleased
66

7+
###Changed
8+
9+
- Allow connecting when the agent state is "connected" but the lifecycle state
10+
is "created". This may resolve issues when trying to connect to an updated
11+
workspace where the agent has restarted but lifecycle scripts have not been
12+
ran again.
13+
714
##2.12.0 - 2024-07-02
815

916
###Added

‎gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pluginGroup=com.coder.gateway
44
# Zip file name.
55
pluginName=coder-gateway
66
# SemVer format -> https://semver.org
7-
pluginVersion=2.12.0
7+
pluginVersion=2.12.1
88
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
99
# for insight into build numbers and IntelliJ Platform versions.
1010
pluginSinceBuild=233.6745

‎src/main/kotlin/com/coder/gateway/models/WorkspaceAndAgentStatus.kt‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ enum class WorkspaceAndAgentStatus(val icon: Icon, val label: String, val descri
5454
funstatusColor():JBColor=
5555
when (this) {
5656
READY,AGENT_STARTING_READY,START_TIMEOUT_READY->JBColor.GREEN
57-
START_ERROR,START_TIMEOUT,SHUTDOWN_TIMEOUT->JBColor.YELLOW
57+
CREATED,START_ERROR,START_TIMEOUT,SHUTDOWN_TIMEOUT->JBColor.YELLOW
5858
FAILED,DISCONNECTED,TIMEOUT,SHUTDOWN_ERROR->JBColor.RED
5959
else->if (JBColor.isBright())JBColor.LIGHT_GRAYelseJBColor.DARK_GRAY
6060
}
@@ -63,15 +63,21 @@ enum class WorkspaceAndAgentStatus(val icon: Icon, val label: String, val descri
6363
* Return true if the agent is in a connectable state.
6464
*/
6565
funready():Boolean {
66-
returnlistOf(READY,START_ERROR,AGENT_STARTING_READY,START_TIMEOUT_READY)
66+
// It seems that the agent can get stuck in a `created` state if the
67+
// workspace is updated and the agent is restarted (presumably because
68+
// lifecycle scripts are not running again). This feels like either a
69+
// Coder or template bug, but `coder ssh` and the VS Code plugin will
70+
// still connect so do the same here to not be the odd one out.
71+
returnlistOf(READY,START_ERROR,AGENT_STARTING_READY,START_TIMEOUT_READY,CREATED)
6772
.contains(this)
6873
}
6974

7075
/**
7176
* Return true if the agent might soon be in a connectable state.
7277
*/
7378
funpending():Boolean {
74-
returnlistOf(CONNECTING,TIMEOUT,CREATED,AGENT_STARTING,START_TIMEOUT)
79+
// See ready() for why `CREATED` is not in this list.
80+
returnlistOf(CONNECTING,TIMEOUT,AGENT_STARTING,START_TIMEOUT)
7581
.contains(this)
7682
}
7783

‎src/main/kotlin/com/coder/gateway/util/LinkHandler.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ fun handleLink(
8080
if (status.pending()) {
8181
// TODO: Wait for the agent to be ready.
8282
throwIllegalArgumentException(
83-
"The agent\"${agent.name}\"is${status.toString().lowercase()}; please wait then try again",
83+
"The agent\"${agent.name}\"has a status of\"${status.toString().lowercase()}\"; please wait then try again",
8484
)
8585
}elseif (!status.ready()) {
86-
throwIllegalArgumentException("The agent\"${agent.name}\"is${status.toString().lowercase()}; unable to connect")
86+
throwIllegalArgumentException("The agent\"${agent.name}\"has a status of\"${status.toString().lowercase()}\"; unable to connect")
8787
}
8888

8989
val cli=

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp