You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(exec): preserve action-critical auth/setup prompt lines during output truncation
When runCommandWithTimeout output exceeds maxOutputBytes, appendCapturedOutput
keeps only the tail of captured stdout/stderr. Device-code login prompts
(login URL, device code, next-action instruction) at the beginning are
silently dropped, making auth prompts unactionable.
This adds:
- src/process/action-critical-output.ts: shared classifier with 13
regex patterns for device-login URLs, verification codes, callback
URLs, and explicit next-action instructions
- CapturedOutputBuffers.headChunks: bounded head buffer (maxOutputBytes)
to recover action-critical lines from early output
- CapturedOutputBuffers.preservedActionCritical: stores lines extracted
from chunks dropped during truncation
- buildCaptureResult(): integrates preserved lines + truncation notice
into final stdout/stderr output
The classifier is designed for shared use with broadcast redaction
(PR #95809).
Closes#96346
expect(isActionCriticalLine("To sign in, use a web browser to open https://login.microsoft.com/device")).toBe(true);
12
+
expect(isActionCriticalLine("Open https://microsoft.com/devicelogin in your browser")).toBe(true);
13
+
});
14
+
15
+
it("detects device/verification codes",()=>{
16
+
expect(isActionCriticalLine("and enter the code FAKE-CODE-270 to authenticate.")).toBe(true);
17
+
expect(isActionCriticalLine("Your verification code is: ABCD-1234-EFGH")).toBe(true);
expect(isActionCriticalLine("enter this code: XXXXX-YYYYY")).toBe(true);
21
+
});
22
+
23
+
it("detects localhost callback URLs",()=>{
24
+
expect(isActionCriticalLine("Open http://localhost:9876 to complete setup")).toBe(true);
it("returns false for URLs without auth context",()=>{
45
+
expect(isActionCriticalLine("Download from https://example.com/file.zip")).toBe(false);
46
+
expect(isActionCriticalLine("See https://docs.example.com for more info")).toBe(false);
47
+
});
48
+
});
49
+
50
+
describe("hasActionCriticalContent",()=>{
51
+
it("returns true when multi-line text contains action-critical content",()=>{
52
+
consttext=[
53
+
"Starting job...",
54
+
"To sign in, use a web browser to open https://login.microsoft.com/device",
55
+
"and enter the code FAKE-CODE-270 to authenticate.",
0 commit comments