-
Notifications
You must be signed in to change notification settings - Fork 952
Open
Description
Problem
When a workspace is restarted and the startup script includes coder dotfiles <private-dotfiles-gitlab-repo>
, the command hangs indefinitely if the user's GitLab external auth token has expired. This creates a poor user experience because:
- The workspace startup process gets stuck
- Users are not prompted to re-authenticate with GitLab
- There's no clear indication of what went wrong
- Users must manually intervene to resolve the issue
Current Behavior
- User configures GitLab external auth and successfully authenticates
- User sets up dotfiles with a private GitLab repository
- GitLab token expires (tokens have limited lifetime)
- User restarts workspace
- Startup script runs
coder dotfiles <gitlab-repo>
- Command hangs indefinitely without user feedback
- Workspace startup never completes
Expected Behavior
- User configures GitLab external auth and successfully authenticates
- User sets up dotfiles with a private GitLab repository
- GitLab token expires
- User restarts workspace
- Startup script runs
coder dotfiles <gitlab-repo>
- Command detects expired token and either:
- Prompts user to re-authenticate with GitLab, OR
- Fails gracefully with a clear error message directing user to re-authenticate
- User can take appropriate action to resolve the authentication issue
Technical Details
Based on code analysis:
- The
coder dotfiles
command in/cli/dotfiles.go
uses standard Git operations for cloning/pulling repositories - External auth token handling is in
/coderd/externalauth/externalauth.go
withRefreshToken()
function - When tokens expire and
NoRefresh
is true or refresh fails, anInvalidTokenError
is returned - However, the dotfiles command doesn't appear to handle this case gracefully during non-interactive startup scripts
- Git operations may hang waiting for credentials that will never be provided
Reproduction Steps
- Set up GitLab external auth with a Coder instance
- Configure a workspace template with dotfiles pointing to a private GitLab repository
- Create a workspace and authenticate with GitLab
- Wait for GitLab token to expire (or manually revoke it)
- Restart the workspace
- Observe that the startup script hangs on the dotfiles command
Suggested Solution
The dotfiles command should:
- Check if external auth tokens are available and valid before attempting Git operations
- If tokens are expired/invalid, fail fast with a clear error message
- Provide guidance on how to re-authenticate
- Consider adding a
--non-interactive
flag for startup scripts that skips prompts and fails gracefully
Impact
- Severity: Medium-High (affects workspace startup reliability)
- Frequency: Occurs whenever tokens expire and workspaces are restarted
- User Experience: Poor (silent hang with no feedback)
- Workaround: Manual intervention required to clear startup script or re-authenticate
Metadata
Metadata
Assignees
Labels
No labels