-
Notifications
You must be signed in to change notification settings - Fork 94
fix: use correct bearer token for lazy-load video fetch #5030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -51,6 +51,18 @@ func readSessionToken(environment: [String: String]? = nil) -> String? { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return token | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Read the daemon HTTP bearer token from disk (~/.vellum/http-token). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func readHttpToken() -> String? { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let tokenPath = NSHomeDirectory() + "/.vellum/http-token" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guard let data = try? Data(contentsOf: URL(fileURLWithPath: tokenPath)), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let token = String(data: data, encoding: .utf8)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .trimmingCharacters(in: .whitespacesAndNewlines), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| !token.isEmpty else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return token | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+56
to
+65
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 The new Root Cause and ImpactOn the daemon side, The Swift The existing func resolveSessionTokenPath(environment: [String: String]? = nil) -> String {
let env = environment ?? ProcessInfo.processInfo.environment
if let baseDir = env["BASE_DATA_DIR"]?..., !baseDir.isEmpty {
return expandHomePath(baseDir) + "/.vellum/session-token"
}
return NSHomeDirectory() + "/.vellum/session-token"
}Impact: Video lazy-load will fail with 401 when
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Protocol for daemon client communication, enabling dependency injection and testing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the same root-dir resolution as the daemon when reading
http-token; this helper currently hardcodes~/.vellum/http-token, but the daemon writes the bearer token under(BASE_DATA_DIR || $HOME)/.vellum/http-token(assistant/src/util/platform.ts+assistant/src/daemon/lifecycle.ts). In environments that setBASE_DATA_DIR(custom data roots, containerized/dev setups),readHttpToken()returnsnil, so lazy-loaded video requests are sent without a valid token and fail with 401.Useful? React with 👍 / 👎.