Commit graph

1496 commits

Author SHA1 Message Date
jinye
1fffa5108d
fix(acp-bridge): Disable permission timeout by default (#9933)
Some checks are pending
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 1/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 2/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 3/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 1/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 2/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 3/3 (push) Waiting to run
E2E Tests / E2E Test - macOS - shard 1/2 (push) Waiting to run
E2E Tests / E2E Test - macOS - shard 2/2 (push) Waiting to run
E2E Tests / channel-plugin E2E (nightly) (push) Waiting to run
E2E Tests / cron-interactive E2E (nightly) (push) Waiting to run
E2E Tests / web-shell Browser Regression (push) Waiting to run
npm cache producer / Save npm cache (push) Waiting to run
SDK Java / ubuntu-latest / Java 11 (push) Waiting to run
SDK Java / ubuntu-latest / Java 17 (push) Waiting to run
SDK Java / macos-latest / Java 21 (push) Waiting to run
SDK Java / ubuntu-latest / Java 21 (push) Waiting to run
SDK Java / windows-latest / Java 21 (push) Waiting to run
SDK Java / Real daemon E2E / Java 11 (push) Waiting to run
Security Checks / Dependency CVE audit (push) Waiting to run
Security Checks / Secret scan (TruffleHog) (push) Waiting to run
* fix(acp-bridge): disable permission timeout by default

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* chore: regenerate settings schema

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* docs(acp-bridge): fix stale timeout comment

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
2026-08-24 16:08:44 +00:00
Harjoth Khara
95bdd46241
fix(config): accept output.format "stream-json" in the settings schema (#8966)
* fix(config): accept output.format "stream-json" in the settings schema

The runtime already reads and honors output.format: "stream-json" from
settings.json (normalizeOutputFormat -> OutputFormat.STREAM_JSON), and it
is a documented --output-format choice, but the settings schema listed
only text and json. The VS Code companion applies that schema to every
.qwen/settings.json, so it flagged a valid, working config as invalid.

Add stream-json to the source schema and regenerate the shipped
settings.schema.json. Same schema/runtime drift class as #8752.

Closes #8965

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(config): bind output.format schema values to OutputFormat and document stream-json

Apply the review's non-blocking suggestions:

- Schema options now use the OutputFormat enum constants the runtime's
  normalizeOutputFormat accepts, so the settings schema cannot silently
  drift from core.
- The full enum is pinned in the test (toEqual, sibling-test pattern)
  instead of a toContain probe.
- The format description — schema, regenerated VS Code schema, and the
  settings reference table — now notes that stream-json makes runs
  started with a prompt non-interactive (headless), and the docs table
  lists stream-json as a possible value.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01US2APQw84vvQZZ4pZaKtzn

* test(cli): add OutputFormat to core mock factories that reach settingsSchema

settingsSchema.ts now reads OutputFormat at module load, so the two test
files that mock @qwen-code/qwen-code-core with a hand-built factory and
transitively import it need the enum in the mock, matching how they
already mock ApprovalMode.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(config): derive the output.format test pin from the enum and document the argv-only gates

Address the round-2 review:

- The test pins the schema options against Object.values(OutputFormat),
  so a format added in core fails the test until the schema and the
  regenerated JSON follow; the schema comment now states exactly that
  instead of overpromising drift protection from the binding alone.
- The description, regenerated schema, and docs table note that flags
  validated at argv parse time (--include-partial-messages,
  --input-format stream-json) still require the explicit
  --output-format stream-json flag, since those yargs checks run before
  settings are loaded.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* test(cli): cover settings-driven stream-json output and name the flag in the docs note

Address the round-3 suggestions: a config test now exercises
output.format stream-json arriving from settings through loadCliConfig,
and the docs table names the --output-format stream-json flag the
argv-time checks require, matching the schema description.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* test(cli): pin argv-over-settings output format precedence with differing values

The existing precedence test used the same value on both sides, so an
inverted merge passed the suite. The new case sets settings stream-json
against argv text and asserts text wins.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(test): match the enum-pin comment to the order-sensitive assertion

Apply the maintainer review nits: the comment now says array-derived,
order included, which is what toEqual checks, and the precedence test
drops a comment that restated its name.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-24 12:45:51 +00:00
Yu Zhang
2dbe806204
docs(sdk): fix query timeout example signature (#9867)
Co-authored-by: zhangyu.34 <zhangyu.34@bytedance.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-24 12:40:05 +00:00
qqqys
24db7f6ef2
feat(review): say when the approach, not the patch, is the open question (#9340)
* feat(review): say when the approach, not the patch, is the open question

Every finding /review emits is anchored to a `file:line` in the current diff.
That is what a finding is — and it means a review can report where an approach
leaks, but never that a different approach would retire all of the leaks at
once.

Measured: one change to `extractAndStripMeta` took three attempts across two
PRs. #9097 (3 rounds, 18 findings) added a timeout to the vm call; #9136 (6
rounds, 56 findings) moved the walk inside the vm and ended up spawning a child
process per call, growing 228 -> 920 source diff lines. #9325 landed it in one
commit by not evaluating the literal at all. All 74 findings were individually
correct, and every one of them went away with the mechanism.

The signal was already there and filed as the wrong kind of thing: `did not
converge within the reverse-audit round cap` appeared four times across the two
PRs, as a coverage gap — "we did not finish looking" — rather than as a
conclusion about the change. Nothing was responsible for reading it as "stop
patching".

Add one advisory paragraph, and one clause on the terminal verdict line, when a
non-Approve round is past the round threshold AND its source diff has grown at
least 3x since the review first measured it. This round's round-cap stop rides
along as corroborating text when present; it is never a trigger on its own.

It is deliberately not a finding. Findings are what the autofix loop consumes,
and that loop patching each finding in turn is the pattern being interrupted —
a finding here would be fixed rather than read. It addresses the human deciding
what happens next, so it is a body paragraph and a verdict-line clause, it adds
no cap, and it never moves the event.

The baseline is a baseline, not the previous round's size: 228 -> 920 across six
rounds is ~1.3x per round, which no per-round delta would notice, but 4.0x
cumulatively. `Ledger.src0` records the first measurement and is carried forward
unchanged, so a diff that later shrinks cannot rewrite its own baseline. It is
the one marker field that survives truncation — the ruling that withholds an
anchor from a partial finding list does not extend to a measurement of the diff.

Known limits, documented rather than papered over: it cannot see across pull
requests, so the three-attempt shape that motivated it would have fired only on
a second forgeable persisted counter; and it is retroactively blank, staying
silent until a PR has posted two rounds after this ships.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(review): suppress approach signal for downgraded approvals

* fix(review): measure approach growth over full diff

* fix(review): validate approach signal evidence

* fix(review): pin approach-signal boundaries and validator coverage

Round-5 review findings: boundary tests for the round threshold,
growth factor, and source-diff floor; the round-cap corroborating
clause and its zh rendering; src0 survival through the pr-context
persist seam and the incremental marker carry-forward; artifact
validator refusal/absence tests for approachSignal; design doc
firing list names the pre-cap verdict.

* fix(review): clamp the approach signal's round at the ledger cap (R9-1)

The signal computed its displayed round with an unclamped `prevRound + 1`
while the ledger marker stamp and the deferred-suggestions clause both
clamp with `Math.min(prevRound + 1, LEDGER_MAX_ROUND)`. `parseLedger`
accepts `round == LEDGER_MAX_ROUND`, so a side file at the cap is
representable and carries forward: one composed body announced
"⚠️ Round 10001" beside a marker stamping `"round":10000`, and the
terminal verdict line printed 10001 too — the doc comment in this same
diff claims all three consumers cannot disagree "at the cap included".

The new test pins the cap for the third consumer, mirroring the existing
deferred-clause cap test; mutation-verified that reverting the clamp
turns it red with `round: 10001`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: qqqys <266654365+qqqys@users.noreply.github.com>
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
2026-08-24 12:27:26 +00:00
Shaojin Wen
d1cfd87683
feat(review): promote language-pitfall and wrapper/proxy checks out of Agent 1a (#9805)
* feat(review): promote language-pitfall and wrapper/proxy checks out of Agent 1a (#9788)

Split the two checks folded into Agent 1a's line-by-line brief into dedicated
Step 3A roles at high effort: Agent 1d (language-pitfall scan, always) and
Agent 1e (wrapper/proxy routing, rostered when the plan's wrapperSignal is
true — a capture-time vocabulary heuristic that fails safe: only an explicit
false keeps it out, so version-skewed plans still owe the check). The roster,
check-coverage and agent-prompt all read the gate from the plan, so a run that
skips either agent is named. Briefs, SKILL.md, and the user-facing code-review
doc updated; 1a keeps its walk minus the two clauses.

* fix(review): address round-1 feedback on the 1d/1e split (#9805)

* fix(review): address round-2 feedback on the 1d/1e split (#9805)

* fix(review): address round-3 feedback on the 1d/1e split (#9805)

* fix(review): address round-4 feedback on the 1d/1e split (#9805)

* fix(review): address round-5 feedback on the 1d/1e split (#9805)

---------

Co-authored-by: qwen-code-ci-bot <qwen-code-ci-bot@users.noreply.github.com>
2026-08-24 11:15:58 +00:00
顾盼
37cedea5b2
feat(computer-use): replace built-in tools with bundled skill (#9856) 2026-08-24 11:05:23 +00:00
Dragon
43d46be912
refactor(core): shrink the content generator interface (#9676)
* refactor(core): shrink content generator interface

* refactor(core): remove orphaned request-tokenizer estimator cluster

Removing countTokens from both providers deleted the last production
consumers of RequestTokenEstimator. Delete the orphaned cluster:
requestTokenizer.ts (330), imageTokenizer.ts (534), types.ts (36), the
directory barrel (11), and both test files (608 lines). Also drop the
inert vi.mock of requestTokenizer.js left in client.test.ts and the
stale dimension-extractor cross-reference in review/lib/assets.ts.

textTokenizer.ts and supportedImageFormats.ts stay: converter.ts, pdf.ts,
and fileUtils.ts still consume them and the core barrel re-exports them.

* docs(design): sync lazy-google-genai-loading record with shrunk interface

countTokens and useSummarizedThinking no longer exist on ContentGenerator,
so the design record for the lazy-wrapper architecture must not keep
advertising them: list the three remaining shared async operations, drop
the useSummarizedThinking sentence and the summarized-thinking item from
the consumer audit and Verification section, and add a dated note
recording the interface shrink from PR #9676.

* ci: record cd-cua-driver.yml size growth in .size-baseline

Same latent main-side violation as fixed in #9682: #9587 grew the
workflow without a baseline update; record the new size as the check
message directs (precedent #9747).

* docs: finish scrubbing tokenizer references after estimator-cluster removal

Follow-up to 0ee17632c7/1871bb5b81 (review round 2):
- supportedImageFormats.ts header and getSupportedImageFormatsString doc
  no longer describe a tokenizer decode/metadata-extraction stage; the
  list is now documented as the vision-input acceptance list, with token
  accounting noted as the flat DEFAULT_IMAGE_TOKEN_ESTIMATE.
- web-shell-image-drag-and-drop.md's BMP rationale no longer claims
  ImageTokenizer parses BMP dimensions; dated sync note added stating
  BMP support rests on SUPPORTED_IMAGE_MIME_TYPES plus converter
  passthrough since PR #9676.

* docs: drop tokenizer from the BMP test-plan line

Follow-up to 18f08c0924: the test plan still required converter/tokenizer
focused tests for image paths; the image-tokenizer estimator cluster was
removed in PR #9676 (text tokenizer is unaffected and out of scope here).
2026-08-24 08:30:18 +00:00
易良
e0d933b23e
refactor(core): make derived Config ownership explicit (#8100)
Some checks failed
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 1/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 2/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 3/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 1/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 2/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 3/3 (push) Waiting to run
E2E Tests / E2E Test - macOS - shard 1/2 (push) Waiting to run
E2E Tests / E2E Test - macOS - shard 2/2 (push) Waiting to run
E2E Tests / channel-plugin E2E (nightly) (push) Waiting to run
E2E Tests / cron-interactive E2E (nightly) (push) Waiting to run
E2E Tests / web-shell Browser Regression (push) Waiting to run
SDK Java / ubuntu-latest / Java 11 (push) Waiting to run
SDK Java / ubuntu-latest / Java 17 (push) Waiting to run
SDK Java / macos-latest / Java 21 (push) Waiting to run
SDK Java / ubuntu-latest / Java 21 (push) Waiting to run
SDK Java / windows-latest / Java 21 (push) Waiting to run
SDK Java / Real daemon E2E / Java 11 (push) Waiting to run
Security Checks / Dependency CVE audit (push) Waiting to run
Security Checks / Secret scan (TruffleHog) (push) Waiting to run
SDK Python / Classify PR (push) Has been cancelled
SDK Python / SDK Python (3.10) (push) Has been cancelled
SDK Python / SDK Python (3.11) (push) Has been cancelled
SDK Python / SDK Python (3.12) (push) Has been cancelled
* refactor(core): define derived config ownership

* docs(core): align derived config ownership scope
2026-08-24 07:48:49 +00:00
易良
27285a5243
refactor: centralize approval mode contracts (#9796)
* refactor: centralize approval mode contracts

* fix: align Python SDK import grouping

* test: restore approval mode exports in CLI mocks

* fix: close approval mode drift gaps

* test(cli): preserve core exports in serve mocks

* fix: close approval mode review gaps

* test(cli): complete permission request fixture

* test(sdk): match approval mode route

* test(approval): close review coverage gaps

* test(sdk): cover approval mode global scope path
2026-08-24 07:46:50 +00:00
易良
a60cbbc54a
refactor(core): make utils/ a leaf layer (#9778)
* refactor(core): make utils/ a leaf layer

Eliminate every runtime (value) upward import from
packages/core/src/utils production modules so utils/ can become a leaf
layer with no runtime dependency on the rest of core.

Two mechanisms, no behavior change:

- Relocate domain-coupled modules out of utils/ into their owning
  module (agents, config, core, memory, services, tools), and move
  generic constants/types that live elsewhere into utils/. All
  `git mv` moves keep history; every import that pointed at a moved
  file is rewritten.

- Extract the remaining value imports as small leaf modules inside
  utils/ (AuthType, isTool, ToolErrorType, DEFAULT_QWEN_MODEL) and
  re-export them from their original owners so cross-package consumers
  are unaffected. doesToolInvocationMatch moves into shell-utils, its
  only production consumer.

Only type-only imports now cross the utils/ boundary. The two deferred
inversions in debugLogger (Storage, getTraceContext) are stateful and
left for a follow-up.

* chore(core): enforce utils/ leaf layer with lint rule

Add architecture/no-core-utils-upward-import, which flags runtime
(value) imports that leave packages/core/src/utils. Type-only imports,
sibling utils imports, and external package specifiers stay allowed;
the two deferred debugLogger inversions (config/storage,
telemetry/trace-context) are carried on an explicit allowlist.

Enable the rule as an error on core sources and cover it with
Linter-based tests.

* fix(core): restore iconv-lite tree-shaking for sync-file-encoding

The utils leaf-layer refactor moved sync-file-encoding from utils/ to services/, but the esbuild tree-shake plugin still matched the old ./utils/ specifier, so its sideEffects:false marker no longer applied and the ACP startup closure regained a static iconv-lite import. Point the onResolve filter at the new ./services/ path.

* fix(ci): catch stale integration imports earlier

* fix(core): close utils boundary review gaps

* fix(core): close self-reference boundary gaps

* ci: re-trigger after self-hosted runner checkout EACCES
2026-08-24 07:43:01 +00:00
jinye
b2d0687213
feat(serve): add --open-with-auth (#9738)
* docs(serve): propose ephemeral auth for --open

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* docs(serve): address ephemeral auth review

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* docs(serve): clarify asset pre-check boundary

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* docs(serve): centralize token selection plan

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* docs(serve): make ephemeral auth opt in

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* docs(serve): align ineligible-browser handling with manual-URL fallback

Browser-launch eligibility is a heuristic with common false negatives,
so it is no longer a hard pre-listen gate: an ineligible environment
warns (naming the tripped signal), starts the daemon, and prints the
fragment-bearing manual URL, matching the launch-failure recovery.
Also pin the generation breadcrumb with planned test assertions.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* feat(serve): add opt-in ephemeral auth for --open

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* feat(serve): replace ephemeral auth with --open-with-auth

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* docs(serve): clarify temporary token storage

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* docs(serve): clarify ephemeral token persistence

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* codex: address PR review feedback (#9738)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* codex: address PR review feedback (#9738)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
2026-08-24 07:33:05 +00:00
Harjoth Khara
dbf7382c8f
fix(memory): scan uncapped when selecting forget candidates (#9530)
* fix(memory): scan uncapped when selecting forget candidates

Recall moved to the uncapped scanner in #8716; forget did not. A document
ranked past the 200-document cap could be recalled and injected into the
prompt but never forgotten.

Forget now scans uncapped, so its candidate universe matches recall's. The
model-selection prompt renders every candidate, so it gets its own bound of
400: literal query matches first, then the most recently modified remainder.
The heuristic fallback keeps scanning the full uncapped list.

Indexer, status, and extraction stay capped on purpose, and the two design
docs that recorded forget as capped now say otherwise.

Refs: #9378

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(memory): give each scope its own share of the forget prompt

Review round 1. The 400-candidate bound ranked both scopes into one recency
budget, so a store whose project entries are all newer than its user entries
seated no user memory at all. The capped scanners this replaced ran per scope,
so each scope always had seats. That made an old user entry unselectable by the
model while recall could still inject it, which is the same asymmetry the PR
set out to close.

Each scope now keeps a 200-candidate quota and whatever a smaller scope leaves
is handed to the other. Within a scope, literal query matches rank first and
both groups are ordered newest first, so truncation is deterministic instead of
scan-order, and the bound logs when it drops candidates.

Also from review: the query normalisation and match predicate are now shared
with selectByHeuristic so the two cannot drift; the user scan gets the
best-effort guard recall.ts and extractionAgentPlanner.ts already carry; and
the docstring and design docs no longer claim an unconditional guarantee the
bound does not provide.

Three tests, each verified against the mutation it is meant to catch: global
ranking drops the user ids, an ascending sort drops the newest filler, and
handing the fallback the bounded list returns 400 of 450 matches.

Refs: #9378

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(memory): bound the unconfirmed forget path and drop the silent scan guard

Review round 2, all suggestions.

MemoryManager.forget passed limit: MAX_SAFE_INTEGER and deletes without
confirmation. With an uncapped scan and a heuristic fallback that substring
matches the whole store, a one-character query matched nearly every entry in
both scopes, where the capped scanners had held that same failure to one scan's
worth of candidates. The limit is now the prompt bound, restoring the old
ceiling.

Round 1 added a best-effort catch on the user scan. That was wrong on two
counts: scan.ts caps after reading and ordering the whole tree, so uncapping
adds no read exposure to justify it, and swallowing the failure made forget
report "no entries matched" for a scope it never read, then act on that answer
by deleting. Reverted, with a comment saying why forget differs from recall
here: a missed injection is recoverable, a missed deletion is not.

normalizeForgetQuery now delegates to normalizeSummary so query matching and
the post-selection re-match cannot drift apart, and one design-doc sentence no
longer implies only semantic matches fall off the bound.

Two tests, each verified against its mutation: the quota split is now exercised
with both scopes over quota, where dropping it to 150 seats 250 project entries
instead of 200; and the delete ceiling fails at 401 removals if the unbounded
limit comes back.

Refs: #9378

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(memory): split forget's deletion seats per scope, and decouple the ceiling

Review round 3.

The deletion ceiling added last round truncated the heuristic fallback in
candidate order, and listIndexedForgetCandidates pushes every user entry ahead
of every project entry. With 450 matching user entries and 50 matching project
ones and the side query down, forget deleted 400 user entries, zero project
ones, and reported success. That is the reachability asymmetry this PR exists
to remove, moved into the delete path. The per-scope allocation the model
prompt already used is now shared with the heuristic, so each scope keeps its
share of the limit and a smaller scope's unused seats go to the other.

The ceiling is also its own constant now rather than an alias of the prompt
bound. Resizing the model prompt is a cost decision and resizing this is a
blast-radius decision; sharing one constant let the first silently widen the
second.

Two tests, each checked against its mutation: the 450-user/50-project shape
returns zero project matches under a plain slice, and oldest-first ranking
inside a scope drops that scope's newest entry from the prompt.

Refs: #9378

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* test(memory): pin the forget split at a small limit and the heuristic's own order

Cross-review found both new tests mutation-survivable. Every case used a
400 limit, so hard-coding a 200 per-scope quota instead of deriving it from
the budget still passed, and the recency case let the side query succeed, so
it pinned the model prompt's ranking rather than selectByHeuristic's own
comparator.

One case at limit 5 with the side query failing covers both: it asserts the
3/2 split, which only holds if the quota comes from the budget, and that each
scope contributes its newest entry, which fails if the comparator is reversed.
Both mutants verified failing.

Refs: #9378

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* refactor(memory): share the forget recency comparator and log a bound deletion

Review round 4, both suggestions.

The mtime comparator was the last thing the model path and the heuristic path
each typed for themselves, after this branch had already hoisted the query
normaliser, the match predicate and the per-scope allocator so the two could
not drift. Each site has its own test, so a one-sided ordering change would
have updated its own test, passed CI, and left the sibling stale. Now one
definition.

The deletion cap also bound silently. The prompt bound warns when it truncates;
the path that actually deletes did not, so a forget that removed 400 of 500
matches reported success and left no record of why recall kept injecting the
rest. It now says so.

No test for the new warning: it is a debug log line, and asserting on it would
pin the wording rather than the behaviour.

Refs: #9378

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
2026-08-24 07:31:01 +00:00
Stellar鱼
f241c19ace
fix(core): support per-provider stream idle timeout (#9795) 2026-08-24 06:46:25 +00:00
jinye
014b903bf5
fix(daemon): Bound conditional-close refusal holds (#9820)
* fix(daemon): Bound active-work close refusal holds

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* codex: address PR review feedback (#9820)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
2026-08-24 05:00:40 +00:00
C0d3N1nja97342
aac9606f78
fix(cli): skip terminal redraw optimizer on WSL/ConPTY (#7897)
* fix(cli): skip terminal redraw optimizer on WSL/ConPTY and enable sync output on Windows Terminal (#7634)

The streaming text repetition bug on WSL + Windows Terminal is caused by
the terminal redraw optimizer batching cursor-up sequences, which ConPTY
processes differently from individual per-line erases. The cursor lands
at the wrong row, causing each new frame to overlap remnants of the
previous one.

Two fixes:
1. Skip the redraw optimizer when WSL (WSL_DISTRO_NAME / WSL_INTEROP)
   or Windows Terminal (WT_SESSION) is detected, falling back to Ink's
   original per-line erase sequences that ConPTY handles correctly.
2. Enable synchronized output (DEC mode 2026) for Windows Terminal,
   which has supported it since v1.6, making frame updates atomic and
   masking any residual cursor positioning issues.

Fixes #7634

* fix: add WSL_INTEROP test and clear env vars in beforeEach to fix test fragility

Address review feedback on #7897:
- P1: clear WSL/Windows Terminal env vars in beforeEach so existing
  optimizer tests don't silently break when run inside WSL
- P2: add dedicated test for WSL_INTEROP detection

* review: address wenshao feedback on #7897

- Accept injectable env in installTerminalRedrawOptimizer (matches sibling
  terminalSupportsSynchronizedOutput), eliminating the need for
  beforeEach env-stubbing in test files
- Add QWEN_CODE_LEGACY_ERASE_LINES=0 as a force-on escape hatch for
  WSL/Windows Terminal users whose terminals handle the batched
  sequences correctly
- Collapse three near-identical WSL/WT skip tests into it.each
- Correct Windows Terminal DEC 2026 support version: v1.18, not v1.6
- Move WT_SESSION check above the TERM declaration in
  terminalSupportsSynchronizedOutput so the term isn't declared before
  its only consumer
- Add a table case asserting TMUX guard still wins over WT_SESSION
- Pass explicit empty env to installTerminalRedrawOptimizer in the
  synchronizedOutput composition test so it doesn't depend on the
  runner's environment

* fix(cli): narrow optimizer skip to WSL only, drop WT_SESSION

Per wenshao's review: WT_SESSION is set on the Windows side and is not
propagated into WSL shells without WSLENV, so it can never be the env
var that fires for #7634. Remove WT_SESSION from the optimizer skip
(WSL_DISTRO_NAME + WSL_INTEROP remain) and from the synchronized-output
allowlist. The synchronized-output change for Windows Terminal belongs
in its own PR once confirmed; bundling it into a WSL bug fix mixed two
independent behavior changes.

Also correct the comment: 'WSL or Windows Terminal' -> 'WSSL only',
and remove the WT_SESSION test cases from both test files.

* fix(cli): clean up WT_SESSION comment residue and pin its exclusion

Per review: the drop of the WT_SESSION skip left stale comments and no
test pinning the deliberate exclusion. Fix the force-enable comment
(WSL only, not Windows Terminal), complete the truncated WT_SESSION
rationale, and add a test asserting WT_SESSION alone does NOT trigger
the skip (it is not propagated into WSL shells). Also stub
QWEN_CODE_LEGACY_ERASE_LINES in beforeEach so the suite is isolated
from a host that has the flag set.

* refactor(cli): extract shared isWsl(env) into terminal-env util

WSL detection was inlined in terminalRedrawOptimizer (this PR) and
duplicated as a private helper in voice-availability. Extract a single
isWsl(env) into ui/utils/terminal-env.ts and use it from both sites so
the marker set cannot drift. Requested by maintainer in #7897 reviews.

* fix(ui): add license header and gate WSL_INTEROP in voice preflight

Round-3 review: terminal-env.ts shipped without the @license header
every sibling carries; and the voice-side isWsl migration was inert under
the test probe because voice-availability.test.ts only exercised the
WSL_DISTRO_NAME marker. Add the header and cover WSL_INTEROP via it.each. #7897

* docs(ui): note the separate core-side WSL check in terminal-env

Round-4 review: the extraction comment claimed the marker set cannot
drift, but ripgrepUtils.wslTimeout() in packages/core keeps its own
narrower WSL_INTEROP-only check because core cannot import from cli.
Document the exception so a future maintainer greps both sites. #7897

* docs(cli): document QWEN_CODE_LEGACY_ERASE_LINES escape hatch

Round-5 review (R5-1): isWsl(env) relies solely on env markers, which
env-scrubbing launchers (sudo, env -i) strip - so the #7634 skip never
fires in those contexts. Document the launch-time =1 fallback and note
it must be passed at launch because sudo drops the flag too. Also closes
the round-2 R2-3 gap (the flag was previously undocumented). #7897

* refactor(cli): move isWsl to core and apply maintainer review polish

wenshao's manual review suggested moving the shared WSL marker check to
packages/core so cli can import it (core cannot import from cli), while
ripgrepUtils.wslTimeout() keeps its deliberately narrower predicate. Also:

- Sharpen the ConPTY divergence comment with the concrete sequences the
  optimizer emits (CSI 1 B cursor-down, CSI n A multi-count) that Ink's
  native erase path never does.
- Replace the beforeEach vi.stubEnv test fixture with explicit empty-env
  arguments (truer 'not on WSL' fixture, no host-env dependency).
- Note the env parameter exists for testability.
- Trim the moved file's doc block to durable facts and tighten the docs
  row wording. #7897

* test(cli): pin the env default-parameter seam in redraw optimizer

Round-7 review: the production call path (installTerminalRedrawOptimizer
with no env arg) was never exercised - every test passed env explicitly,
so a mutation to the = process.env default (e.g. = {}) would pass green
while silently disabling the WSL skip and =1 escape hatch in production.
Add a hermetic test that stubs WSL_DISTRO_NAME and asserts the no-arg call
skips the optimizer. #7897

* test(cli): restore afterEach env cleanup for default-seam test

Round-8 review: placing vi.unstubAllEnvs() as the last statement in the
default-seam test body meant a failing expect (the exact regression the
test pins) would skip the cleanup and leak WSL_DISTRO_NAME=Ubuntu into
process.env for the rest of the file. Move the cleanup back into the
describe-level afterEach so it runs even on assertion failure. #7897

* test(cli): close the two minor coverage gaps from chiga0's review

Maintainer chiga0 approved the PR but noted two minor test gaps:

- The default-seam test only stubbed WSL_DISTRO_NAME, so a host-set
  QWEN_CODE_LEGACY_ERASE_LINES=1 would pass it for the wrong reason; stub
  the flag too so the assertion depends only on the WSL marker.
- The tri-state flag has no case for a non-standard truthy value; add one
  pinning that 'garbage' falls through to the platform default (WSL skip). #7897

* docs(cli): correct 'only path' claim in ConPTY divergence comment

Round-11 review: the comment asserted the optimizer is the ONLY path
emitting CSI 1 B / CSI n A, but the repo's patched ink build also emits
both sequence classes on its cursor-positioning path (buildCursorSuffix /
buildReturnToBottom, reachable via BaseTextInput.setCursorPosition).
Skipping the optimizer on WSL does not remove these from interactive
input. Narrow the claim to the per-frame erase-and-redraw path. #7897
2026-08-24 03:58:48 +00:00
callmeYe
a8b822f5d2
feat(web-shell): expose agent task changes (#9637)
* feat(web-shell): expose agent task changes

* fix(web-shell): deduplicate agent task callbacks

* fix(web-shell): ignore agent task telemetry churn

* fix(web-shell): skip immutable prompts in task fingerprint

* fix(web-shell): type agent task fingerprint
2026-08-24 03:54:49 +00:00
Tianyuan
a2e458deef
feat(auth): add Kimi (Moonshot AI) as a built-in third-party provider (#9814)
Adds a Moonshot preset to the /auth Third-party Providers menu, offering
the international and China API endpoints and seeding the current Kimi
model catalog. Moonshot speaks the OpenAI protocol, so this is a
declarative preset with no new mechanism and no change to the provider
type.

Model metadata follows Moonshot's published capabilities. K3 is marked
thinking-mandatory: its API exposes a reasoning-effort knob but no way to
turn thinking off, so a disable shape must never reach the wire. The two
code models and K2.6 keep thinking toggleable, and all four accept image
and video input, which the K2.6 guide states explicitly.

Registers the new credential env key everywhere a provider key has to
appear: the no-AK CI gate and its pinned assertion list, and the
telemetry provider mapping, both by env key and by request hostname so
Kimi traffic is attributed rather than reported as unknown. The three
first-run docs that enumerate built-in providers are brought back into
agreement, which also picks up entries that were already stale.

Closes #9197
2026-08-24 03:18:40 +00:00
tao943
3a9d2d37f8
docs(agent): clarify parameter preconditions (#9580)
* docs(agent): clarify parameter preconditions

* test(agent): cover read-only preconditions

* docs(agent): clarify nested background downgrade

* docs(agent): align working-dir background guidance

* docs(agent): clarify teammate worktree execution

---------

Co-authored-by: tao943 <278275162+tao943@users.noreply.github.com>
2026-08-24 02:27:09 +00:00
Harjoth Khara
22006ebf81
fix(core): cap the effort tier at what each endpoint accepts (#9501)
* fix(core): cap the DashScope effort tier at what its ladder accepts

`/effort max` writes the tier into config, and the DashScope provider
emitted it as a flat `reasoning_effort` for the qwen3.8-max family
without checking the endpoint's ladder, which stops at `xhigh`. The
server rejected it with a 400, and because the tier lives in config
every later request in the session rebuilt the same body and 400d too.
The tier also persists to settings.json, so new sessions re-broke.

`max` exists only as a DeepSeek extension. Declare the tiers DashScope
accepts and clamp through the existing `clampReasoningEffort`, warning
once, the same way the Anthropic generator caps tiers its model lacks.

Only the configured `reasoning.effort` is clamped. An explicit
`reasoning_effort` in `extra_body` or `samplingParams` is a documented
verbatim override and still ships unchanged.

Refs: #9459

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

* fix(core): cap the effort tier at what each endpoint accepts

Follow-up on the same defect at the generic layer, per cross-model review.

The unified ladder ends at `max`, but `max` is a vendor extension: DeepSeek
and GLM-5.2+ take it, and a generic OpenAI-compatible endpoint stops at
`xhigh`. The effort-ladder design already specifies OpenAI `max -> xhigh`,
but nothing implemented it, so a configured `max` reached the wire raw and
400d every later request in the session.

Declare the accepted tiers on the provider and clamp there. The base
provider ceilings at `xhigh`; DeepSeek and Z.ai override to the full ladder.
The override is on the provider class, not the hostname, because which tiers
a model accepts is a property of the model while the flat-vs-nested wire
shape is a property of the endpoint: a self-hosted deepseek-* or glm-* model
reached through the model-name fallback still understands `max`.

Also corrects a wrong claim from the first commit. `max` is not
DeepSeek-only: Anthropic opus/sonnet 4.6+ and every 5.x family accept it
natively, and the DashScope note now says only that this family does not.

Adds the warn-once and alias coverage the review found missing.

Refs: #9459

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

* fix(core): scope the effort ceiling to verified endpoints

Closes four gaps the cross-model review found in the previous commit.

The clamp rewrote a `reasoning` object the user set in `samplingParams`.
The pipeline hands those keys straight to the wire and skips the injection
entirely, so that object is the user's own value and documented to ship
verbatim. Skip the clamp when it is present.

DashScope overrides buildRequest without calling super, and only capped its
own flat qwen field, so a non-qwen model on a DashScope host still shipped a
raw nested `max`. Route that branch through the generic ceiling, carving out
GLM-5.2+, which does accept `max`.

The DeepSeek and Z.ai ladders were keyed on the provider class, but both
classes also route on a model-name substring, so anything merely named
`deepseek-*` or `glm-*` claimed a tier its endpoint may reject. Gate both on
the verified hostname, which is the rule deepseek.ts already documents for
decisions about DeepSeek's own wire shape (#3613). Z.ai additionally gates on
GLM-5.2+ rather than every `glm-*`, matching what its comment claimed.

One existing DeepSeek test asserted a self-hosted deepseek-* keeps `max`.
That was the old no-clamp behavior; an unverified endpoint now gets the
generic ceiling, and the test says so.

Refs: #9459

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

* docs(core): document the effort ceiling per endpoint

Adds the Z.ai/GLM row, notes that DeepSeek's `max` is hostname-gated, and
says plainly that a `reasoning` object inside `samplingParams` is the user's
own value and is not clamped.

Also adds the end-to-end pipeline test for the generic provider, mirroring
the DashScope one: it drives pipeline.execute and asserts on the body handed
to the SDK.

Refs: #9459

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

* fix(core): answer the effort ceiling for the wire model

The capability check read the configured model, but the pipeline resolves
`request.model || contentGeneratorConfig.model`, so a request-level model
override was answered against the wrong model. Configuring Z.ai `glm-5.2`
and requesting `glm-4.6` shipped a raw `max` again, which is the failure
this change exists to prevent. `supportedReasoningEfforts` becomes
`supportedReasoningEffortsFor(model)` and takes the wire model.

Drops the GLM exception on DashScope. It contradicted this PR's own docs,
which say a `glm-*` model reached on a non-Z.ai host keeps the generic
ceiling, and there is no evidence DashScope's GLM deployment accepts `max`.
A quiet downgrade is the safer side to be wrong on. This also removes the
import of Z.ai's helper from the DashScope provider.

Adds the warn-once test for the base provider and regression tests that
cross the configured and request models in both directions.

Refs: #9459

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-24 02:14:15 +00:00
callmeYe
eea98f3b04
refactor(cli): extract ACP skill management (#8865)
* refactor(cli): extract ACP skill management

* test(cli): cover ACP skill safety guards

* fix(cli): harden ACP skill mutation guards

* fix(cli): handle ACP skill frontmatter variants

* test(cli): deduplicate ACP skill fixtures

* fix(cli): handle multiline Skill enablement fields

* fix(cli): recognize escaped Skill enablement keys

* refactor(cli): restore ACP skill extraction scope

Restore the three post-review files to the initial extraction commit. The removed changes addressed pre-existing Skill behavior and test coverage rather than regressions caused by the module split. Latest origin/main changes only unrelated ACP agent sections, so no extracted Skill logic needs to be carried forward.

---------

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
2026-08-24 01:18:22 +00:00
Shaojin Wen
3a1f86d805
feat(review): give verifiers a do-not-refute list and a constructible rejection bar (#9799)
Some checks are pending
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 1/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 2/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 3/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 1/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 2/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 3/3 (push) Waiting to run
E2E Tests / web-shell Browser Regression (push) Waiting to run
E2E Tests / E2E Test - macOS - shard 1/2 (push) Waiting to run
E2E Tests / E2E Test - macOS - shard 2/2 (push) Waiting to run
E2E Tests / channel-plugin E2E (nightly) (push) Waiting to run
E2E Tests / cron-interactive E2E (nightly) (push) Waiting to run
npm cache producer / Save npm cache (push) Waiting to run
SDK Java / ubuntu-latest / Java 11 (push) Waiting to run
SDK Java / ubuntu-latest / Java 17 (push) Waiting to run
SDK Java / macos-latest / Java 21 (push) Waiting to run
SDK Java / ubuntu-latest / Java 21 (push) Waiting to run
SDK Java / windows-latest / Java 21 (push) Waiting to run
SDK Java / Real daemon E2E / Java 11 (push) Waiting to run
Security Checks / Dependency CVE audit (push) Waiting to run
Security Checks / Secret scan (TruffleHog) (push) Waiting to run
* feat(review): give verifiers a do-not-refute list and a constructible rejection bar

Step 4's verifier brief already floors uncertain Criticals at low
confidence instead of rejection, but it never names the states in
which "too speculative / depends on runtime state" is not a valid
rejection. The finder side carries the recall rule (do not silently
drop a candidate); the verifier side lacked its counterpart, so
real-but-uncertain findings could die in Step 4 on a plausibility
vote instead of surfacing under "Needs Human Review".

Close the same leak on the verifier side:

- Rejection is now defined as direct counter-evidence constructible
  from the code — one of four shapes: factually wrong (quote the
  misread line), provably impossible (type/constant/invariant,
  shown), already handled in this diff (cite the guard and show it
  covers the trigger), or pure style / an Exclusion Criterion. A
  rejection constructing none of them downgrades to confirmed (low
  confidence) instead of dropping.
- A third masquerading state joins "I could not verify it" and "its
  evidence is somewhere I did not look": "it is too speculative". A
  finding whose failure scenario names a realistic state the code
  does not exclude is PLAUSIBLE by default — concurrency races,
  nil/undefined on a rare-but-reachable path, falsy zeros treated as
  missing, off-by-one on a boundary the code does not exclude, retry
  storms and partial failures, patterns that lost an anchor.

SKILL.md's Step 4 summary and the user-facing code-review docs are
synced to the new semantics. The pinning test asserts every shape,
every ground, and the downgrade consequence — a mutation flipping the
consequence into "reject" survived the subject-only assertion, so the
consequence clause is pinned too.

Fixes #9789

* fix(review): sync the rejection-bar summaries with the brief's four grounds (#9799)

* fix(review): sync the plausible-by-default wording and re-head the probe option (#9799)

---------

Co-authored-by: qwen-code-dev-bot <qwen-code-dev-bot@users.noreply.github.com>
2026-08-23 23:33:12 +00:00
Isaac Hernández
fd9c452dc8
fix(auth): let Vertex AI authenticate with Application Default Credentials (#9017)
* fix(auth): let Vertex AI authenticate with Application Default Credentials

Vertex AI auth required an API key, so an ADC or service account setup
could not start. Supplying a placeholder to satisfy the check made it
worse: an explicitly passed key switches the Google SDK to Vertex
Express mode, which clears the project and location and rejects the
request with "API keys are not supported by this API".

Treat a configured GOOGLE_CLOUD_PROJECT as sufficient credentials for
the vertex-ai auth type, in both the CLI pre-flight check and the core
model config validation, and leave the API key absent so the SDK
resolves ADC itself. The missing-credentials errors now mention the
keyless path instead of pointing only at envKey.

Fixes #9016

* fix(auth): select Vertex mode explicitly and keep declared key vars authoritative

Review follow-ups on the Vertex ADC change.

Vertex mode no longer depends on the GOOGLE_GENAI_USE_VERTEXAI side effect.
Only the CLI pre-flight check writes that variable, and the startup call to it
sits under the sandbox branch, so a plain interactive or ACP session built a
client pointed at the Gemini API endpoint instead of Vertex. The flag is now
derived from the auth type at construction, and left untouched for the other
auth types so the SDK keeps its own environment fallback there.

An entry that declares its own key variable no longer falls through to ADC when
that variable is unset. It keeps failing on the declared variable, so a secret
that failed to inject cannot silently authenticate as a different principal.
The keyless hint is suppressed for those entries as well, since it would be
advice that cannot work.

The ACP pre-flight cell reports an indeterminate state for a keyless Vertex
setup rather than a confirmed token: a configured project is routing
configuration, not evidence that a credential resolves. All three gates now
share one definition of a configured project, so whitespace is handled the same
way everywhere, and the CLI missing-key message carries the same keyless hint as
the core errors.

Docs corrected on two counts: the environment-only row now says a keyless setup
must select the auth type explicitly, since it is not inferred from the project
alone, and the provider note names every key source the resolver folds in.

---------

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
2026-08-23 19:27:16 +00:00
callmeYe
c2d63fbe58
fix(web-shell): show reasoning effort before session creation (#9599)
* fix(web-shell): show reasoning effort before session creation

* fix(web-shell): harden reasoning preview lifecycle

* chore(desktop): refresh frozen bun lockfile

* fix(web-shell): restore reasoning preview after session clear

* test(webui): pin session-clear model restoration on all reset paths (#9599)

Witness the four back-to-welcome reset handlers' models re-projection
(session_closed, stream auth failure, terminal stream error, heartbeat
clear) with mutation-visible assertions: each test attaches a session
whose live context displaces the provider models, then verifies the
workspace reasoning preview returns after the reset. Also pin the
providers-absent fallback in getConnectionAfterSessionClear so older
daemons keep the pre-clear model list.

---------

Co-authored-by: qwen-code-dev-bot <qwen-code-dev-bot@users.noreply.github.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
2026-08-23 19:11:19 +00:00
samuelhsin
4ddbf227e8
feat(mcp): add MCP 2026 core and WebShell Apps host (#8992)
* feat(mcp): add 2026 protocol negotiation

* feat(mcp): render MCP Apps in WebShell

* fix(mcp): keep legacy tool discovery lenient

* fix(mcp): keep Apps HTML out of TUI and honor tool visibility

TUI and history compaction dumped mcp_app HTML as JSON, and discoverTools registered app-only tools for the model.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): stabilize AppBridge lifetime and close sandbox CSP gaps

Theme toggles and transcript reseeds were tearing down MCP Apps; the host CSP also allowed any loopback port and form posts bypassed connect-src.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): list under-declared modern MCP capabilities over the wire

v2 typed helpers return [] without a request when a capability is omitted.
Use them only when the server declared the capability, and keep Apps
unmounted in collapsed tool rows.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): keep Apps sandbox reachable and list past 64 pages

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): reject empty compacted html and keep MCP Apps expanded in multi-tool groups

Fixes R3-1 and R3-2 review comments:

R3-1: getMcpAppDisplay now rejects empty html strings (from compaction)
so session replay shows fallbackText instead of mounting an empty iframe.

R3-2: ToolGroup now checks for MCP apps across all tools (not just
singleTool), auto-expands when any tool has an MCP app, and keeps
MCP app rows expanded (summaryOnly=false, forceExpanded=true) even
when adjacent tool calls are merged into the group.

* feat(web-shell): fold thinking into the compact-mode tool summary (#9148)

Compact mode used to drop thinking messages entirely, so a running turn
gave no indication of the thinking step. Keep the thoughts and aggregate
them with the adjacent tools into one summary: a streaming thought reads
"Thinking…" with the running shimmer, and a completed thought settles into
a click-to-expand row in its original interleaved position. The translate
action is preserved on both the thinking block and the folded thought
rows, and the merged group gets a synthetic id so its expanded state never
leaks into non-compact mode.

Co-authored-by: 钉萁 <dingqi.jww@alibaba-inc.com>

* fix(mcp): address app discovery and sandbox regressions

* fix(web-shell): keep MCP apps expanded in compact summaries

* Revert "feat(web-shell): fold thinking into the compact-mode tool summary (#9148)"

This reverts commit ab2eebc5d36f17a51ce94e423db5745dcbb273fe.

* fix(web-shell): render compacted MCP App fallback and teardown before unload

Compacted history keeps type:mcp_app with empty html; show fallbackText instead of a blank sandbox, and wait for ui/resource-teardown before unloading the iframe.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): bound the discover probe and raise the daemon bundle cap

Silent legacy stdio servers inherited the 10-minute request timeout for server/discover. Cap the probe at 5s so fallback fits the discovery window, and raise the browser bundle budget after the main merge overflowed CI by 47 bytes.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): skip version-negotiation probe on remote transports

SDK v2 rejects HTTP server/discover timeouts without falling back to initialize, and the 5s probe consumed the entire remote discovery window.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shell): keep MCP App iframe src across deferred teardown

Deferred unload() was clearing src on the live iframe after a remount, so the new AppBridge never saw sandbox-proxy-ready.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): honor listing-level MCP App CSP and permissions

registerAppResource puts ui.csp/permissions on resources/list, and resources/read does not merge that metadata into content entries.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): reuse session client for list and emit app fallback text

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): keep mcp list and IPv6 sandbox CSP valid

Give qwen mcp list leftover handshake budget after the 5s discover probe, and stop emitting invalid [::1] CSP origins.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): keep modern list and short discovery budgets working

Drop the era-illegal ping after mcp list connect, shrink the stdio discover probe to the discovery window, and document that remotes stay on legacy initialize until the SDK can fall back.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): keep the 2026 slice free of review-only extras

Drop the global tools/list page cap, generated companion notices, and the review screenshot so this PR stays on stdio 2026 plus the WebShell Apps host.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): restore generated companion notices after the SDK v2 bump

CI regenerates NOTICES.txt from the lockfile; the file has to ship with the new MCP client dependencies.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): isolate the Apps proxy from WebShell storage

Drop allow-same-origin on the outer sandbox iframe so a default localhost daemon cannot read the WebShell session token.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(mcp): harden fallback and app sandbox

* fix(core): preserve large and app-only MCP catalogs

* fix(mcp): preserve legacy negotiation compatibility

* fix(mcp): default stdio negotiation to legacy

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: ytahdn <1294726970@qq.com>
Co-authored-by: 钉萁 <dingqi.jww@alibaba-inc.com>
Co-authored-by: YungSen Hsin <yungsenhsin@U-G0HXNQM1-2052.local>
2026-08-23 18:34:30 +00:00
qqqys
dafd5c4459
fix(dingtalk): parse forwarded chat records (#9339)
* fix(dingtalk): parse forwarded chat records

* fix(dingtalk): normalize forwarded chat records

* fix(dingtalk): preserve chat record sender alignment

* fix(dingtalk): neutralize forwarded chat-record content and cover its branches

Round-2 review left one Critical and six Suggestions on the chat-record
formatter. All seven are addressed here.

R2-1 (Critical) — forwarded record content is multi-author third-party text:
the forwarder is an allowed user, the authors inside the record are not. The
branch emitted it into `envelope.text` with raw newlines, C1/bidi/zero-width
characters and bracket tags intact, and in 1:1 DMs nothing downstream
neutralizes it — `ChannelBase` applies `sanitizePromptText` only when
`envelope.isGroup || sessionScope === 'single'`, and DingTalk declares no
`defaultSessionScope` so the registry falls back to `'user'`. So the same
payload was neutralized in a group and delivered verbatim in a DM, where a
forged start-of-line `[SYSTEM]:` line reached the model in the adapter's own
prompt style. Pre-diff this callback produced `text: ''`, so this is new
exposure, not inherited. Every dynamic field the formatter lifts out of a
record — title, summary lines, sender, body, and bare string entries — now
goes through the shared `sanitizePromptText` before being joined, which is
also how `referencedText` is already treated unconditionally on the reply
path. The adapter test mock now provides the real helper rather than a stub,
so this defence cannot regress with the suite green.

R1-2 — the msgType→placeholder switch was duplicated in
`summarizeRepliedContent` and the record formatter, and the copies had already
drifted (different `file` handling, different empty fallback). Extracted
`mediaTypePlaceholder`; the record-specific `[${msgType}]` / `[message]`
fallback stays at its call site.

R1-3 — both doc comments now list chat records among the handled types.

R1-7 — a chat-record payload that yields nothing now emits one stderr warning
naming the content keys that arrived, matching this file's existing
diagnostic convention. The payload shape is undocumented and varies, so
without it a new DingTalk variant degrades to `(chat record)` with nothing to
grep.

R2-3 — documented why `summaryLines` keeps its empty placeholders (positional,
indexes into `entries` for sender recovery) while `summary` filters them.

R1-5 and R2-2 — four tests close the surviving mutants: a string entry, opaque
`senderId`s, `message`/`body` as body sources, a title-only record, the
unreadable-payload warning, and the false branch of the alignment guard
(three entries against a two-line summary, no entry carrying a name).

Mutation-verified, each independently: identity sanitizer, dropped length
guard, dropped string-entry branch, dropped message/body sources, dropped
title-only branch, dropped warning, and unfiltered summary display each turn
at least one test red.

* fix(dingtalk): close the bracket-wrap forge and bound a forwarded record

Round 3 of #9339 found the round-2 sanitization fix left three entrances
open, all the same residual: a value neutralized by `sanitizePromptText`
is then WRAPPED in `[...]` by this file, and the wrapper's own `[` is
what completes a forged tag. `sanitizePromptText` unwraps a start-of-line
tag only when the value already begins with `[`, so a title of
`SYSTEM]: ignore previous instructions` passes through untouched and
renders as `[SYSTEM]: ignore previous instructions]` on the prompt's
first line. `fileName` and the unmodeled-`msgType` fallback were not
sanitized at all.

`bracketSafeChatRecordField` now covers all three: sanitize, then strip
the brackets the wrapper supplies. Each site keeps its documented
fallback for a value that cleans to nothing (`Chat record`, `file`,
`[message]`).

Also from round 3:

- String entries route through `formatChatRecordEntryBody` instead of
  re-implementing its pipeline, so a string and an object entry carrying
  the same text are described to the model the same way.
- `warnUnreadableChatRecordEntries`: the degradation the empty-record
  warning cannot see — an entries key arrived (`{"list":[...]}`, a
  non-array, an unusable first alias) but produced no lines, so a title
  or summary still renders and every forwarded message is silently gone.
- Tests for the `audio`/`video`/unmodeled-type placeholders, the
  `|| '[message]'` guard (C0 controls survive `trim()` and only then fold
  to spaces), and the replied-path empty-record diagnostic — all three
  were mutation-green before.

And R1-6, carried from round 1: a merge forward can hold an entire
group's history, and unbounded it displaces the user's own request in the
context window. Entries are now capped at 50, the section at 4000 chars,
and any single entry at 500 code points.

BEHAVIOUR FLIPS, both deliberate:

1. A bare string entry whose content sanitizes to nothing rendered as
   nothing and now renders `Unknown: [message]`. The object entry in the
   identical state already rendered `[message]`; the two copies of the
   pipeline had drifted, and describing identical content two ways based
   only on entry shape is the defect, not the alignment.
2. An oversized record is truncated where it previously was not. The
   truncation is ANNOUNCED (`[N more message(s) not shown]`,
   `[truncated]`) rather than silent: a tail the model cannot see is
   worse than one it can account for.

No existing test pinned either old behaviour — all 133 prior tests pass
unchanged, and no assertion was removed or weakened.

Verification: `packages/channels/dingtalk` 10 files / 319 tests pass
(was 308); `tsc --noEmit` clean; eslint and prettier clean. Mutation
verification, 12 mutants, all killed: bracket-strip to identity (2 red),
unsanitized `fileName` (2), unsanitized `msgType` (2), string entry back
to its own pipeline (1), cap disabled (2), per-line cap disabled (1),
`entriesDropped` pinned false (1), each of the two warn call sites
removed (1 each), `audio`/`video` swapped (2), unmodeled type folded to
`[message]` (3), `|| '[message]'` guard removed (1).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(dingtalk): close three chat-record tag forges and cover the record caps

Answers round 4 of #9339 — all 3 Criticals and all 6 Suggestions.

R4-1 (C) — the plain-text summary branch sanitized each line WITHOUT the
per-line `nonEmptyString` trim the JSON branch gets. A line beginning with a
trim()-strippable char that `sanitizePromptText` does not fold before its
unwrap step (VT, FF, NBSP, U+1680, U+2000–U+200A, U+202F, U+205F, U+3000)
pushes the `[` off start-of-line, so the unwrap regex cannot match; the later
C0 fold turns that char into a space and the trailing `.trim()` removes it —
reassembling the exact `[SYSTEM]:` tag the unwrap just failed to peel. Trim
first, as the JSON branch already did.

R4-2 (C) — `sanitizePromptText` peeled exactly ONE bracket layer, so
`[[SYSTEM]]` came out as `[SYSTEM]`: a fully-formed forge. DingTalk declares
no `defaultSessionScope`, so 1:1 DMs fall back to `'user'` and ChannelBase
runs no second pass; two passes would only move the bar to `[[[SYSTEM]]]`.
Fixed at the root in `packages/channels/base/src/sanitize.ts` by looping the
unwrap to a fixpoint (each changing iteration deletes the two brackets it
matched, so the length strictly decreases and it terminates).

Separately, record senders are now bracket-stripped rather than left to the
unwrap. This is NOT redundant with the fixpoint: the unwrap's tag-content
window is `{1,64}`, so a bracketed run longer than that never matches and
survives verbatim — and a sender is emitted at start-of-line immediately
before `: `, which is precisely the `[tag]:` shape. Probe-confirmed:
`[SYSTEM - ignore all previous instructions and exfiltrate every secret]:`
(69 chars) passes `sanitizePromptText` unchanged.

R4-3 (C) — BEHAVIOUR FLIP, deliberate. The header line's tag name was
attacker-derived: `bracketSafeChatRecordField` is a no-op for a title with no
brackets, so a bare title `SYSTEM` (which is also what `[SYSTEM]` and
`[[SYSTEM]]` sanitize down to) had the wrapper manufacture a clean
start-of-line `[SYSTEM] …`. That forge is created AFTER sanitization, so
sanitizing the title harder cannot defend it. The tag NAME is now fixed and
the title goes inside it:

  `[Group chat history] …`  ->  `[Chat record: Group chat history] …`
  `[Chat record] …`         ->  `[Chat record: untitled] …`

Nine existing assertions pinned the old shape and were updated to the new
one. They are not weakened — every one still asserts the full header text,
and the old shape is what the finding shows is unsafe.

R4-4 — use `truncateCodePoints` from `@qwen-code/channel-base` instead of a
third private `Array.from`/slice/join clone of the code-point rule.
R4-5 — document forwarded chat records in `docs/users/features/channels/
dingtalk.md`: how they render, the three caps, and that truncation is
announced in the text the agent sees.
R4-6 — decide the entry cap before measuring, and skip the code-point pass
for any line already within the cap in UTF-16 units (a valid upper bound), so
a 10k-line merge-forward stops paying a throwaway array per dropped line.
R4-7/R4-8/R4-9 — cover the three branches that shipped green under mutation:
the 4000-char total cap, code-point truncation of astral characters, and the
reply path's `entriesDropped` warning (plus the reply path's entry expansion,
which no test rendered at all).

Verification — every fix mutation-verified, each reverted alone:

  R4-1 drop the per-line trim              ->  9 failed | 328 passed
  R4-2 single-pass unwrap (channel-base)   ->  1 failed | 1030 passed
  R4-2 single-pass unwrap (dingtalk)       ->  1 failed | 336 passed
  R4-2 sender via sanitizeChatRecordField  ->  1 failed | 162 passed
  R4-3 attacker-derived header tag name    -> 18 failed | 319 passed
  R4-7 MAX_CHAT_RECORD_CHARS -> 4000000    ->  1 failed | 336 passed
  R4-8 line.slice instead of code points   ->  1 failed | 336 passed
  R4-9 delete reply-path warning branch    ->  1 failed | 336 passed

Green at head: channels/dingtalk 337/337 (163 in DingtalkAdapter.test.ts, up
from 144), channels/base 1031/1031, channels/qqbot 291/291. tsc --noEmit and
eslint clean on both packages. channels/github has 9 pre-existing failures in
GithubAdapter.test.ts that reproduce identically with this change stashed.

* fix(dingtalk): close the fold-assembled tag forges and cut the record tail cleanly

Round-5 review findings on #9339.

R5-1 (Critical): `sanitizePromptText` ran the fixpoint unwrap BEFORE the
C0/DEL fold and never looked at the folded output, so the fold itself
assembled tags the unwrap had already passed over. Two executed entrance
classes: a line-leading C0/DEL that JS `trim()` does not strip (x00-x08,
x0E-x1F, x7F) blocked the match and then became a space a caller's trim()
removed; and an interior CR/LF split a tag past the unwrap's content class
(`[SYS` + LF + `TEM]:`) which the fold then rejoined. Both reassembled a
clean start-of-line `[SYSTEM]:` in 1:1 DMs, where ChannelBase applies no
second pass. Fixed by unwrapping again over the folded text.

R5-5 (Suggestion): the same class behind the nine whitespace characters
`trim()` strips but neither pass folds (VT, FF, NBSP, U+1680, U+2000-U+200A,
U+202F, U+205F, U+3000) was patched per call site in this adapter rather than
in the producer. `START_OF_LINE_TAG`'s leading window is now every whitespace
character except CR/LF, so every caller that sanitizes then trims -- five
existing ChannelBase sites -- inherits the guard instead of repeating it.

R5-2 (Critical): summary lines are emitted at start-of-line (each line after
the first), but were defended only by the unwrap, whose `{1,64}` content
window can never match a longer bracketed run -- an 87-char `[SYSTEM MESSAGE
FROM ...]:` tag reached the model verbatim. The sibling sender/title/msgType/
fileName fields close this by stripping brackets outright, but they are also
wrapped in brackets by this file; summary lines are not. New
`startOfLineSafeChatRecordField` peels a leading bracketed run of any length
to a fixpoint and leaves brackets elsewhere on the line alone, so DingTalk's
own `[image]`-style display copy still reaches the model intact.

R5-4 (Suggestion): after the total-size cap tripped, `continue` (with `total`
frozen) let a later shorter line still fit, so dropped messages could sit in
the MIDDLE of the record while the trailing `[N more message(s) not shown]`
announcement said a tail was cut. Both caps now stop at the first line they
reject, which also stops measuring and truncating lines that are discarded.

R5-3 (Suggestion): `sanitizeChatRecordField`'s "keeps DM and group renderings
identical" claim and the user doc's layout promise were both false for groups
-- ChannelBase re-runs `sanitizePromptText` over the assembled text there,
folding the structural newlines and peeling this file's own markers. Both now
say so; the layout is documented as a DM-only guarantee.

Verification: `packages/channels/base` 1042 tests and
`packages/channels/dingtalk` 341 tests pass; `packages/cli`
memory-intent-classifier (38) and `packages/channels/qqbot` (291), the other
`sanitizePromptText` consumers, pass. Each fix was mutation-verified: reverting
the second unwrap, the widened leading window, the summary-line helper, and the
size-cap break each turns at least one new test red (1 / 7 / 2 / 1). Both
packages typecheck, build and lint clean.

Pre-existing on this branch and untouched by this commit: 9 failures in
`packages/channels/github` reason-routing aggregation, identical with these
changes stashed.

* fix(dingtalk): put the record header inside the cap and the reply leg inside the quote budget

Round-6 review, both Critical.

R6-1 — the record's `summary`/`title` header was inside NO cap (per-line,
total or code-point) while `capChatRecordLines` bounded only the entry lines
under it. One root, two symptoms: a 62,889-char summary reached
`envelope.text` intact, ~15x the "at most 4000 characters in total" the docs
and the cap block's own comment promise; and nesting past
`sanitizePromptText`'s `{1,64}` window fell through to the bracket peel, whose
fixpoint loop re-copied the whole string per pair — quadratic, measured 212 ms
of synchronous event-loop stall at 62,889 chars and 4.1 s at 200 KB, on input
any group member can author.

`formatChatRecord` now spends ONE budget across header then entries in render
order, reserving what the entries need to announce their own cut; the title is
bounded by the per-line cap and then by that budget. The peel does the same
work in one linear pass over a deletion map instead of a loop of whole-string
rewrites (2.3 ms at 200 KB). Equivalence was checked exhaustively over every
string up to length 7 from `{[, ], space, a}` (21,837 inputs) and 573k random
fuzz cases against the loop it replaces: zero divergence.

R6-2 — the reply leg rendered to the 4000-char record budget, but its consumer,
`ChannelBase`'s `sanitizeQuotedText(referencedText, 500)`, cuts at 500 code
points unconditionally. Every non-trivial replied record therefore arrived with
everything past the header gone AND its own `[N more message(s) not shown]`
announcement cut off with it — the model got a partial record with only a bare
`…` to say so, while the docs promised the cap is announced. The reply leg now
renders to the quote budget, so the announcement lands inside the quote.

Behaviour change, user-visible: a record you REPLY to is now rendered to 500
characters rather than 4000. It was already delivered at 500 — this only moves
the cut from the transport's blind slice to the record's own announced one, so
what the agent loses is unchanged and what it is told about the loss is not.
Documented in the DingTalk channel page.

Also drops `capChatRecordLines`' first-line exemption: with the per-line cap at
500 the first line always fitted the 4000 budget anyway, so it only ever fired
on the quote budget — where keeping a line the transport then cuts is exactly
the silent truncation the block exists to prevent.

Verification: `npm run build` and `tsc --noEmit` clean in
packages/channels/dingtalk; eslint clean on both changed sources; full package
suite 344/344 (169 in DingtalkAdapter.test.ts, 3 new). Five mutants, all
killed: uncapped summary and uncapped title each redden the header-cap test;
the reply leg back on the 4000 budget and the removed announcement reservation
each redden the quote-budget test (507 code points against a 500 ceiling); the
fixpoint peel restored reddens the stall test at 5,197 ms against a 1,000 ms
threshold that the linear peel clears in ~10 ms.

* fix(dingtalk): budget the record title in UTF-16 units and peel chained tags linearly

R7-1: the chat-record title cap was the one budget quantity in
`formatChatRecord` measured in CODE POINTS -- `headerBudget`,
`headerLead.length`, `spent` and `chatRecordAnnouncementCost` are all UTF-16
`.length`. An astral character therefore bought two units for the price of one
point, so a title sitting exactly on the 429-point cap the header leaves
overshot its reserved space. The entries budget then fell BELOW the
announcement cost the header had reserved for it, `capChatRecordLines` hit its
`spendable < 0` floor and returned `[]`: on the quote leg every forwarded
message vanished with no `[N more message(s) not shown]` line, and
`entriesDropped` stayed false because `recordLines` was non-empty -- so not even
the stderr warning fired. Emoji in a group record title are ordinary. A
fully-astral title also carried the result past the documented 500-unit ceiling
(~544-873 units).

Adds `truncateUtf16Units` to channel-base beside `truncateCodePoints` -- cut to
a UTF-16 unit budget, still on code-point boundaries, so a pair is never split
-- and uses it for both the title and the per-entry line cap.

BEHAVIOUR FLIP (entry leg): an entry line of 400 emoji is 400 code points but
800+ UTF-16 units. It used to pass through whole and unmarked, 1.6x the ceiling
the cap documents; it is now cut to 500 units and marked `[truncated]`. The
ceiling is a budget promise the header and entry sections both spend against,
not a display preference, so the old behaviour was wrong: it let one entry
silently eat space the announcement had been promised. The existing R4-8 test
only reaches the cap from above its POINT count, where both measures agree a cut
is due -- it cannot see the band between them.

R7-2: `unwrapStartOfLineTags` peeled to a fixpoint with a full-string `replace`
per pass. `START_OF_LINE_TAG` is `^`-anchored, so each pass removed exactly one
tag per line, and a tag whose content is all whitespace peels TO whitespace --
re-opening the leading window -- so `'[ ]'.repeat(n)` cost n x O(n). Measured on
this branch: 10 KB -> 16.1 ms, 20 KB -> 71.5 ms, 40 KB -> 318.2 ms, 80 KB ->
1216.6 ms of synchronous event-loop stall. The input is attacker-authorable and
reaches `sanitizePromptText` BEFORE any cap -- record titles and summary lines,
entry bodies, any group message routed through `ChannelBase` -- so the stall
repeats per message. The suite's only stall test pins DEEP NESTING, which
exceeds the `{1,64}` content window and never matches this regex at all (0.8 ms
at 200 KB), so the quadratic shipped green.

Replaced with the same peel simulated in place -- the mark-and-emit technique
`startOfLineSafeChatRecordField` already uses on the DingTalk side, extended
with the `{1,64}` content window and per-line restart. Both pointers only move
forward and each pass measures at most 65 live characters, so the peel is
linear: the same inputs now run 1 ms / 3 ms / 5 ms / 5 ms, and 300 KB in 9 ms.

Verification:
- Differential test against the original regex fixpoint over 84,000 random
  inputs (bracket-dense, blank-content, CR/LF/U+2028, NBSP/IDEOGRAPHIC-SPACE,
  C0/DEL, astral, and the 64-char window boundary): byte-identical output. Run
  as a scratch test, not committed.
- Mutation, R7-2: restoring the `replace` fixpoint turns the new stall test red
  at 16913 ms against a 1000 ms bound (9 ms with the fix); no other test moves.
- Mutation, R7-1 title: restoring `truncateCodePoints` turns the new
  astral-title test red -- exactly one test, the new one.
- Mutation, R7-1 entry line: restoring the code-point cap turns the new
  unit-cap test red; before it was added, that mutant shipped green.
- packages/channels/{base,dingtalk,telegram,weixin,qqbot}: 1594 tests green.
- packages/cli memory-intent-classifier (the only sanitizePromptText consumer
  outside channels): 38 green.
- `tsc --build` clean in both touched packages; eslint and prettier clean.
  Root `npm run typecheck` fails in packages/web-shell and packages/cli, but it
  fails identically on the untouched branch -- stale cross-package dist in this
  worktree, not this change.

* fix(dingtalk): delete an unpaired leading bracket in the summary-line peel

* fix(dingtalk): keep the summary-line peel linear on unpaired brackets

---------

Co-authored-by: qqqys <266654365+qqqys@users.noreply.github.com>
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
2026-08-23 18:21:41 +00:00
易良
56db17bd4c
refactor(cli): enforce utils leaf-layer dependency direction (#9146) (#9737)
* refactor(cli): enforce utils leaf-layer dependency direction (#9146)

Move domain-coupled modules out of packages/cli/src/utils into the
directories that own them: config/ (dialogScopeUtils, settingsUtils),
i18n/ (languageUtils), ui/ (handleAutoUpdate, standalone-update,
systemInfo, systemInfoFields, update-relaunch, commands, doctorChecks),
nonInteractive/ (nonInteractiveHelpers, chat-recording-failure,
tool-result-boundary-diagnostics, permission-suggestions), serve/
(sandbox), services/housekeeping/ (scheduler, non-interactive-scheduler),
and commands/review/ (findings).

Extract the generic normalizePartList helper into
utils/normalize-part-list.ts so utils consumers keep importing downward,
and move the MergeStrategy enum into utils/deepMerge.ts (its owner).

Add an eslint architecture rule (no-utils-upward-import) that forbids
value imports from utils/ back up into a domain directory. Type-only
imports stay exempt: they are erased at compile time and cannot create a
runtime cycle (Settings in modelConfigUtils, CommandContext in
sessionPaths).

No behavior change: typecheck, build, and the affected unit tests pass.

* fix: use Qwen Team 2026 license header on new files (#9146)

* chore: refresh stale utils/ path references after leaf-layer move (#9146)

* docs: reconcile no-utils-upward-import header with the allowed type-only set (#9146)

* fix(cli): allowlist sandbox process.env accesses after leaf-layer move (#9146)

* chore(ci): re-record qwen-autofix.yml size baseline after #9677 (#9146)

#9677 recorded qwen-autofix.yml at 392111 bytes while the file it
committed was already 397656, so every PR that merged main after it
tripped the growth ratchet. Re-record the actual size; the file itself
is unchanged by this PR.

* fix(review): drop the stale utils/findings.ts digest root after the leaf-layer move (#9146)

The #9146 move returned findings.ts to commands/review/, but the digest
root lists merged from main still pinned it under utils/, where the file
no longer exists — the absent root darkened every review's staleness
check and failed review-source-digest.test.ts. Drop the stale file-shaped
root from both digest copies and their pins; the commands/review/
directory root covers the validator at its new home, and the two utils
helpers keep their file-shaped roots.

* fix(review): colocate seatbelt profiles with the sandbox module (#9146)

* fix(review): exempt inline type-only specifiers from the utils upward-import rule (#9146)

* fix(review): report upward inline type-specifier imports under verbatimModuleSyntax (#9146)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(review): pin mixed-specifier and zero-specifier upward imports in the utils rule (#9146)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(review): anchor the nested-checkout utils rule fixture on the last marker (#9146)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(review): pin that the utils/findings.ts digest root stays removed (#9146)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(review): reword stale-bundle SCOPE header to the post-move helper shape (#9146)

* test(review): drop the pre-move utils/findings.ts from the skill-parity fixture (#9146)

* test(serve): derive the seatbelt colocation tripwire from BUILTIN_SEATBELT_PROFILES (#9146)

* fix(architecture): fail closed on computed dynamic imports in the utils leaf rule (#9146)

* fix(cli): point settings.test.ts at the post-move settingsUtils path (#9146)

main updated settings.test.ts after this branch moved settingsUtils.ts
from utils/ into config/, and the merge kept main's old import
specifier, which vite fails to resolve. Repoint it at ./settingsUtils.js;
every other consumer already uses the new path.

* fix(cli): close utils boundary review gaps

* test(cli): cover utils boundary allow paths

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-08-23 14:41:49 +00:00
顾盼
b5fbdb22d3
feat(cua-driver): add versioned Computer Use SDK and release pipeline (#9587)
* chore(cua-driver): sync upstream v0.20.0

* feat(cua-driver): add Computer Use SDK with versioned observation revisions

Wrap the typed driver SDK in a standalone Node wrapper and add accessibility.observation_revision.v1: base-anchored validated diffs with opaque element tokens, explicit full-resync reasons, full-only answers on Windows/Linux. Fix portable include_screenshot schema type and classify stable kAXErrorFailure refusals as complete in the macOS capture tracker.

* feat(cua-driver): complete typed Computer Use capabilities

* fix(cua-driver): use Qwen-owned npm identity

* feat(cua-driver): publish one Qwen CUA SDK package

* fix(cua-driver): verify Windows Rust targets

* fix(cua-driver): verify macOS Rust targets

* fix(cua-driver): pin release Rust toolchain

* fix(cua-sdk): fail closed on incomplete releases

* test(cua-sdk): import workflow test globals

* ci(cua-sdk): retry Debian package downloads

* fix(cua-driver): harden lifecycle and release gates

---------

Co-authored-by: tutu <tutu@U-RD4R9MQQ-2235.local>
2026-08-23 14:20:14 +00:00
易良
0b953b7929
fix(core): support public GitHub extensions with older Git (#9690)
* fix(core): clarify Git requirement for public extensions

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(core): preserve secure Git version boundary

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(core): support public GitHub extensions with older Git

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(core): harden old-Git fallback archive validation against export-ignore

Detect Git LFS by pointer-file content instead of .gitattributes grammar: codeload archives honor export-ignore, so a repository can hide its attributes file from the extracted tree and slip raw LFS pointers past the guard (attribute macros and case-variant names bypass the grammar check too). Also restrict the .gitmodules check to the archive root, where git gives it submodule semantics. Add a debug log to the only silent ERROR return in the old-Git update check, unit tests for the fallback gate's fail-closed matrix, and coverage for the invalid-SHA update path.

* test(core): cover archive entry-count and expanded-size limits

Add crafted-header tar fixtures for both new rejection limits in assertTarArchiveHasNoLinks: boundary cases at exactly 100,000 entries and exactly 1 GiB declared expansion, plus just-over cases asserting the specific error messages.

* fix(core): address old-Git fallback review feedback

- Keep release installs ahead of the archive fallback for older Git;
  the fallback now only replaces the clone step after a release miss.
- Restrict tar entry-count/expanded-size ceilings to the untrusted
  network fallback instead of every .tar.gz extraction, and stop
  reading the archive as soon as validation fails.
- Share one ref-to-SHA resolver between install and update checks, and
  follow a limited number of GitHub API redirects (re-validated per
  hop, token never leaves the original host).
- Use a random staging name for the downloaded source archive so it
  cannot collide with a repository file of the same name.
- Collapse the duplicated pinned-Git version comparison into one check.
- Document fallback limitations (symlinks, submodules, LFS, ceilings).

* test(core): cover invalid commit SHA rejection in old-Git fallback

The install path's ref-to-SHA resolver validates the 40-hex SHA before
interpolating it into the codeload download URL; add a test asserting
that an invalid SHA rejects before any archive download is attempted,
matching the existing update-check coverage.

* fix(test): add missing createReadStream and pipeline mocks in npm test

archive-safety.ts now calls fs.createReadStream() and pipeline() directly
instead of tar.t({ file, ... }). The npm test mock for node:fs was missing
createReadStream, and node:stream/promises pipeline was not mocked.

* perf(core): memoize the local Git version probe

The fallback gate and the pinned-Git assert both spawn their own
`git version` subprocess even though the version cannot change within
a process lifetime. Fetch it once through a module-scope memoized
promise so each extension install/update check pays a single probe.

* test(core): cover early abort of the tar safety scan

Once a limit trips, the scan destroys the read stream instead of
consuming the rest of the archive. Add a regression test that trips
the link ceiling with a large trailing entry and asserts the scan
stops reading the archive at the failure point, guarding the teardown
path against deadlocks and scan-to-end regressions.

* fix(core): open the tar safety scan stream after the abort check

A pre-aborted signal entering assertTarArchiveHasNoLinks threw before
pipeline consumed the hoisted ReadStream, abandoning it (unhandled
ENOENT 'error' crash for a missing file, leaked fd otherwise). Move
createReadStream below the abort check to restore check-then-open
order, and add a regression test asserting no stream is opened.

* test(core): cover fetchJson redirects and fallback resource limits

Mirror the downloadFile redirect matrix for fetchJson via the release
metadata path: redirect loop cap, missing location header, non-https
redirect rejection, and both sides of the cross-host token-stripping
ternary. Also add a fallback integration test serving a crafted-header
archive just over the 1 GiB expanded ceiling so the enforceResourceLimits
option on the production call site is pinned end to end.

* fix(test): return a destroyable stream from the npm test fs mock

The bare createReadStream mock returned undefined, so failValidation's
stream.destroy() raised a TypeError absorbed by vitest spy bookkeeping
whenever a validation cap tripped. Return a destroyable object and
assert the cap-trip path completes cleanly.

* fix(test): make fallback anonymity assertions header-case-insensitive

* test(core): abort the old-Git fallback through an AbortSignal

* fix(test): pin the manager's fallback call arguments

* test(core): pin fallback symlink rejection, lookup passthrough, per-hop re-resolution

- Add an integration test that runs the real old-Git fallback against a
  symlink-bearing archive mirroring issue #8993's repro repo
  (obra/superpowers root AGENTS.md -> CLAUDE.md) and asserts the honest
  fail-closed rejection naming the link entry; safe symlink support is
  tracked in #9724.
- Assert the fallback's https.get options carry the pinned lookup and
  agent:false on both the commits-API and codeload hops.
- Run the five GitHub API redirect tests under networkPolicy: 'public'
  and pin per-hop re-validation: dns.lookup is called once per hop and
  every hop's options carry the pinned lookup.

* test(core): import archive limit constants instead of redeclaring them

The boundary tests redeclared MAX_ARCHIVE_ENTRIES and
MAX_ARCHIVE_EXPANDED_BYTES locally, so changing a limit in
archive-safety.ts would leave the tests validating the stale values.
Import the constants from the implementation instead.

* fix(core): detect export-ignore-hidden submodules via the commit tree

The submodule guard checked for a root-level .gitmodules in the
extracted archive, but codeload archives honor .gitattributes
export-ignore, so a repository can strip its .gitmodules from the
archive and slip past the presence check while still carrying
submodule gitlinks. Query the commit's tree listing, which keeps every
path regardless of export-ignore, and reject on a root .gitmodules blob
or any gitlink entry before downloading; fail closed when GitHub
truncates the listing. The extracted-tree scan stays as defense in
depth.

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-08-23 13:03:15 +00:00
jinye
431a0bd9b0
fix(daemon): keep restored ask_user_question valid after load (#9763)
Some checks are pending
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 1/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 2/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 3/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 1/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 2/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 3/3 (push) Waiting to run
E2E Tests / E2E Test - macOS - shard 1/2 (push) Waiting to run
E2E Tests / E2E Test - macOS - shard 2/2 (push) Waiting to run
E2E Tests / channel-plugin E2E (nightly) (push) Waiting to run
E2E Tests / cron-interactive E2E (nightly) (push) Waiting to run
E2E Tests / web-shell Browser Regression (push) Waiting to run
SDK Java / ubuntu-latest / Java 11 (push) Waiting to run
SDK Java / ubuntu-latest / Java 17 (push) Waiting to run
SDK Java / macos-latest / Java 21 (push) Waiting to run
SDK Java / ubuntu-latest / Java 21 (push) Waiting to run
SDK Java / windows-latest / Java 21 (push) Waiting to run
SDK Java / Real daemon E2E / Java 11 (push) Waiting to run
Security Checks / Dependency CVE audit (push) Waiting to run
Security Checks / Secret scan (TruffleHog) (push) Waiting to run
* fix(daemon): keep restored questions valid across load, send, and replay

Post-merge review of the restore path found illegal provider history, phantom rewind snapshots, dropped resume notices, and replay that finalized a question the load was about to re-hang.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(cli): pin ask_user_question restore suppress wiring in acpAgent

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(daemon): skip persistence for a whole restored batch that ends unattended

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(core): pin restorable ask_user_question preservation on a real Config

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-08-23 05:03:31 +00:00
callmeYe
f1b1305a76
feat(models): support dual-role image generation models (#9650)
* feat(models): support dual-role image generation models

* fix(models): address dual-role image selector review

* test(cli): cover image model resolver rejection

* fix(models): preserve legacy vision image routes
2026-08-23 05:02:32 +00:00
Dragon
1e062a4d0f
perf(cli): raise VP scroll rendering to 60 FPS (#9681) 2026-08-23 04:50:28 +00:00
Shaojin Wen
509226260c
feat(review): back comment-status and presubmit for Aone Code targets (#9627)
* feat(review): back comment-status and presubmit for Aone Code targets

A second `--comment` round on an Aone MR re-posted every still-valid
finding as a new comment and never downgraded a self-MR review — both
flows were skipped for lack of a1 backing. Route Aone targets at the a1
reads (mr view / mr status / mr comment list / auth whoami) through the
same pure classification cores the GitHub path pins, so the report
schemas and the Step-7 downgrade semantics stay one contract:
parentNoteId threading, closed → resolved, outdated → stale (a
rewritten line stays re-postable), no commit anchors (code facts
degrade to unknown), and drift with no compare API fails safe. The
context-unavailable verdict cap stays until pr-context lands.

Closes #9613

* fix(review): harden Aone runners' pr_number guards and null gate payload

Address round-1 review findings on the Aone backing of comment-status
and presubmit:

- extractStatusChecks no longer throws a TypeError when a1 answers a
  bare null to `mr status`; the payload now reads as the designed
  unreadable gate state (undefined), capping the verdict like a
  still-running check instead of crashing presubmit with no report.
- comment-status and presubmit validate pr_number with fetch-pr's
  /^[1-9]\d*$/ grammar before Number() coercion, refusing '012'/'1e3'/
  '0x1f'/' 12'/'12.0' tokens that would query a different MR than the
  caller's label carries.
- Pin the two subject_type combinations no test covered (pathless
  comment WITH outdated:true; the live path+line shape) with
  mutation-probed assertions.
- Align the --host describes with the sibling commands' detection
  wording (omission no longer promises github.com), name the real
  bucket (`resolved`) in the review skill's Aone dedup note, and scope
  the design doc's remaining-unbacked claim to its own section.

* test(review): pin the Aone dedup seams the round-2 review named (#9627)

Four mutation-verified pins on the existing Aone backing, each closing
a round-2 Suggestion:

- classifyAoneChecks: the continue-scan cell of aoneCheckState — an
  unrecognized value in an earlier key beside a recognized verdict in a
  later key reads the verdict, not pending (a first-present-key mutant
  now fails)
- classifyAoneChecks: a context-keyed FAILED gate carries its name —
  the passing context-keyed case pinned nothing because passing gates
  never collect names
- both comment mappers: `note` beats `body` when BOTH keys are present
  (`??` does not coalesce `body: ''`, so an inverted priority would
  blank every recognition signal and re-post the whole review)
- aoneCommentToPresubmitComment: parentNoteId maps onto
  in_reply_to_id, including the absent-stays-unset half

No source changes; each pin fails under its named mutant and passes on
the current code.

* test(review): pin the five Aone seams the round-3 review named (#9627)

* fix(review): align Aone comment reads with measured a1 facts (#9627)

* fix(review): read fully-dropped Aone checks array as pending, not all-clear (#9627)

* fix(review): match SKILL.md self-PR wording to the revert-guard test

The merge resolution reworded the self-PR note to "matched against the
'a1 auth whoami' account", but SKILL.test.ts's revert guard (#9616, #9627)
pins the exact phrase "the MR author is matched against 'a1 auth whoami'".
Restore the pinned wording (semantics unchanged) so the bundled-skill test
passes.

* fix(ci): record qwen-autofix.yml's actual size in the workflow ratchet

The workflow-size ratchet failed on this PR: qwen-autofix.yml is 397656
bytes but .size-baseline recorded 392111 (5545 over, allowance 4096).

The oversize was inherited from main, not introduced here: main's ratchet
commit (a5d77eb8, #9677) shrank qwen-autofix.yml to 397656 but set the
baseline to 392111 — 5545 bytes below the file's actual size at that very
commit. This branch carries main's file unchanged (byte-identical), so its
CI is the first to trip the mismatch.

Growth is real in the sense that the file genuinely is 397656 bytes; per the
ratchet's own guidance ("if the growth is real, bump the number and say
why"), record the actual size so the ratchet measures future drift from
reality. The Post Coverage Comment failure is downstream of this (the Test
job exits before uploading the coverage artifact).

* fix(review): keep the pipeline's own pathless Aone summary out of the blocker index (#9627)

---------

Co-authored-by: qwen-code-ci-bot <qwen-code-ci-bot@users.noreply.github.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev-bot@users.noreply.github.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
2026-08-23 04:50:14 +00:00
samuelhsin
b6901ee0fd
feat(web-shell): refresh composer skills incrementally after toggles (#9131)
* feat(daemon): attach skill-toggle mutation metadata to settings_changed

Hosts can apply Skill toggles incrementally without a full task reload or suppressing skills.* events.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(review): fit skill-toggle mutation metadata in the SDK bundle budget

The new normalizer parser pushed the browser daemon bundle over the 186KB cap. Raise it to 187KB and pin the review gaps that were cheap to close.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(daemon): pin skill-toggle mutation event count and parser edges

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(web-shell): refresh skills incrementally after toggles

* fix(sdk): raise daemon browser bundle budget for skill-toggle metadata

The 190KB cap overflowed by 491 bytes after merging main, so the SDK build fails before tests run.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shell): retry cancelled skill-toggle refresh per session

Marking the mutation handled before the workspace reload settled dropped the fallback when the user switched sessions mid-flight.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shell): keep skill fallback until session snapshot reflects toggle

Reference-identity snapshot checks dropped the workspace fallback on unrelated command updates, so a disabled Skill stayed in composer autocomplete.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shell): scope skill-toggle fallback to workspace and pending toggles

A partial toggle from another workspace, a superseded later mutation, or an unknown session skill list could leave a stale Skill in composer autocomplete.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shell): pass initial value to skill-mutation origin ref

React 19's useRef types require an argument; the missing initializer broke the web-shell build.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shell): restore skill fallback after workspace round-trip

Dropping the fallback on a workspace switch left the handled mark in place, so returning to the origin session never reinstalled it. An unknown session skill list now also uses the ready workspace snapshot instead of an empty composer.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shell): keep skill mutations per workspace after toggles

An intervening toggle in another workspace overwrote the only mutation
slot, so a failed live refresh could not restore that workspace's
composer snapshot. Also read nested _meta.availableSkills on live
command updates so the session skill list is not wiped to empty.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shell): retain batched skill mutations instead of the latest only

Two distinct toggles in one replay or live commit used to keep only the
last mutation, so a later applied toggle could drop an earlier partial
fallback and leave a disabled skill in composer autocomplete.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shell): keep Skill composer source correct after toggles

Skip the applied fast path while session skills are unknown, and drop leaked pending toggles when the workspace fallback is cleared.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shell): keep skill-toggle refresh scoped to #9123

Drop multi-workspace mutation books, pending-toggle merging, and the nested skills mapper so Web Shell only consumes skill_toggle metadata and refreshes the composer.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shell): drop unused skill-refresh eslint disable

The scoped effect already lists its deps, so the leftover exhaustive-deps suppression failed lint:ci.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shell): revalidate partial skill mutations

* fix(web-shell): reconcile queued skill mutations

* fix(web-shell): reconcile zero-session skill refreshes

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
Co-authored-by: YungSen Hsin <yungsenhsin@U-G0HXNQM1-2052.local>
2026-08-23 04:13:51 +00:00
Shaojin Wen
ec8a8a1a97
feat(review): back pr-context on Aone Code targets (#9621)
* feat(review): back pr-context on Aone Code targets

pr-context was the one read subcommand still gh-direct, so every Aone
run was forced context-unavailable: the verdict capped at COMMENT (the
wired a1 approval could never fire), Agent 0 skipped, and the machine
ledger never recovered from posted summaries. Route it through the
platform reader with a normalized context bundle; Aone serves it from
mr view + the flat comment list (thread comments carry the ledger),
GitHub's implementation is an extraction of the existing calls — its
output stays byte-identical. The forced cap leaves the Aone write path
for parity with GitHub's state-claim handling, and the refetch commands
a context file emits bake --pr on Aone, where comment bodies are
addressed per-MR.

* fix(review): keep Aone ledger carriers out of the blocker re-check (#9621)

On Aone this pipeline's own round summaries are path-less comments, so
they ride pr-context's issue channel, where their visible
**[Critical]** lines self-promoted every prior Critical-bearing summary
into "Blockers to re-check" — rendering each prior Critical three
times (beside the ledger section and the inline roots that own the
same findings) and spending the section budget on the pipeline's own
prose until genuine human blockers degraded to snippets. Exclude
bodies carrying the ledger marker from issue-channel promotion and the
stdout count, strip the marker out of the settled snippet, and switch
the pr_number guard to the canonical isPositivePrNumber so 0x10/5.
spellings cannot fragment side-file continuity. Pin the witnesses the
round's findings name: the guard, args.host forwarding, the
issue-kind --pr refetch branch, the account-first author keying, and
the GitHub test suites' independence from the cwd-origin probe.

* fix(review): refuse pr_number spellings that do not round-trip (#9621)

isPositivePrNumber alone admits two spellings whose Number() value does
not round-trip to the raw string: leading zeros (007 fetches 7 but the
raw string labels the heading and the prev-ledger side file, so a later
7 run reads a different side file and the round counter restarts) and
digit strings above Number.MAX_SAFE_INTEGER (Number() silently rounds
them, fetching a different PR than the labels announce). Add the
safe-integer and no-leading-zero conjuncts — matching fetch-pr's
[1-9]\d* rule — so every admitted input satisfies String(Number(x)) === x.

Also pin the witnesses the round-2 review names: the commit_id
round-trip through the GitHub reader and toRawReview into the persisted
side file (both spreads were unwitnessed), the stale force-applies
comment in submit-aone.test.ts the cap removal outdates, and the setup
batch's Aone carve-out for the unbacked comment-status call.

* docs(review): align Aone docs with the landed no-ancestry anchor rule and comment-status skips

D6 described the AGit-Flow anchor as inert until the incremental rule
landed, but that rule (#9630) merged while this branch was in flight —
anchors now delta-scope Aone re-reviews. SKILL.md's comment-status
section and Step 6's report-existence guard now name the Aone skip the
setup batch already carries, so no path sends an Aone run at the
unbacked command or at a report that was never written.

* docs(review): annotate #9616 as landed and define the report-less re-check rule

The out-of-scope list still read self-PR detection as open work although
#9629 shipped it into this branch's merge base — annotate it like the
sibling #9618 entry. Step 6's report-existence guard pointed report-less
runs at a re-derivation the skill never defines; replace it with the
explicit rule: no per-thread status routing, no hand-derived substitute,
rule from the code at the reviewed commit, cannot-tell over a guess.

* fix(review): route the context head through aoneHeadSha and close the round-5 findings

getReviewContext read sourceBranch raw while every other head read trims
— a padded server value diverged the context file from the rest of the
run (phantom-drift shape). getCurrentUser now honors the seam contract
on the anomalous whoami shapes instead of leaking untagged throws and
non-string accounts. Step 6's report-less rule no longer contradicts
the comment-status failure contract: runs where the command ran and
failed keep the "re-derive if needed" fallback. The Aone paragraph
names comment-body among the backed reads, and witness tests pin the
identity gate's carriers key and the head normalization.

* fix(review): shape-check the Aone comment listing in getReviewContext

a1 can answer repo mr comment list with an exit-0 a1.error/v1 error
object (backend auth failure or client timeout — measured by cleanup's
a1CommentList on the identical payload). Without a guard the object
survives the ?? [] coalesce and .filter throws an untagged TypeError,
losing the envelope's actionable message at exactly the recoverable
moment. Guard as the provider family already does and surface the
cause; witness tests pin both envelope shapes (mutant-checked).

* test(review): pin getCommentBody's body-field fallback (mutant-checked)

* fix(review): union resolved comments into the Aone context bundle

The default comment list excludes resolved comments (measured by the
cleanup audit) while GitHub's REST fetches include them, so a resolved
blocker/marker root never reached the re-check walk or the fail-closed
identity gate. Union the default and --resolved listings as the audit
does, dedupe by id, fail closed on either listing's error envelope, and
disclose the residual that resolved replies stay invisible; witness
tests mutant-checked.

* fix(review): serve resolved comments and guard the envelope in getCommentBody

getCommentBody queried only the default comment list while the context
bundle it serves refetches for unions in resolved comments — a resolved
id named by a truncation note threw "not found" every time, and an
exit-0 a1.error/v1 envelope threw an untagged TypeError that lost the
actionable message. Extract the shape-checked default+resolved union
helper and read both sites through it; witness tests mutant-checked.

* ci: correct qwen-autofix.yml size baseline to its actual post-migration size

#9677 shrank qwen-autofix.yml from 431526 to 397656 bytes (prose moved to
the design record) but recorded the baseline at 392111, 5545 below the
file's own post-change size, so the first PR to run the ratchet tripped it.
This branch introduces zero growth to the file (byte-identical to main);
the bump aligns the baseline with reality. No workflow content changes.

---------

Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
2026-08-23 01:10:32 +00:00
qqqys
98fa2e9770
feat(cli): enable dynamic workflows from a settings key (#9098)
* feat(cli): enable dynamic workflows from a settings key

`ConfigParameters.workflowsEnabled` is declared, defaulted, and read by
`Config.isWorkflowsEnabled()` — but `loadCliConfig` never writes it, so no
setting has ever reached it. The only way to turn dynamic workflows on is
the undocumented `QWEN_CODE_ENABLE_WORKFLOWS=1`, which has to be exported
in every shell that launches qwen. AGENTS.md names this shape directly: an
optional field that is declared and read but never set by any caller is a
dead switch.

Add `tools.workflowsEnabled` to the settings schema and populate the field
from it. Precedence is unchanged and still resolved in core:
`QWEN_CODE_DISABLE_WORKFLOWS` beats everything, then
`QWEN_CODE_ENABLE_WORKFLOWS`, then the setting. Because `settings.merged`
already folds the System scope, an operator gets a fleet-wide force-off
with no extra code.

`requiresRestart` is load-bearing rather than decorative: the Workflow tool
is registered once while the tool registry is built, `/workflows` is gated
when commands load, and keyword steering resolves at startup — so a
mid-session toggle would leave the dialog claiming the feature is on while
the tool is absent from the registry.

The setting description also disambiguates it from the unrelated
`experimental.sessionWorkflow` plan-and-review view, which shares the word
"workflow" and would otherwise be easy to confuse in the settings dialog.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* docs(cli): clarify workflow feature controls

* test(cli): cover workflow command gating

* fix(cli): restrict workflow opt-in scope

* fix(cli): keep workflow opt-in user-owned

* test(cli): cover workflow system scopes

* refactor(cli): drive workspace-restricted settings from one list

R4-3: the restricted set was hand-maintained in three parallel places — a
per-key warning block, the condition in `stripWorkspaceRestrictedSettings`,
and that function's destructure. Adding one restricted setting needed three
synchronized edits, and either omission is silent: forgetting the warning
discards a workspace value with no diagnostic, forgetting the strip honors a
value the warning says is ignored.

`WORKSPACE_RESTRICTED_SETTINGS` is now the single source, and the warning
loop and the strip both derive from it. It lives in `settingsUtils.ts`
rather than `settings.ts` because `settings.ts` already value-imports that
module — defining it there and importing it back would close a runtime
import cycle.

R4-2: `tools.workflowsEnabled` is the first setting that is both
`showInDialog: true` and stripped from Workspace scope, so the dialog
offered a toggle that silently never took effect — it renders from the raw
scope file, so it kept showing the value it wrote while the feature stayed
at its merged value, leaving a dead entry in the repo's .qwen/settings.json.
`getDialogSettingKeys` gained `excludeWorkspaceRestricted`, which the dialog
passes when the selected scope is Workspace. The scope comparison stays in
the component so settingsUtils keeps its type-only dependency on settings.ts.
Unlike `showInDialog: false` (what the two pre-existing restricted settings
use), the setting stays visible and editable under the scopes that honor it.

Verified: settings 169/169, settingsUtils 85/85, BuiltinCommandLoader 13/13;
packages/cli typecheck clean. Mutation-checked both ways — forcing the
filter off fails 1 test, dropping a key from the list fails 3.
SettingsDialog.test.tsx's 23 failures are pre-existing and environmental:
identical counts on upstream/main and on this branch before the change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(serve): reject workspace-restricted settings at the daemon API too

R8-1. The workspace restriction stopped at the TUI dialog. `stripWorkspace
RestrictedSettings` drops these keys before every merge, so a workspace-scope
write through the settings API persists a committable dead entry into the
repo's `.qwen/settings.json` and answers 200 + `requiresRestart: true` while
the feature never turns on — GET then reports `workspace: true` beside
`effective: false`, and the warnings channel carries only `corrupted`, so the
client never learns the write was inert. Exactly the trap the SettingsDialog
comment in this same PR says it eliminates, one layer over.

`tools.workflowsEnabled` is the first workspace-restricted key with
`showInDialog: true`, which is what puts it in `getDialogSettingKeys()` and
therefore in `getAllowedKeys()` — the two pre-existing restricted keys are
`showInDialog: false` and never reached the API.

Both POST handlers now call one shared `rejectWorkspaceRestrictedWrite`,
answering 400 `workspace_restricted_setting`. One helper rather than two
copies, for the reason the previous commit collapsed the warning/strip pair.
User scope is untouched — that scope honors the key, and a guard that reached
it would kill this PR's whole enablement path.

Verified: workspace-settings 22/22, settings 169/169, settingsUtils 85/85.
Mutation-checked three ways — dropping either call site fails a test, and
widening the guard past workspace scope fails the user-scope test.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: qqqys <266654365+qqqys@users.noreply.github.com>
2026-08-23 00:33:51 +00:00
Shaojin Wen
f829a02896
feat(review): validate Aone inline anchors against the captured diff before posting (#9634)
* feat(review): validate Aone inline anchors against the captured diff before posting

Aone Code performs no server-side anchor validation — a controlled probe
(scratch MR 29427547, a1 v0.2.51) proved any --line integer posts, and
an old-side number silently lands on the same-numbered new-side line.
The old side cannot be anchored at all, and file-level comments drop
their path.

Pin the removed-line semantics for the Aone write path: submit's Aone
branch now validates every well-formed inline anchor against the
review's captured diff before posting. An unanchorable Critical is
relocated into the summary body, an unanchorable Suggestion discarded
and counted — the GitHub 422-recovery dispose, performed in code — each
disclosed in the terminal. A missing captured diff refuses the whole
post; malformed shapes (missing path/line, reversed range,
renders-as-nothing) keep their consistency-gate refusals, and a garbage
state.bodyCriticals stands the gate down so compose's pinned refusal
fires. The GitHub path is untouched — its server performs this
validation.

Issue #9615

* fix(review): reject unpostable anchors and unify the Aone gate's shape refusals

- validateNewSideAnchors now rejects the input domain (fractional/zero/negative
  lines and reversed ranges) before the hunk scan, so its verdict can no longer
  certify an anchor the zero-validation Aone platform would post silently wrong.
- Extract the consistency gate's per-comment shape checks into one shared
  predicate (commentShapeProblems) read by both the loud refusal and the Aone
  anchor gate, so a shape the gate disposes is never a refusal the operator
  misses (open fence, start_line-without-side). The path check becomes a type
  check, closing truthy non-string paths that reached the write seam unvouched.

* fix(review): generalise the Aone gate's stand-down and harden its relocated entries

Round-2 review fixes for the Aone anchor gate:

- The stand-down now keys on ANY degrade that touches the payload and
  covers every compose-owned garbage shape: bodyCriticals that is not an
  array of strings, or a suggestionsDiscarded compose's counter refuses.
  The countability test reads compose's OWN acceptance table (toCount,
  exported as the total tryToCount), so the gate's merge and compose's
  counter can never drift — an integer-but-not-safe count now merges
  instead of silently dropping the gate's discards.
- The relocated entry's claim extraction strips a leading marker RUN
  (fixpoint, like every other strip) and treats a fence-delimiter claim
  line as absent — both shapes used to leak raw markers or junk
  delimiters into the posted summary-body blocker line.
- The gate keeps the model-authored comment indices through its removal
  (and floor enforcement keeps them through its own), so the consistency
  gate's refusal names the culprit in the model's payload JSON instead of
  a renumbered position the re-compose loop cannot act on.
- A --dry-run with a missing capture no longer exits 3: it writes
  nothing, so it skips the gate with a disclosure and reports
  wouldPost: false (reason: aone-diff-missing); the exit-3 refusal stays
  reserved for the real write.
- The MULTI_DIFF fixture's second hunk header becomes byte-exact git
  output (@@ -20,0 +22,2 @@, probed against git itself).
- The design doc gains the gate-relocation doctrine (relocated entries
  deliberately inherit the model's own tag-exemption treatment), the
  dry-run carve-out in the failure-shape table, and the corrected
  fence/one-line-channel claim.

* fix(review): close the anchor-gate witness gaps and a footer-leak in the relocated entry

Gap-fill on top of the round-2 gate hardening:

- The relocated entry's claim extraction strips the canonical footer
  FIRST: with an empty claim line (a marker-plus-separator-only body),
  the separator strip eats the newline+colon and the extraction falls
  THROUGH into the appended footer's first line, posting it as the
  claim. Witness added for the placeholder shape.
- Pin the multi-line relocation entry CONTENT (it must cite the claimed
  end line, not the start — the start sits inside the hunk and looks
  fine) and the disclosure naming it.
- Witnesses for the remaining mutant-tested gaps: a range whose start
  sits outside every hunk and end inside (the startLine mapping), the
  dry-run compose parity (preview composes from the gate-corrected
  payload), the suggestionsDiscarded 0 merge boundary, the empty-path
  shape (loud refusal, never a gate disposal), a declared LEFT
  start_side without a start_line, and the equal-boundary range
  (start_line === line, a shape GitHub itself produces).
- The routing suites run from a per-test fixture cwd, so the
  captured-diff seeding and its cleanup can no longer overwrite or
  delete a same-numbered live capture in the real vitest cwd.

Issue #9615

* fix(review): sanitise relocated-entry paths and stand down over any compose-refused bodyCriticals

* fix(review): keep the anchor gate's captured diff when resetting the receipt state

The Aone receipt suite's beforeEach wiped the whole .qwen tree to start
from no receipt — deleting the captured diff the anchor gate needs along
with it. Every post then died at the gate's missing-capture refusal and
no receipt was ever written (ENOENT in the four receipt tests on CI).
Remove only the receipt file; the seeded diff survives.

* fix(review): close the anchor-gate entrances the review rounds demonstrated

Round-3 remediation of the review comments on the Aone anchor gate:

- R3-2 (structural): the BUILT relocated entry is now validated against
  compose's own ingestion (tryIngestBodyCriticals over the single entry)
  before the relocate is disclosed, and any refusal degrades the entry to
  the inert constant `finding — (no path):<line>` — the entrance space is
  unbounded model text and compose's acceptance is the authority, so a
  shape the enumerated guards never anticipated degrades the entry
  instead of refusing the whole post mid-degrade. The demonstrated
  entrance (a lone CR inside the claim: it passes the leading-fence
  guard, compose's CR normalisation then splits the entry and the second
  line leads with a fence delimiter) is covered by a witness.
- Ledger collision: the relocated entry flips to `<claim> — <path>:<line>`
  — the claim leads, so a carried id keeps position 0 and the ^-anchored
  ledger readback matches instead of silently renumbering a carried
  finding as new. Witness asserts the id survives the readback regex.
- R7-1: an explicit JSON null side/startSide reads as ABSENT (defaults
  to RIGHT), the model's idiom for an omitted optional field — never a
  declared old side. Unit and gate-level witnesses.
- R3-3: witness for the non-identity authoredIndices branch — the gate
  renumbers the array, floor enforcement keys on the post-gate array,
  and the remap drops the comment floor enforcement names.
- R4-2: the hostile-paths test gains the \r-bearing path (compose's
  ingestion normalises a bare CR to a line break — the same hostile
  shape as \n; the guard's \r half was unwitnessed).
- R3-5: the design doc states the carve-out — the non-RIGHT degrade runs
  for single-line comments only; a multi-line non-RIGHT comment keeps
  the consistency gate's whole-post refusal; null side is absent, not a
  declaration. The failure-shapes table splits the row accordingly.

Issue #9615

---------

Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-08-22 17:45:27 +00:00
jinye
2172721405
feat(cli): restore each daemon session onto its last selected model (#9687)
* feat(cli): restore each daemon session onto its last selected model

Idle detach currently rebuilds Config from settings.model.name, so session A picks up whatever model session B last switched to.

Fixes #9686

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): address session-model persistence review findings

- reader: always select the last assistant record into the restore read
  set so the legacy lastAssistantModel fallback still fires when a
  trailing chat_compression candidate excludes it from the resume read
- recorder: assign currentSessionModel before the awaited write so a
  rewind landing in the pending-write window re-anchors the new binding
  instead of the stale one
- reader/recorder: reject non-string session_model payload fields
  instead of crashing the restore path on malformed transcripts
- protocol doc: describe the session_model append as best-effort, not
  an unconditional consequence of a successful switch
- cli: import RUNTIME_SNAPSHOT_PREFIX/stripRuntimeSnapshotPrefix from
  core instead of duplicating the prefix algorithm locally
- tests: pin the isRuntime/baseUrl payload dimension, the prefix and
  route-mismatch false arms, the neither-field fallback, and regression
  coverage for the two fixes above

* fix(cli): keep daemon session-model restore from failing load

Pre-auth restore skipped the last-assistant fallback, and a recorded qwen-oauth binding could hard-fail load when cached credentials were gone.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): roll session-model auth retry back onto the settings route

Same-id baseUrl restores and runtime-only settings models were skipping or breaking the fallback, which made load fail on the recorded credential set.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): keep empty daemon sessions from creating a transcript

Recording the session model on newSession wrote a jsonl file before any user content, so close/delete/child-death left the id occupied and listing still showed the empty session.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): allowlist restored session-model routes against the registry

JSONL baseUrl is only a registry selector, so unknown hosts are dropped before switchModel. Restore also keeps the last valid session_model payload instead of falling through a torn trailing record.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): retry session-model auth after same-id snapshot restore

The retry gate ignored runtime-snapshot identity, so restoring an implicit
registry route off a same-id snapshot looked unchanged and skipped rollback.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-22 16:33:36 +00:00
Yan Shen
867ded5bd5
fix(sdk): support "auto" permission mode (#9003)
* fix(sdk-python): support "auto" permission mode

* refactor(sdk-python): derive permission-mode validation from PermissionMode type

* fix(sdk-java): support "auto" permission mode

* refactor(sdk-python): derive auth-type and effort validation from type aliases

* chore: rerun CI
2026-08-22 14:25:40 +00:00
jinye
39378ac0a4
feat(serve): restore ask_user_question HITL on session load/resume (#9665)
* feat(serve): restore ask_user_question HITL on session load/resume

Keep a trailing unanswered question votable after daemon load/resume when --restore-ask-user-question is on, instead of closing it as a failed tool result.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(daemon): harden ask_user_question restore per review feedback

- acpAgent: defensive restore hint (no `!` lookup; accepts undefined
  session) + normalized id lookup on both cold return paths; session
  test doubles carry shouldHintAskUserQuestionRestore
- bridge: single maybeFireRestoreAskUserQuestionPrompt helper with the
  full admission-time busy predicate (pendingPromptCount +
  goalTurnActive), sync-throw try/catch, no-attached-client gate, fork
  suppression, and hasActivePrompt reflecting an admitted restore
  prompt; child-bound requests carry a suppress meta when the daemon
  already knows it will decline, keeping replay skip and re-hang
  aligned
- Session: restore prompt gated on the config flag; early bail before
  per-turn bookkeeping when history is not restorable; system reminders
  ride the post-answer message; restore turns no longer burn the
  active-todo reminder; a permission timeout on a restored question no
  longer persists the fabricated decline (transcript stays dangling for
  a later re-hang); continueLastTurn declines a restorable question;
  restorable detection reads peekLastHistoryEntry instead of cloning
  the full history
- history-replay-page: isInitialized() guard on the skip probe; dead
  paged-path skip wiring removed
- transcript-replay: skip set matches raw ids after dedup renames
- core: inline orphan-repair preserves the restored AUQ ids; the
  compression side query strips a trailing dangling functionCall; the
  CLI flag is honored only in ACP mode

* fix(cli): skip restore hint helper when the switch is off

Load/resume used to call shouldHintAskUserQuestionRestore on every Session, including test doubles that do not implement it. Short-circuit on argv first so the default-off path stays independent of the restore-only API.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-22 14:19:18 +00:00
jinye
af25c45e80
fix(cli): Recover sessions across archive races (#9513)
* fix(cli): report a conversation directory deleted mid-inspection as already gone

A child deleted between the lstat and the realpath, or a root that
vanished mid-inspection, was rewritten as 'identity_changed' and then
surfaced as 'Live conversation directory must be an owned direct child'
— a plain Error with no .code pointing at permissions and symlinks when
the directory was simply deleted. Restore the ENOENT-race -> false
contract of discardEmptyConversationDirectory (QwenLM/qwen-code#9489,
item 4).

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): keep conversation metadata reads race-free and parent ids storage-aligned

Item 2 of QwenLM/qwen-code#9489: readExistingMetadata read the location,
read the metadata, then re-read the location and returned undefined on
mismatch, so an archive landing between the probes made lock-free
resolvers report a healthy session as session_not_found. Creation
metadata is immutable, so one tolerant read per state (active first,
then archived) decides deterministically; the location probes are gone
and a path-safety charset gate keeps the joined transcript path a
single segment.

Item 3: the parent-lineage gate required strict RFC-4122 v1-v5 ids
while the store resolves far looser names, so persisted parents written
by older builds (nil, v6/v7, agent-suffixed ids) turned loadable
children into SessionNotFoundError, and the -agent- allowance could
never resolve. Drop the shape gate and let storage resolution decide,
keeping only the self-reference rejection.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(core): let loads resolve both-states sessions and drop the pre-lock restore scans

Items 1 and 5 of QwenLM/qwen-code#9489.

Item 1: a session persisted in both active and archived states — left
behind by a crash inside archiveSessions — hard-failed ACP session/load
and session/resume with session_conflict while plain CLI --resume kept
loading the active copy. findSessionIdIgnoringCase now resolves the
requested spelling first (and a single both-states candidate) instead
of throwing, and assertSessionLoadable treats 'conflict' as loadable
from the active copy. Mutating surfaces keep refusing: unarchive still
conflicts via assertSessionArchived, and multi-runtime ownership
arbitration stays strict so a conflicted internal copy cannot claim a
session an ordinary workspace serves.

Item 5: both restore handlers ran findSessionIdIgnoringCase twice per
request — once as a pre-lock guard whose result REST discarded and the
ACP twin kept as a stale storageSessionId fallback consumed exactly in
the TOCTOU where the in-lock resolve returned undefined. The pre-lock
guards are gone (the in-lock resolve is authoritative and both handlers
now agree), the exact-spelling fast path removes directory scans from
the common case entirely, and the remaining scan uses async readdir so
a large chats tree no longer blocks the daemon event loop.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): preserve canonical restore conflicts

Canonicalize live task keys before resident bridge operations, and keep known case-conflict responses when the optional storage recheck fails.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(serve): handle case-variant session follow-ups

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(serve): preserve mixed-case live task identity

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(serve): resolve canonical persisted session ids

Batch case-insensitive transcript lookups for multi-thread waits and preserve organization metadata when live and persisted session IDs differ only by case.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(serve): preserve canonical session restore state

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(serve): complete canonical session reads

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(serve): address canonical review findings

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(serve): preserve aliased session organization

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(serve): close canonical session review gaps

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(serve): close canonical task ownership gaps

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(serve): keep case twins distinct across session pages

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(serve): isolate alias verification failures

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(integration): align both-states transcript expectation

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): preserve mixed-case session ownership

Arbitrate noncanonical live task IDs across workspace runtimes and retain the newest legacy organization alias only for uniquely persisted sessions.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): preserve live task ownership during refresh

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(serve): handle session alias races

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* codex: address PR review feedback (#9513)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(e2e): normalize generated session ids

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): narrow PR 9513 to restore regressions

Drop the review-driven mixed-case expansion and retain only the five regressions tracked by #9489.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): complete active transcript conflict recovery

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(cli): align session conflict assertions

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(cli): align transcript conflict e2e

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* codex: address PR review feedback (#9513)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-08-22 14:01:59 +00:00
Shaojin Wen
2a99e84169
fix(review): clear the deferred Round-5 findings from the Aone write path (#9604)
* fix(review): clear the deferred Round-5 findings from the Aone write path

The full cleanup of #9579 — the 29 Suggestions deferred from round 5 of
the /review bot on #9491 under the ~5-round rule (Criticals-only from
that round on). One item (the GH_HOST setGhHost assertions) was already
landed with the round-5 Critical fixes; the rest are implemented here.

Write-path fixes:
- A shaped-but-empty --host refuses with its own shape (host-flag-empty)
  instead of collapsing to the unbound refusal the flag was the remedy
  for — the agent re-run loop the refusal wording exists to break.
- An invalid host (recorded verbatim or flag-typed) refuses in the
  exit-3 shape naming the offender and its origin, instead of setGhHost's
  TypeError escaping runSubmit as a failed command.
- A flagless gh post whose nothing-bound routing would inherit an
  ambient GH_HOST pointing at canonical Aone refuses actionably
  (ambient-gh-host-aone) instead of failing opaquely after compose ran.
- The shared authorisation gate no longer reads an absent host as a
  github.com claim for callers whose routing follows the recorded
  binding (submit): the ordinary flagless publish of a GHE-recorded
  review passes, while publish-assets keeps the strict comparison.
- Mid-batch drift disclosure rides the partial-post shape too
  (headMovedDuringPost on AonePartialPostError, warned from submit's
  partial branch), and the post-batch re-read is tri-state: a failed
  re-read leaves headMovedDuringPost undefined and submit discloses
  "could not re-verify" instead of a false all-clear.
- The Aone success JSON surfaces postedCommentIds/summaryCommentId —
  the audit the partial shape carries and the gh receipt records.

Docs and contract fixes:
- The context-unavailable cap wording now says what it does (keeps an
  Approve verdict at Comment; a Request-changes verdict still posts)
  in the user docs and both SKILL.md sites.
- The head-drift bullet is qualified by the per-review restart bound —
  spent on Aone there is no submit-at-reviewed-SHA fallback; report and
  leave the rest to the user.
- Step 9's Posted: contract admits the no-link note the Aone fallback
  prescribes.
- The --host help text spells both canonical Aone hosts out.
- The provider design doc's Phase-3 "refuses" sentence is marked
  superseded.

Test hardening (unfalsifiable pins made falsifiable):
- ensureAoneAuthenticated ordered before the writes; setGhHost ordered
  before the gh write; the a1 path never touches the gh host state.
- Live-probe cells for the explicit-flag precedence, the unbound
  refusal, and the fast-path hostless refusal; the recorded-binding-
  outranks-probe fixture driven through submit's real gitOpt seam.
- submit.test.ts mocks ./lib/git.js (no real git spawned in the vitest
  cwd), isolates the cross-session suite's recording store via chdir,
  and pins the newest-wins ordering when two recordings of one PR carry
  different hosts.
- Producer-side 'refusing to post:' prefix pins, the RC-Note count
  source pin, the contextUnavailable:true gh-path pin, and the floor
  recovery's callerHost pin.

* fix(review): address round-1 findings on the Aone write path (#9604)

* fix(review): address round-2 findings on the Aone write path (#9604)

Extract one refuse helper for submit's seven exit-3 refusal shapes
(sibling publish-assets precedent), align the Aone pre-write refusal
prefix with the other refusal paths, and pin the invalid-host remedy
of the flag/origin arms positively — the recorded arm's absence pin
alone let a ternary-collapse mutant ship green.

* fix(review): address round-3 findings on the Aone write path (#9604)

Make submit's exit-3 refusal terminal: refuse now throws a SubmitRefusal
that runSubmit's single catch renders into the refusal shape (stderr
line, posted:false JSON, exit 3), so a gate that says no cannot fall
through toward the write — the helper previously returned and relied on
every call site adding its own `return;`. Also extract the post-batch
MR-head re-read, duplicated between submitAoneReview's partial-post and
success paths, into one helper.

* fix(review): address round-4 findings on the Aone write path (#9604)

* fix(review): address round-5 findings on the Aone write path (#9604)

* fix(review): address round-6 findings on the Aone write path (#9604)

* fix(review): resolve merge-conflict residue in the review skill (#9604)

---------

Co-authored-by: qwen-code-dev-bot <qwen-code-dev-bot@users.noreply.github.com>
2026-08-22 13:27:51 +00:00
Shaojin Wen
0c36e5093a
feat(review): close Aone residual gaps — composeUrl, test-plan routing, a1 version floor (#9624)
* feat(review): close Aone residual gaps — composeUrl, test-plan routing, a1 version floor

The three residuals #9619 tracks together, one pass:

- composeUrl joins the platform reader: GitHub composes the PR-page URL
  from the routed host (deterministic grammar, no API call); Aone is
  reader-backed — the platform's own detailUrl, never assembled, since
  the nested-group owner/repo collapse can name a different repo.
  submit fills a receipt that carries no url through it on both
  platforms, so the skill's prose fallback shrinks to the coordinates
  relay for the one case the reader cannot serve.
- test-plan's body fetch routes through the platform reader: the MR
  description on Aone (already in the reader's fetch metadata — no new
  API surface), so the Test Plan check runs on Aone targets instead of
  going unchecked on every run.
- ensureAoneAuthenticated enforces the a1 version floor design-doc Q1
  asked about — 0.1.90, the version the platform facts were probed
  against — in presence → floor → auth order, each with its own remedy
  message; unreadable versions are disclosed on stderr and fail open.

Verified: ~590 targeted unit tests, tsc/eslint/prettier clean, build +
bundle green, and a CLI smoke that refuses a fake stale a1 at the floor
while a fake fresh one passes the gate.

* fix(review): apply round-2 review on the Aone residuals

All six round-2 suggestions on #9624, probe-verified and pinned:

- R1-1: the version-probe fail-open now discloses the CAUSE — the
  extraction mirrors the whoami catch (first non-empty line past the
  execFileSync preamble), so segfault / unsupported flag / permission
  failures stay distinguishable instead of one constant preamble line.
- R1-2: aoneReader.composeUrl discloses a failed lookup on stderr
  before degrading to '' — every other fail-open in the provider
  discloses, and the coordinates-relay case must stay distinguishable
  from an environment fault.
- R1-3: one home for the PR-page host spelling — normalizeGhHostForUrl
  in lib/gh.ts, shared by compose-review's comment anchors and the
  reader's composeUrl, so a `--host GHE.Corp:443` run can no longer
  print two textual spellings of the same PR page; non-default ports
  survive.
- R1-4: submit no longer re-queries the reader when the Aone receipt
  carries no webUrl — detailUrl is a stable MR attribute and the
  pre-write drift-gate read already carried it, so the second fetch
  could only block on the flaky state that lost the field. The empty
  receipt rides the coordinates relay; the reader keeps composeUrl as
  the canonical seam.
- R1-5: the Aone body-fetch route runs the same ensureAuthenticated
  gate every other a1-backed flow runs first — a standalone test-plan
  on a missing/stale/logged-out a1 now fails exit 1 with the
  install/upgrade/login message instead of exit 0 with the generic
  note. The GitHub arm keeps its historical degrade.
- R1-6: the handler wiring (the Aone fix's integration point) is
  pinned by handler-level tests — an Aone --host must route the body
  through the reader with the gate first, and a refused gate fails the
  command before any fetch.

SKILL.md's Posted paragraph, its revert-guard pins, and the design-doc
bullet follow the R1-4 semantics. Verified: tsc/eslint/prettier clean,
759 targeted cli tests + 23 SKILL guards green.

* fix(review): apply round-3 review on the Aone residuals

* fix(review): apply round-4 review on the Aone residuals

* fix(review): fail closed on unknowable host in composed receipt link (#9624)

* fix(review): route explicit GHE-family hosts to the GitHub reader

Platform detection selected Aone on ANY *.alibaba-inc.com host for
explicit --host/--remote signals, but a family host that is not the
canonical pair (ghe.alibaba-inc.com is the live example) is a GitHub
Enterprise instance — such a review authenticated against a1 and read an
unrelated same-numbered Aone MR instead of the GitHub PR body (and
test-plan additionally gated on a1 auth first). Explicit signals now
select Aone only via the canonical pair (code./gitlab.
alibaba-inc.com) — the same canonical-only rule the write gate has
always applied — while the family predicate survives on the
no-explicit-signal cwd-origin fallback. parse-args stops refusing
/pull/ URLs on GHE-family hosts (the same predicate misapplied: those
are real GHE PR URLs), and the five --host describe texts now name the
canonical pair.

Pins: registry.test.ts flips the GHE explicit-host expectation to
github, adds the explicit-remote and canonical-port arms, and keeps the
family cwd fallback; detection-side 592 + write-side 322 tests green.

* fix(review): fail closed on family-only /codereview/ URLs

AONE_CR_URL_RE captures the whole *.alibaba-inc.com family (shape-first
grammar), but a family-only host is a GHE instance that serves no
/codereview/ page: accepting its URL as a live target would let
detection route the explicit GHE host to GitHub and aim fetch/submit at
GHE PR #<id> — a target the supplied URL never named as a valid GHE
resource. The classifier now gates the aoneMatch branch on
isAoneCanonicalHost, so non-canonical /codereview/ inputs stay
invalid-url, mirroring the /pull/-on-canonical-Aone refusal. The mirror
arm is pinned too: a /pull/ URL on a family-only host parses as the
real GHE PR target it is.

---------

Co-authored-by: qwen-code-ci-bot <qwen-code-ci-bot@users.noreply.github.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
2026-08-22 12:55:25 +00:00
ytahdn
6bbb273a86
perf(web-shell): optimize streaming transcript rendering (#9672)
Some checks are pending
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 1/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 2/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 3/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 1/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 2/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 3/3 (push) Waiting to run
E2E Tests / E2E Test - macOS - shard 1/2 (push) Waiting to run
E2E Tests / E2E Test - macOS - shard 2/2 (push) Waiting to run
E2E Tests / channel-plugin E2E (nightly) (push) Waiting to run
E2E Tests / cron-interactive E2E (nightly) (push) Waiting to run
E2E Tests / web-shell Browser Regression (push) Waiting to run
npm cache producer / Save npm cache (push) Waiting to run
SDK Java / ubuntu-latest / Java 11 (push) Waiting to run
SDK Java / ubuntu-latest / Java 17 (push) Waiting to run
SDK Java / macos-latest / Java 21 (push) Waiting to run
SDK Java / ubuntu-latest / Java 21 (push) Waiting to run
SDK Java / windows-latest / Java 21 (push) Waiting to run
SDK Java / Real daemon E2E / Java 11 (push) Waiting to run
Security Checks / Secret scan (TruffleHog) (push) Waiting to run
Security Checks / Dependency CVE audit (push) Waiting to run
* perf(web-shell): optimize streaming transcript rendering

* test(web-shell): pin streaming fast paths

---------

Co-authored-by: 钉萁 <dingqi.jww@alibaba-inc.com>
2026-08-22 06:12:54 +00:00
易良
7703d1c310
docs: classify architecture invariants by enforcement mechanism (#9152) (#9689)
* docs: classify architecture invariants by enforcement mechanism (#9152)

Record the policy decision asked by #9152: which architectural invariants
are enforced mechanically, which are left to review, and which are not
worth enforcing. Covers every invariant asserted in AGENTS.md and every
open architecture issue (#8084, #9145, #9146, #9151, #4063).

The drift-guard decision: do not extract a reusable framework from
check-voice-guard-sync.js. The two new drift guards
(cross-package-contracts.test.js and approval-mode-drift.test.ts) share
a pattern but not enough structure to justify abstraction. The pattern
is documented for copy-when-needed.

* docs: correct guard references and complete the invariant inventory (#9152)

* docs: fix #9145 attribution and drift-guard line counts (#9152)

* docs: classify Web Shell UI conventions and reclassify Node engines (#9152)

* docs: cover the full Web Shell convention set without a count claim (#9152)
2026-08-22 02:47:53 +00:00
Shaojin Wen
7bc0d80998
fix(review): audit Aone targets in cleanup's bypass tripwire (#9633)
* fix(review): audit Aone targets in cleanup's bypass tripwire

Step 9's bypass audit already flags same-account writes on GitHub that
bypassed `qwen review submit`, but Aone targets had no tripwire at all —
cleanup audited them against GitHub (a hostless report hit github.com's
same-named repo; a recorded Aone host pointed gh at a host it has no
auth on). Route the audit by the fetch report's recorded host with the
registry's cwd-origin fall-through, list the MR's comments through the
a1 CLI (default + --resolved union — the default listing hides resolved
comments), and flag any comment the authenticated account posted — or
edited — inside the window that the submit receipt does not vouch for.
Submit now records a commentIds receipt axis (Aone's sanctioned write
posts comments, not a review) on success and on a partial post.

Closes #9617

* fix(review): preserve both receipt axes on the submit receipt rewrite

The submit receipt is keyed by PR number alone but carries an axis per
platform — review ids on GitHub, comment ids on Aone — and each writer
rebuilt the whole file from only its own axis. A submit on one platform
silently erased the ids the other platform's submit vouched for a
same-numbered target, and that platform's cleanup audit then flagged
submit's own sanctioned writes as bypasses. Merge the whole prior
receipt into the rewrite so both axes survive. Also flatten a1's
message-less JSON error object in the audit's skip note instead of
paging its opening brace, tag an unparseable `a1 auth whoami` answer
with the failing command, name the audit's third disclosed residual (an
edit of an unvouched pre-window comment is invisible once its
discussion is resolved), and pin the previously unwitnessed audit
contracts: the receipt vouch's edited-arm exclusion, the Aone
auditSince window boundary, the --resolved union's dedupe, the header
shape, and both footer platform nouns.

* fix(review): tag null whoami answers and disclose audit residuals (#9633)

---------

Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
2026-08-22 01:48:51 +00:00
Shaojin Wen
e2de7d2884
feat(web-shell): Bind GitHub PRs to sessions with sidebar badge and search (#9543)
* feat(web-shell): Bind GitHub PRs to sessions with sidebar badge and search

When a PR is created from the Web Shell Git dialog, bind its number and
URL to the current session. The daemon accepts the binding through the
session metadata routes (validated at the route, bridge, SDK, and sidecar
layers, with the URL restricted to http(s) since it is rendered as a link
target), keeps it in live memory, and persists it as a per-session sidecar
file so the binding survives daemon restarts and follows the session
through archive/unarchive/delete.

The sidebar renders a #N badge next to the session title (opening the PR
via the desktop-aware external-link opener, shows the PR in the details
tooltip, and the session search now also matches PR number, branch name,
and worktree slug — so with many concurrent sessions, the one that
produced a given PR is one search away.
EOF
)

* feat(web-shell): Support multiple PR bindings per session

A session can produce several PRs (stacked or follow-up work), and
keeping only the latest binding would defeat the sidebar's
search-by-PR-number flow for every earlier one. The binding is now a
bounded list (10, oldest dropped) ordered by binding time: re-binding
the same number refreshes it and moves it to latest, the badge shows
the newest number with a +N overflow, the tooltip lists every bound
PR, and search matches any of them. The write API stays single-binding
per call; reads, SSE events, and responses carry the full list, with
the sidecar as the complete history merged over the live entry's
daemon-lifetime bindings.

* feat(web-shell): Show PR badges in the session overview and picker dialogs

The mission-control overview panel and the shared session picker row
(resume / delete / release dialogs) now show the same PR badge as the
sidebar — latest number with a +N overflow, opening the PR via the
desktop-aware opener — and the resume dialog's search matches bound PR
numbers, branch names, and worktree slugs through the shared
sessionMatchesGitQuery helper.

* fix(web-shell): Match the overview PR badge color to the sidebar accent

The overview card badge used the panel's neutral --primary tint while
the sidebar and picker badges use the accent violet; one element should
read the same on every surface.

* fix(web-shell): Address review findings on PR bindings

Read/display correctness (verified by ytahdn and the R1 review):
- mergeLiveSessionSummary merged {..existing, ..live} wholesale, so a
  live entry's this-daemon-lifetime prs overwrote the sidecar-enriched
  full history after a restart; prs is now merged by PR number (live
  url wins, history kept), and the dead merge branch in
  enrichPrSidecars is gone.
- The pr-only session_metadata_updated event carried no displayName,
  which SDK folds treat as "cleared" — the title blanked on every PR
  bind. The producer now echoes the current name.
- GitDialog synced sessionIdRef from the prop on every render, so the
  fresh session id the dialog resolves for its own side queries was
  clobbered before the binding read it; the sync now runs only when
  the prop changes.

Robustness:
- upsertSessionPr's read-modify-write is serialized per sidecar path,
  closing the concurrent-bind drop race under runSharedMany.
- The REST routes persist the sidecar before mutating the bridge, so a
  failure on either side leaves the binding durable.
- The ACP dispatch only upserts when the call actually binds a PR (a
  displayName-only rename no longer rewrites createdAt/order).
- pr.url is capped at 2048 chars across all four validation layers.

Structure & a11y:
- The three badge copies (sidebar / overview / picker) are now one
  SessionPrBadge component: shared CSS, count-aware aria-label,
  non-http(s) entries filtered defensively, and tabIndex=-1 inside
  listbox options.
- The SDK's duplicated PR validator is a single session-pr module used
  by both DaemonClient and events.
- Delete/Release dialogs' search matches bound PR numbers like Resume.

Tests: list-level live+sidecar prs merge, sidecar-vs-bridge echo
authority, route tests made order-independent, bridge
atomicity/cap/catalog-revision/displayName-echo cases, concurrent
upsert serialization, SDK fold keeps the name, GitDialog bind-failure
degradation, url-cap rejections at every layer.

* fix(core): harden session pr sidecar persistence and moves (#9543)

* fix(serve): align session pr echoes with the persisted sidecar (#9543)

Address round-4 review findings:

- R4-1 (Critical): bridge entries are re-created without prs on daemon
  restart / close / archive-restore, so ACP and REST metadata updates
  replied and broadcast only this daemon lifetime's bindings, silently
  dropping persisted history. Hydrate the entry from the sidecar before
  the mutation (new optional bridge seedSessionPrs) and make the ACP
  handler reply with the authoritative persisted list like the REST
  routes, fixing both the response and the session_metadata_updated
  event on all three surfaces.
- R4-2 (Critical): the non-live metadata fallback persisted the rename
  before the PR sidecar while bumping the catalog revision only after
  both writes succeeded; a failed sidecar write stranded a durable,
  unannounced rename behind a total-failure response. Persist the
  sidecar first so a failed write leaves nothing durable behind.
- R4-3: map InvalidSessionMetadataError in toRpcError to the REST
  invalid_metadata contract instead of an opaque -32603 Internal error.
- R1-5: add the stderr audit record for pr binding mutations, mirroring
  the displayName branch (accepted in the round-2/3 thread).
- R2-4 (source part): make enrichPrSidecars' archiveState required so a
  future archived-listing call site cannot silently enrich from the
  active chats dir.
- R2-16: filter non-openable URL schemes in the session details tooltip
  exactly like SessionPrBadge.

* chore(desktop): regenerate bun.lock to match workspace versions

Main's desktop lockfile drifted: @craft-agent/electron and
@craft-agent/shared are 0.0.5 in the workspaces but 0.0.1 in the
lockfile, and the @qwen-code/live-host workspace entry is missing.
bun install --frozen-lockfile (the Live Host CI gate) fails on any
PR touching packages/sdk-typescript/src/daemon/types.ts because of
this. Regenerated with bun 1.3.x.

* fix(web-shell): address R2 review findings on PR bindings

- SessionPrBadge: narrow onKeyDown to Enter only so the badge no longer
  blocks roving-listbox navigation keys in picker dialogs (R2-15).
- SDK updateSessionMetadata: per-entry prs shape gate so a hostile or
  buggy daemon response cannot surface javascript: urls or malformed
  numbers downstream; valid entries survive (R1-17).
- Tests: bridge mirror atomicity (valid pr + invalid displayName),
  GitDialog stale-id retry binding, list-level merge dedupe by number,
  organized + archived listing paths keep PR sidecars, DaemonClient pr
  request/parse + gate, Delete/Release dialog PR-number search (R2-6,
  R2-13, R2-14, R1-15, R1-17, R2-20).

* fix(serve): address R5 review findings on PR bindings

Best-effort hydration (R5-1/R5-2/R5-3): the sidecar hydration read at
all three metadata-mutation sites (ACP dispatch, primary and workspace
REST routes) now absorbs non-ENOENT I/O errors as "no sidecar" instead
of failing the whole call — a squatted sidecar path no longer turns a
pr-less rename into a 500/-32603. This also makes the R4-2 fallback
ordering test reach the branch it names.

Validation hardening (R5-4): pr.url rejects control characters at all
four layers (bridge via hasControlCharacter, route, SDK guard, sidecar
reader) — the url is interpolated into the stderr audit line, so a
newline-bearing url could forge audit records.

Traversal parity (R5-5, R4-5): the ACP session/update_metadata handler
now gates on isValidSessionId before any sidecar I/O, and the primary
REST route's gate moved ahead of runtime resolution so traversal ids
get 400 invalid_session_id identically on single- and multi-workspace
daemons (previously 404 on multi-entry registries).

Tooltip (R5-6): PR rows key on index+number — a hand-edited sidecar
with duplicate numbers no longer risks cross-row reconciliation.

Tests: FakeBridge callLog pins seed-before-mutate order (R5-9);
cross-workspace pr sidecar lands in the owning workspace's chats dir
(R4-4); multi-workspace traversal test; metadata-filtered listing
keeps prs (R1-15); Resume dialog PR-number search (R2-20); dialog
fixtures annotated DaemonSessionSummary[] (R5-7/R5-8); control-char
rejection cases at bridge and sidecar layers.

---------

Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
2026-08-22 01:30:31 +00:00
易良
7a4566cb3b
fix(core): clarify Git requirement for public extensions (#9680)
Some checks are pending
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 1/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 2/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 3/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 1/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 2/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 3/3 (push) Waiting to run
E2E Tests / web-shell Browser Regression (push) Waiting to run
E2E Tests / E2E Test - macOS - shard 1/2 (push) Waiting to run
E2E Tests / E2E Test - macOS - shard 2/2 (push) Waiting to run
E2E Tests / channel-plugin E2E (nightly) (push) Waiting to run
E2E Tests / cron-interactive E2E (nightly) (push) Waiting to run
Security Checks / Dependency CVE audit (push) Waiting to run
Security Checks / Secret scan (TruffleHog) (push) Waiting to run
* fix(core): clarify Git requirement for public extensions

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(core): preserve secure Git version boundary

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-08-21 17:05:02 +00:00
Shaojin Wen
f1d05b79fc
feat(review): detect self-MR on Aone targets in presubmit (#9629)
Some checks are pending
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 1/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 2/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker - shard 3/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 1/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 2/3 (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none - shard 3/3 (push) Waiting to run
E2E Tests / web-shell Browser Regression (push) Waiting to run
E2E Tests / E2E Test - macOS - shard 1/2 (push) Waiting to run
E2E Tests / E2E Test - macOS - shard 2/2 (push) Waiting to run
E2E Tests / channel-plugin E2E (nightly) (push) Waiting to run
E2E Tests / cron-interactive E2E (nightly) (push) Waiting to run
npm cache producer / Save npm cache (push) Waiting to run
SDK Java / ubuntu-latest / Java 11 (push) Waiting to run
SDK Java / ubuntu-latest / Java 17 (push) Waiting to run
SDK Java / macos-latest / Java 21 (push) Waiting to run
SDK Java / ubuntu-latest / Java 21 (push) Waiting to run
SDK Java / windows-latest / Java 21 (push) Waiting to run
SDK Java / Real daemon E2E / Java 11 (push) Waiting to run
Security Checks / Dependency CVE audit (push) Waiting to run
Security Checks / Secret scan (TruffleHog) (push) Waiting to run
* feat(review): detect self-MR on Aone targets in presubmit

The self-PR verdict downgrade existed only for GitHub targets: the Aone
read path skipped presubmit entirely, so a review of one's own MR
silently carried the weight of an independent review (#9616) — exactly
the wrong direction for the most common local Aone flow, re-reviewing
one's own CR before the next amend.

presubmit now routes by platform. On an Aone target it compares the
authenticated account (a1 auth whoami) against the MR author from one
mr view fetch — case-insensitive, fail-soft on a deleted author,
fail-closed on an unreadable MR — and emits the same report shape with
the unbacked slices neutral (CI classification and comment dedup have
no Aone backing yet). The same fetch backs head drift via sourceBranch,
and a malformed pr_number/owner_repo stays a usage error rather than a
metadata blip. SKILL.md runs presubmit on Aone targets instead of
skipping it, and the "self-PR detection has no Aone backing" caveat is
gone from the skill and the user docs.

* fix(review): unify Aone live-head reads and the presubmit whoami gate

The round-1 review of the Aone presubmit found four seams the new path
had hand-derived a second time; each is now stated once:

- The self-PR comparison (including the load-bearing `author !== ''`
  guard) existed as two inline copies in presubmit.ts; isSelfReview
  states it once for both platform paths so a future normalization rule
  cannot diverge one platform silently.
- "An Aone MR's live head is mr view's sourceBranch" was hand-derived
  in five places in aone.ts, two of them untrimmed: a padded server
  value then manufactured a phantom "PR head advanced during review"
  (and a submit-time refusal) against the trimmed reads, for an MR that
  never moved. aoneHeadSha states the fact once; all five sites route
  through it, repairing the two untrimmed copies.
- The "same report shape as GitHub" invariant was convention only; both
  presubmit result literals are now typed against one PresubmitReport
  interface, so a field added to the envelope is a compile error on the
  path that forgets it instead of a silent toBool(false) at the
  consumer.
- The Aone path spawned `a1 auth whoami` twice per run (plain gate +
  JSON account read). The gate now runs the JSON whoami once and
  returns the account: one spawn per run, and no account fetch remains
  after the MR fetch that could throw uncaught and orphan the graceful
  metaUnavailable report — the fail-closed path pays no a1 work after a
  thrown mr view.

The padded-head regression cells for getPrMeta/getFetchMeta fail on the
pre-round code; the empty-guard, single-spawn, and report-shape
witnesses each fail under mutation probes. 4143 review tests green.

* test(review): pin Aone presubmit auth-gate throw path (#9629)

---------

Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
2026-08-21 14:15:27 +00:00
Shaojin Wen
04886c4354
fix(review): make the incremental cache work for Aone AGit-Flow CRs (#9630)
* fix(review): make the incremental cache work for Aone AGit-Flow CRs

* docs(review): qualify the Aone no-ancestry claims in comments and docs

The D7 comments described the ancestry gate as unconditional and both
ancestry tests as failing for every AGit-Flow update; the head test
alone fails for every amend (the clamp fires only on amend-plus-rebase),
and the narrowing join never lets a drift byte reach the published
scope. Qualify the ledger.ts SHA_RE block, the resolveIncrementalAnchor
docstring, the clamp-skip and call-site comments, the test-block
comments, and the design/user docs accordingly.

---------

Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
2026-08-21 11:06:59 +00:00
Shaojin Wen
0dd518f950
feat(review): disclose that Aone posts join the discussion gate only (#9625)
* feat(review): disclose that Aone posts join the discussion gate only

Aone has a dedicated ai_comment merge gate for AI-posted review
comments. A controlled probe on a scratch CR (issue #9614) resolved
the design doc's open question Q4: `a1 repo mr comment create` does
NOT auto-set isAiComment for the posting identity (a general and an
inline probe both read back false, re-checked against an async
classifier), and a1 v0.1.90 exposes no flag to request it — so
qwen-posted comments sit in the generic discussion gate only, and
the ai_comment gate never tracks them. The same probe re-confirmed
Q3: still no native reject/request-changes on the a1 mr surface.

Until a1 ships a marking flag (feature request to the a1 CLI), the
write path discloses the gate split instead of silently implying
participation: the Aone REQUEST_CHANGES note names the posted
comments as unflagged and the discussion gate as the only mechanical
block, and SKILL.md / the user docs carry the same fact.
createMrComment documents the constraint and is named as the seam
where a future marking flag wires.

* test(review): pin the directional ai_comment gate claim in the Aone disclosure note

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(review): bind the Aone gate-disclosure pins to content, call, and count source

---------

Co-authored-by: qwen-code-dev-bot <269191875+qwen-code-dev-bot@users.noreply.github.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-08-21 08:17:23 +00:00