Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
18772ed
refactor(cli): keep acp-integration off serve internals (#8084)
yiliang114 Aug 14, 2026
99a1172
Merge remote-tracking branch 'origin/main' into HEAD
yiliang114 Aug 14, 2026
0691cb9
fix(cli): harden the acp/serve boundary guard (round 2)
yiliang114 Aug 14, 2026
ac83137
test(cli): pin serve boundary lint rules
yiliang114 Aug 15, 2026
ec63477
test(cli): close serve boundary lint gaps
yiliang114 Aug 15, 2026
78ead13
fix(lint): close serve-boundary entrances and harden the guard
yiliang114 Aug 15, 2026
17d16d5
fix(lint): correct TSImportType selector path and computed-template h…
yiliang114 Aug 15, 2026
4abaca1
fix(lint): close the remaining round-6 serve-boundary entrances
yiliang114 Aug 15, 2026
6f7a13d
fix(lint): cover vitest serve-boundary calls
yiliang114 Aug 15, 2026
0c8c334
fix(lint): close the round-7 serve-boundary entrance classes
yiliang114 Aug 15, 2026
1815694
refactor(lint): resolve the serve boundary by resolution, not text (#…
yiliang114 Aug 16, 2026
23cf025
Merge branch 'main' into fix/acp-serve-boundary-guard
yiliang114 Aug 16, 2026
02e502a
fix(lint): drop the dead serveGuardSyntaxRules helper
yiliang114 Aug 16, 2026
3d8be1f
fix(lint): close serve boundary resolver gaps
yiliang114 Aug 16, 2026
3cc4298
fix(lint): address serve boundary review suggestions
yiliang114 Aug 16, 2026
cf05dd5
fix(lint): close round-11 serve boundary gaps
yiliang114 Aug 16, 2026
34fc045
chore: merge main into serve boundary guard
yiliang114 Aug 16, 2026
2d59792
fix(cli): restore live session source import
yiliang114 Aug 16, 2026
3da80b9
fix(lint): clear the two lint errors breaking CI on the boundary rule
yiliang114 Aug 16, 2026
c4758e3
fix(lint): close bounded serve boundary gaps
yiliang114 Aug 16, 2026
7112ab4
fix(lint): complete the round-12 boundary escape closures
yiliang114 Aug 16, 2026
552bc7c
fix(lint): close the round-12 reviewer escape classes (#8084)
yiliang114 Aug 17, 2026
c11b30c
fix(lint): repair corrupted files from the git-API blob upload
yiliang114 Aug 17, 2026
8e583a8
Merge remote-tracking branch 'origin/main' into HEAD
yiliang114 Aug 17, 2026
ebe1cb5
fix(lint): close the round-13 serve-boundary escape classes (#8084)
yiliang114 Aug 17, 2026
9fbd906
fix(lint): close the round-13 binding-hop and callee-opacity escapes …
yiliang114 Aug 18, 2026
58d4398
refactor(cli): simplify ACP serve boundary guard
yiliang114 Aug 19, 2026
ff4e3b0
Merge remote-tracking branch 'origin/main' into codex/pr-9144-scope-back
yiliang114 Aug 20, 2026
210b2e1
fix(lint): close the round-21 contract pins and bare-barrel escape (#…
yiliang114 Aug 20, 2026
01475ab
fix(lint): close dynamic-import and js-file holes in the acp/serve gu…
yiliang114 Aug 22, 2026
5e7511a
fix(lint): make acp/serve dynamic-import guard case-insensitive
yiliang114 Aug 22, 2026
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
76 changes: 75 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,26 @@ export default tseslint.config(
'import/namespace': 'off', // Disabled due to https://github.com/import-js/eslint-plugin-import/issues/2866
},
},
{
// `runtime/` is the neutral layer acp-integration is directed to; it must
// not import `serve/` internals itself, or the #8084 boundary reforms
// transitively one hop away.
files: ['packages/cli/src/runtime/**/*.{ts,tsx}'],
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
rules: {
'no-restricted-imports': [
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
'error',
{
patterns: [
{
group: ['**/serve', '**/serve/*', '**/serve/**'],
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
message:
'packages/cli/src/runtime must not import serve/ internals (#8084).',
},
],
},
],
},
},
{
// `utils/` is the layer every other directory imports, so it must not
// import back into one. The daemon direction is clean and enforced here;
Expand All @@ -84,7 +104,9 @@ export default tseslint.config(
{
patterns: [
{
group: ['**/serve/*', '**/serve/**'],
// `**/serve` also covers the bare directory specifier, which
// resolves to the serve/ barrel.
group: ['**/serve', '**/serve/*', '**/serve/**'],
message:
'packages/cli/src/utils must not import serve/. Move lifecycle-free logic down into utils/ instead (#9146).',
},
Expand Down Expand Up @@ -197,6 +219,58 @@ export default tseslint.config(
'default-case': 'error',
},
},
{
// ACP integration and the daemon are separate runtime surfaces that happen
// to share a package directory. ACP may consume neutral contracts under
// `runtime/`, but never `serve/` implementation modules — see #8084.
// Enforcement point is `npm run lint` in CI; no fixture test pins this
// block — accepted trade-off, the boundary lives in config, not code.
//
// Positioned after the general TS block on purpose: flat config lets the
// last matching block win per rule, and that block also configures
// `no-restricted-syntax` — placing this one earlier would silently lose
// the dynamic-import guard below. Its two selectors are restated here so
// this override does not drop them for acp-integration files.
files: ['packages/cli/src/acp-integration/**/*.{ts,tsx}'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
// `**/serve` also covers the bare directory specifier, which
// resolves to the serve/ barrel (createServeApp, runQwenServe…).
group: ['**/serve', '**/serve/*', '**/serve/**'],
message:
'acp-integration must not import serve/ internals. Put shared, lifecycle-free logic in packages/cli/src/runtime/ instead (#8084).',
},
],
},
],
'no-restricted-syntax': [
'error',
{
selector: 'CallExpression[callee.name="require"]',
message: 'Avoid using require(). Use ES6 imports instead.',
},
{
selector: 'ThrowStatement > Literal:not([value=/^\\w+Error:/])',
message:
'Do not throw string literals or non-Error objects. Throw new Error("...") instead.',
},
// no-restricted-imports only visits static import/export declarations;
// the same boundary applies to dynamic `await import('../serve/…')`.
// The selector regex spells `/` as `\x2f` because esquery cannot parse
// a literal slash inside its attribute-regex syntax.
{
selector:
"ImportExpression[source.value=/^(?:\\.\\.\\x2f)+serve(?:\\x2f|$)/]",
message:
'acp-integration must not dynamically import serve/ internals. Put shared, lifecycle-free logic in packages/cli/src/runtime/ instead (#8084).',
},
],
},
},
{
files: [
'packages/web-shell/client/**/*.{ts,tsx}',
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/acp-integration/acpAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ import {
type PermissionRuleSet,
} from '../config/permission-settings.js';
import { createLoadedSettingsAdapter } from '../config/loadedSettingsAdapter.js';
import { isCompatibleLiveSessionSource } from '../serve/conversations/session-source.js';
import { isCompatibleLiveSessionSource } from '../runtime/live-session-source.js';
import type { ApprovalModeValue } from './session/types.js';
import { z } from 'zod';
import type { CliArgs } from '../config/config.js';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/acp-integration/session/Session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ import * as nonInteractiveCliCommands from '../../nonInteractiveCliCommands.js';
import { CommandKind } from '../../ui/commands/types.js';
import { buildAcpModelOptions } from '../../utils/acpModelUtils.js';
import { CHANNEL_PROMPT_META_KEY } from '@qwen-code/channel-base';
import { CAPTURE_SCREEN_CONTEXT_TOOL_NAME } from '../../serve/live/capture-screen-context.js';
import { SPEAK_TO_USER_TOOL_NAME } from '../../serve/live/live-speak-to-user.js';
import { CAPTURE_SCREEN_CONTEXT_TOOL_NAME } from '../live/capture-screen-context.js';
import { SPEAK_TO_USER_TOOL_NAME } from '../live/live-speak-to-user.js';
import {
collectHistoryReplayUpdates,
createReplayCumulativeUsage,
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/acp-integration/session/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,19 @@ import { normalizeChannelDeliveryText } from '../../runtime/channel-delivery.js'
import {
CAPTURE_SCREEN_CONTEXT_TOOL_NAME,
CaptureScreenContextTool,
} from '../../serve/live/capture-screen-context.js';
} from '../live/capture-screen-context.js';
import {
createLiveTaskTools,
type LiveTaskTool,
} from '../../serve/live/live-task-tools.js';
} from '../live/live-task-tools.js';
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
import {
SPEAK_TO_USER_TOOL_NAME,
SpeakToUserTool,
} from '../../serve/live/live-speak-to-user.js';
} from '../live/live-speak-to-user.js';
import {
LIVE_BACKEND_END_INSTRUCTIONS,
LIVE_BACKEND_START_INSTRUCTIONS,
} from '../../serve/live/live-backend-instructions.js';
} from '../live/live-backend-instructions.js';
import { readVoiceModel } from '../../services/voice-settings.js';
import {
MAX_AUDIO_BYTES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { describe, expect, it } from 'vitest';
import {
isReservedLiveSessionSource,
readLoadableLiveConversationMetadata,
} from './session-source.js';
} from './live-session-source.js';

describe('readLoadableLiveConversationMetadata', () => {
const records = new Map([
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/serve/acp-http/dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import { restoreRetryAfterSeconds } from '@qwen-code/acp-bridge/sessionRestoreTi
import {
isReservedLiveSessionSource,
readLoadableLiveConversationMetadata,
} from '../conversations/session-source.js';
} from '../../runtime/live-session-source.js';
import {
translateAndCheckAbsoluteWorkspacePath,
canonicalizeWorkspace,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/serve/live/live-session-coordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ import type { LiveProviderCredential } from './provider-credentials.js';
import {
isCompatibleLiveSessionSource,
LIVE_SESSION_SOURCE_PREFIX,
} from '../conversations/session-source.js';
} from '../../runtime/live-session-source.js';
import type { LiveProviderReadiness, LiveSessionLocator } from './types.js';

export { LIVE_SESSION_SOURCE_PREFIX } from '../conversations/session-source.js';
export { LIVE_SESSION_SOURCE_PREFIX } from '../../runtime/live-session-source.js';

const MAX_COORDINATOR_REQUEST_CHARS = 32_000;
const MAX_COORDINATOR_RESULT_CHARS = 48_000;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/serve/live/live-task-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type {
WorkspaceRuntime,
} from '../workspace-registry.js';
import { LiveTaskService } from './live-task-service.js';
import { LIVE_SESSION_SOURCE_PREFIX } from '../conversations/session-source.js';
import { LIVE_SESSION_SOURCE_PREFIX } from '../../runtime/live-session-source.js';

const persistedSessions = vi.hoisted(() => new Map<string, unknown>());
const persistedSessionOwners = vi.hoisted(() => new Map<string, string>());
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/serve/live/live-task-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { listWorkspaceSessionsForResponse } from '../server/session-list.js';
import {
isCompatibleLiveSessionSource,
readLoadableLiveConversationMetadata,
} from '../conversations/session-source.js';
} from '../../runtime/live-session-source.js';

const DEFAULT_LIST_LIMIT = 20;
const DEFAULT_READ_TURN_LIMIT = 3;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/serve/multi-workspace-sessions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
} from './workspace-registry.js';
import type { WorkspaceRuntimeProvenance } from './managed-scratch-workspace.js';
import type { ConversationWorkspace } from './conversations/conversation-workspace.js';
import { LIVE_SESSION_SOURCE_PREFIX } from './conversations/session-source.js';
import { LIVE_SESSION_SOURCE_PREFIX } from '../runtime/live-session-source.js';
import { createSessionOrganizationService } from './session-organization-helpers.js';
import {
serializeWorkspaceTranscriptResponseForTesting,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/serve/routes/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { parseSessionSource } from '@qwen-code/acp-bridge';
import {
isReservedLiveSessionSource,
readLoadableLiveConversationMetadata,
} from '../conversations/session-source.js';
} from '../../runtime/live-session-source.js';
import type { Application, Request, RequestHandler, Response } from 'express';
import { writeStderrLine } from '../../utils/stdioHelpers.js';
import { parseCallerSuppliedSessionId } from '../../config/session-id.js';
Expand Down
Loading