Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ test('platform-coupled subsystems match on segments, not substrings', () => {
'packages/core/src/telemetry/uploader.ts',
'packages/cli/src/services/plateauDetector.ts',
'packages/web-shell/client/components/Shellfish.tsx',
'packages/cli/src/ui/hooks/shellCommandProcessor.ts',
]) {
assert.equal(classifyChangedFiles([file]), PLATFORM_INSENSITIVE, file);
}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ env:
# `full` (classify_pr computes a profile only for pull_request), so what
# the fast lane skips is still re-checked post-merge.
HELPER_TESTS_DEP_FREE: '.github/scripts/pr-safety-precheck.test.mjs .github/scripts/cap-release-notes.test.mjs .github/scripts/ci/classify-profile.test.mjs .github/scripts/ci/classify-platform-sensitivity.test.mjs .github/scripts/ci/classify-pr-profile.test.mjs .github/scripts/upsert-bot-comment.test.mjs .github/scripts/ci/main-failure-signature.test.mjs .github/scripts/dsw-swe-verified/make-manifest.test.mjs .github/scripts/dsw-swe-verified/make-terminal-bench-manifest.test.mjs .github/scripts/update-ecs-runner-qwen-workflow.test.mjs .github/scripts/web-shell-visuals-compose.test.mjs .github/scripts/serve-ab-diff.test.mjs .github/scripts/serve-ab-drive.test.mjs .github/scripts/autofix-status-heartbeat.test.mjs .github/scripts/check-disk-floor.test.mjs'
HELPER_TESTS: '.github/scripts/pr-safety-precheck.test.mjs .github/scripts/cap-release-notes.test.mjs .github/scripts/ci/classify-profile.test.mjs .github/scripts/ci/classify-platform-sensitivity.test.mjs .github/scripts/ci/classify-pr-profile.test.mjs .github/scripts/upsert-bot-comment.test.mjs .github/scripts/ci/main-failure-signature.test.mjs .github/scripts/classify-release-notes.test.mjs .github/scripts/dsw-swe-verified/make-manifest.test.mjs .github/scripts/dsw-swe-verified/make-terminal-bench-manifest.test.mjs .github/scripts/resolve-sandbox-image.test.mjs .github/scripts/update-ecs-runner-qwen-workflow.test.mjs .github/scripts/web-shell-visuals-publish.test.mjs .github/scripts/web-shell-visuals-compose.test.mjs .github/scripts/serve-ab-diff.test.mjs .github/scripts/serve-ab-drive.test.mjs .github/scripts/qwen-triage-workflow.test.mjs .github/scripts/assign-issue-owner.test.mjs .github/scripts/auto-minimize-spam.test.mjs .github/scripts/ci-runner-routing.test.mjs .github/scripts/autofix-status-heartbeat.test.mjs .github/scripts/assign-pr-owner.test.mjs .github/scripts/check-disk-floor.test.mjs .github/scripts/ci-disk-pressure.test.mjs .github/scripts/e2e-build.test.mjs'
HELPER_TESTS: '.github/scripts/pr-safety-precheck.test.mjs .github/scripts/cap-release-notes.test.mjs .github/scripts/ci/classify-profile.test.mjs .github/scripts/ci/classify-platform-sensitivity.test.mjs .github/scripts/ci/classify-pr-profile.test.mjs .github/scripts/upsert-bot-comment.test.mjs .github/scripts/ci/main-failure-signature.test.mjs .github/scripts/classify-release-notes.test.mjs .github/scripts/dsw-swe-verified/make-manifest.test.mjs .github/scripts/dsw-swe-verified/make-terminal-bench-manifest.test.mjs .github/scripts/resolve-sandbox-image.test.mjs .github/scripts/update-ecs-runner-qwen-workflow.test.mjs .github/scripts/web-shell-visuals-publish.test.mjs .github/scripts/web-shell-visuals-compose.test.mjs .github/scripts/serve-ab-diff.test.mjs .github/scripts/serve-ab-drive.test.mjs .github/scripts/qwen-triage-workflow.test.mjs .github/scripts/assign-issue-owner.test.mjs .github/scripts/auto-minimize-spam.test.mjs .github/scripts/ci-runner-routing.test.mjs .github/scripts/autofix-status-heartbeat.test.mjs .github/scripts/assign-pr-owner.test.mjs .github/scripts/check-disk-floor.test.mjs .github/scripts/ci-disk-pressure.test.mjs .github/scripts/e2e-build.test.mjs integration-tests/concurrent-runner/export-html-from-chatrecord-jsonl.test.mjs'
# The growth ratchet and its vitest mirror compare each workflow against
# the PR's base commit to tell "this PR grew the file" apart from "the
# baseline went stale on main" (#9904). Wired once here so every lane
Expand Down Expand Up @@ -837,7 +837,7 @@ jobs:
# OUTCOME — no vitest unit-test run, whose flake was measured failing
# 41% of post-merge runs in the week of the split — not lightness: the
# bundle-closure check builds and bundles the CLI, the helper-suite
# steps execute the 25-file HELPER_TESTS battery (most spawn
# steps execute the 26-file HELPER_TESTS battery (most spawn
# subprocesses), and the lane runs on the same contended pool as
# everything else, which is what the routed 90/45 ceiling below prices.
# One honest limit, recorded so the required-check follow-up is argued
Expand Down
6 changes: 6 additions & 0 deletions .qwen/review-context.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
"recommendedTests": ["integration-tests"],
"requiredConfigurations": ["node22"]
},
{
"paths": ["integration-tests/concurrent-runner/**"],
"domains": ["integration-tests"],
"recommendedTests": ["helper-tests"],
"requiredConfigurations": ["node22"]
},
{
"paths": [".github/workflows/**"],
"domains": ["ci", "workflows"],
Expand Down
4 changes: 2 additions & 2 deletions docs/users/features/followup-suggestions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Qwen Code can predict what you want to type next and show it as placeholder text in the input area. This feature uses an LLM call to analyze the conversation context and generate a natural next step suggestion.

This feature works end-to-end in both the CLI and Web Shell. Generation is automatic and server-side: after each completed turn the daemon emits the suggestion on the session stream (on by default; set `ui.enableFollowupSuggestions` to `false` to opt out), and Web Shell's composer already wires the `useDaemonFollowupSuggestion` hook, so suggestions render and accept with no additional host wiring.
This feature works end-to-end in both the CLI and Web Shell. Generation is automatic and server-side: after each cleanly completed turn (the daemon's `end_turn` stop reason — a `cancelled`, `refusal`, `max_tokens`, or `max_turn_requests` turn gets none) the daemon emits the suggestion on the session stream (on by default; set `ui.enableFollowupSuggestions` to `false` to opt out), and Web Shell's composer already wires the `useDaemonFollowupSuggestion` hook, so suggestions render and accept with no additional host wiring.

## How It Works

Expand Down Expand Up @@ -36,7 +36,7 @@ Suggestions are generated when all of the following conditions are met:
- The approval mode is not set to `plan`
- The feature is enabled (on by default — set `ui.enableFollowupSuggestions` to `false` to turn it off)

Suggestions will not appear in non-interactive mode (e.g., headless/SDK mode).
Suggestions will not appear in the CLI's non-interactive mode (e.g., headless/SDK mode). In the daemon, generation is server-side and runs after every turn that meets the conditions above, so a headless or SDK client that cannot render the suggestion should set `ui.enableFollowupSuggestions` to `false` to avoid the per-turn LLM cost.

Suggestions are automatically dismissed when:

Expand Down
6 changes: 5 additions & 1 deletion integration-tests/chat-transcript-document.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,11 @@ describe('ExportTranscriptDocument browser gate', () => {
await expandAll.click();
expect(await expandAll.isDisabled()).toBe(true);
await themeToggle.click();
expect(await page.locator('html').getAttribute('class')).toContain('light');
// `document-main.tsx` toggles `dark` and `light` on <html> mutually
// exclusively, so the attribute is exactly one of them.
await expect
.poll(() => page.locator('html').getAttribute('class'))
.toBe('light');
// Since #11091 a document does not render diagrams: mermaid is stubbed out
// of this bundle, and the fence degrades to its own source in a plain <pre>
// so it stays readable, selectable and findable. Math is deliberately kept,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import fs from 'node:fs';
import fsp from 'node:fs/promises';
import path from 'node:path';
import readline from 'node:readline';
import { fileURLToPath } from 'node:url';
import { pathToFileURL } from 'node:url';

async function loadExportApi() {
try {
Expand Down Expand Up @@ -184,13 +184,28 @@ async function main() {
console.log(`Wrote HTML export to: ${outputPath}`);
}

/**
* Node realpath-resolves `import.meta.url` for the ESM main module but leaves
* `process.argv[1]` as it was invoked, so compare realpaths. Comparing the raw
* spellings makes any symlinked invocation skip `main()` and exit 0 having
* written nothing.
*/
export function isMainModule(argv1, metaUrl) {
if (typeof argv1 !== 'string') return false;
let resolved;
try {
resolved = fs.realpathSync(argv1);
} catch {
resolved = path.resolve(argv1);
}
return metaUrl === pathToFileURL(resolved).href;
}

// Only run when invoked as the CLI. Importing this module (the test does)
// must not execute a render or touch process state.
const invokedDirectly =
typeof process.argv[1] === 'string' &&
path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
const isMain = isMainModule(process.argv[1], import.meta.url);

if (invokedDirectly) {
if (isMain) {
main().catch((error) => {
console.error(error instanceof Error ? error.message : String(error));
process.exitCode = 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* @license
* Copyright 2025 Qwen Team
* SPDX-License-Identifier: Apache-2.0
*/

import assert from 'node:assert/strict';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import test from 'node:test';
import { fileURLToPath, pathToFileURL } from 'node:url';

import { isMainModule } from './export-html-from-chatrecord-jsonl.js';

// The input gate itself is covered by the vitest suite in
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
// scripts/tests/export-html-from-chatrecord-jsonl.test.js; this lane only pins
// the main-module check, which that suite cannot exercise without spawning.
const exporterPath = path.join(
path.dirname(fileURLToPath(import.meta.url)),
'export-html-from-chatrecord-jsonl.js',
);
const exporterUrl = pathToFileURL(fs.realpathSync(exporterPath)).href;

test('recognizes a direct main-module invocation', () => {
assert.equal(isMainModule(exporterPath, exporterUrl), true);
});

test('recognizes a main-module invocation through a symlinked path', () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'exporter-is-main-'));
try {
const link = path.join(dir, 'exporter-link.js');
fs.symlinkSync(exporterPath, link);

assert.equal(isMainModule(link, exporterUrl), true);
} finally {
fs.rmSync(dir, { recursive: true, force: true });
}
});

test('does not treat an imported module as the main module', () => {
assert.equal(
isMainModule(
path.join(path.dirname(exporterPath), 'runner.py'),
exporterUrl,
),
false,
);
assert.equal(isMainModule(undefined, exporterUrl), false);
});
104 changes: 52 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"msw": "^2.10.4",
"npm-run-all": "^4.1.5",
"patch-package": "^8.0.1",
"playwright": "^1.57.0",
"playwright": "1.61.1",
"prettier": "^3.5.3",
"react-devtools-core": "^6.1.5",
"semver": "^7.7.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ const expectedManifest = {
recommendedTests: ['integration-tests'],
requiredConfigurations: ['node22'],
},
{
paths: ['integration-tests/concurrent-runner/**'],
domains: ['integration-tests'],
recommendedTests: ['helper-tests'],
requiredConfigurations: ['node22'],
},
{
paths: ['.github/workflows/**'],
domains: ['ci', 'workflows'],
Expand Down
10 changes: 10 additions & 0 deletions packages/web-shell/client/components/messages/Markdown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ describe('isSafeHref', () => {
expect(isSafeHref('javascript:alert(1)')).toBe(false);
});

it('blocks file: scheme', () => {
expect(isSafeHref('file://attacker.example/share/file.md')).toBe(false);
expect(isSafeHref('file:///etc/passwd')).toBe(false);
});

it('blocks data: URIs', () => {
expect(isSafeHref('data:text/html,<script>alert(1)</script>')).toBe(false);
});
Expand Down Expand Up @@ -145,6 +150,11 @@ describe('isSafeImageSrc', () => {
expect(isSafeImageSrc('javascript:alert(1)')).toBe(false);
});

it('blocks file: scheme', () => {
expect(isSafeImageSrc('file:///tmp/private.png')).toBe(false);
expect(isSafeImageSrc('file://attacker.example/share/img.png')).toBe(false);
});

it('allows relative paths', () => {
expect(isSafeImageSrc('/images/logo.png')).toBe(true);
});
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading