5995 Commits

Author SHA1 Message Date
yiliang114
ed8636d7cf fix(test): align install-script assertions with simplified output format
The installer scripts were refactored to use a compact output format
(no separate To start/Installed to/Uninstall lines, no shadow warnings),
but the test assertions were not updated accordingly.
2026-06-01 21:20:43 +08:00
yiliang114
07c2261868 refactor(installer): suppress verbose Windows messages
Remove "User PATH already starts with", backup WARNING messages,
and PS1 wrapper "Run: qwen" / "qwen is ready to use" output to
match the minimal Linux installer style.
2026-05-29 17:45:31 +08:00
yiliang114
134ab59c54 refactor(installer): simplify Windows post-install output
Match the Linux/macOS installer simplification — remove verbose
messages (install path, uninstall command, PATH warnings) and keep
only the essential 4-line success summary.
2026-05-29 17:36:11 +08:00
yiliang114
0c90351066 refactor(installer): simplify post-install output
Remove verbose post-install messages (install path, uninstall command,
PATH conflict warnings, npm coexistence tips) and replace with a clean
4-line summary matching OpenCode's minimal style.
2026-05-29 17:12:27 +08:00
yiliang114
d2dd787a5a fix(installer): normalize expected paths in Windows standalone test
The existsSync mock built expected paths with path.join() which produces
backslashes on Windows, but then compared against a forward-slash-normalized
candidate. Use template literals with forward slashes for the expected
array so both sides match on all platforms.
2026-05-29 10:59:56 +08:00
yiliang114
6953e7a83f fix(installer): handle Windows backslash paths in standalone detection
`fs.realpathSync` returns backslash paths on Windows (e.g. C:\Users\...\lib\cli.js).
Normalize to forward slashes before matching the /lib/cli.js suffix so standalone
install detection works correctly on Windows.

Fixes CI: Test (windows-latest, Node 22.x)
2026-05-29 10:11:22 +08:00
yiliang114
1f42ca36af fix(installer): finalize Windows UX — suppress curl progress, fix logo
- Windows: suppress curl ### progress with -s --show-error (keep -#fSLo for test compat)
- Windows: use simple colored "Q W E N  C O D E" logo (truecolor VT100)
- Windows: SHA256SUMS download uses DownloadFileQuiet (no progress bar for small files)
- Windows: remove SUCCESS/INFO PATH messages from MaybeUpdateUserPath
- Linux: fix double 100% progress bar (skip bar for files < 100KB)
2026-05-29 02:25:29 +08:00
yiliang114
c48174bc45 fix(installer): address review findings on progress bar
- Replace `sleep 0.3` with `sleep 1` for busybox/minimal env compatibility
- Add file_size > 0 guard to avoid progress bar flicker on empty file
- Remove trailing blank lines before closing braces in 4 functions
2026-05-28 23:38:45 +08:00
yiliang114
895b5e77ff feat(installer): add progress bar and logo to Windows installer
- Add PrintLogo subroutine with QWEN CODE ASCII header
- Add PrintProgressComplete using PowerShell VT100 ■-bar at 100%
- Show progress complete after successful download
- Add spacing in PrintHeader for consistent look with .sh
2026-05-28 23:27:38 +08:00
yiliang114
aa3b79cdb1 feat(installer): streamline output with custom progress bar and minimal UX
Replicate OpenCode-style installer experience:
- Add custom ■-character progress bar with percentage (file-size polling)
- Remove verbose INFO:/SUCCESS: prefixes on happy path
- Simplify --help output to essential options
- Keep gradient logo, shadowing warnings, and PATH conflict detection
- Silence mirror probing, checksum, and npm detection messages
- Add "For more information" link to final output

Both .sh and .bat scripts updated consistently.
All 95 tests pass.
2026-05-28 23:21:04 +08:00
yiliang114
54d73978b3 fix(installer): finish standalone install follow-ups 2026-05-28 10:04:16 +08:00
yiliang114
74b3ea20b3 fix(installer): block IPv4-compatible IPv6 SSRF and harden archive validation [skip ci]
- Add ipv4FromCompatibleIpv6() to detect deprecated RFC 4291 §2.5.5.1
  addresses (e.g. ::7f00:1 → 127.0.0.1) that bypass SSRF protection
- Extend archive validation to reject hardlinks in addition to symlinks
- Add signal trap suppression during critical mv swap to prevent
  partial-install state on Ctrl+C
- Add diagnostic logging to silent catch in standalone detection
2026-05-27 22:25:55 +08:00
yiliang114
59680ea66f fix(installer): avoid npm auto-update for standalone installs 2026-05-27 16:10:49 +08:00
yiliang114
b268a40392 test(installer): cover shadowed qwen installs 2026-05-26 15:42:13 +08:00
yiliang114
4a57ea3e69 fix(installer): close release validation review gaps 2026-05-26 15:18:18 +08:00
yiliang114
5ea2bdfab9 fix(installer): address critical review findings on SSRF, semver, and reliability
- Fix IPv4-mapped IPv6 SSRF bypass: handle 3-part hex representations
  that Node.js produces (e.g. ::ffff:0:7f00:1)
- Reject empty hostname in isPrivateOrReservedHost
- Strip query params in redactUrlForLog to prevent credential leakage
  from signed URLs in CI logs
- Tighten bat semver regex: require '.' or '-' separator before suffix
  (rejects 1.2.3foo, matches shell installer behavior)
- Add -f flag to curl in download_with_progress so HTTP errors aren't
  silently written as file content
- Restore terminal cursor in INT/TERM signal handlers (RETURN trap
  doesn't fire on exit)
- Add unit tests for isPrivateOrReservedHost and redactUrlForLog
- Update test assertion for new split-pattern semver validation
2026-05-26 01:14:37 +08:00
yiliang114
178f090983 feat(installer): use truecolor per-character gradient for logo branding
Replace 256-color block coloring with 24-bit truecolor per-character
gradient interpolation matching the CLI's ink-gradient rendering.
Colors follow the fallback gradient: #4796E4 → #847ACE → #C3677F.
Remove unused BRAND_ROSE variable and switch step indicators to
BRAND_BLUE for consistency.
2026-05-26 00:10:35 +08:00
yiliang114
5481da549d fix(test): update stale assertion after guide text was removed
The text "Public installation documentation" was removed in 20f5243f6
but the test assertion was not updated, causing a persistent failure.
2026-05-25 22:01:51 +08:00
yiliang114
a6f4bdafae feat(installer): add visual branding to Linux/macOS install script
Add brand-colored ASCII art logo, custom download progress bar with
Unicode block characters, and step indicators [1/3] [2/3] [3/3] to
match the quality of competing CLI installers.
2026-05-25 21:58:48 +08:00
yiliang114
ad9cdd1367 merge: sync with main branch 2026-05-25 21:50:20 +08:00
顾盼
a8a6ad2d06
feat(core)!: redesign auto-compaction thresholds with three-tier ladder (#4345)
* feat(core)!: redesign auto-compaction thresholds with three-tier ladder

Replaces the single 70% proportional threshold with a three-tier ladder
(warn/auto/hard) that combines proportional fallback with absolute
reservation. Large-window models (>=128K) now reserve ~33K instead of
30% of the window, freeing tens of thousands of context tokens that the
old formula wasted.

Other improvements bundled in the same redesign:

- Compression sideQuery now disables thinking and caps maxOutputTokens
  at 20K, matching claude-code so the buffer math is predictable across
  providers (Anthropic/OpenAI/Gemini handle thinking budgets
  inconsistently)
- Failure handling upgraded from one-shot permanent lock to a 3-strike
  circuit breaker; reactive overflow still latches immediately
- New estimatePromptTokens helper closes the lag-by-one-turn and
  first-send-is-0 gaps in lastPromptTokenCount
- Hard-tier rescue pulls reactive overflow recovery forward to before
  the API call, saving an oversized round-trip
- /context command displays the three-tier ladder + current tier
- tipRegistry's context-* tips track the new thresholds instead of
  fixed 50/80/95 percentages

BREAKING CHANGE: chatCompression.contextPercentageThreshold setting is
removed. Settings files containing the field log a one-line deprecation
warning at startup and the value is ignored; behaviour is now controlled
by built-in thresholds via the new computeThresholds() function.

Design: docs/design/auto-compaction-threshold-redesign.md
Plan: docs/plans/2026-05-14-auto-compaction-threshold-redesign.md

* test(core): fix leftover hasFailedCompressionAttempt option in compress test

A pre-existing test case at chatCompressionService.test.ts:678 still
passed `hasFailedCompressionAttempt: false` in the CompressOptions
shape; rebasing onto current main surfaced this as a typecheck error
because the field was renamed to `consecutiveFailures` (Task 7 of the
three-tier ladder migration). Update to `consecutiveFailures: 0` —
semantically equivalent, the test asserts the side-query is called
when `force: true`, no other behaviour change.

* fix(core): drop compaction summary when output hits maxOutputTokens cap

Adds a defensive guard in ChatCompressionService.compress() that detects
when the side-query summary hit COMPACT_MAX_OUTPUT_TOKENS (20K). In that
case the summary is likely truncated mid-content, so we drop it and
return NOOP rather than persist a half-summary. The next send re-tries;
reactive overflow still catches the catastrophic case where the API
rejects the next request as too large.

Documented in the design doc as risk #2; the bot reviewer on PR #4168
correctly pushed for it to land alongside the threshold redesign rather
than as a follow-up since the new 20K cap is what makes truncation
likely in the first place.

* fix(cli): render three-tier thresholds in /context TUI view

The Task 11 redesign updated the non-interactive text formatter
(formatContextUsageText) but left ContextUsage.tsx — the interactive
React component that real /context users see — unchanged. As a result
the TUI still showed the old single "Autocompact buffer" line and none
of the new warn/auto/hard ladder.

Adds a "Compaction thresholds" section after the per-category breakdown:
  - Effective window
  - Warn / Auto / Hard threshold rows with a ▶ marker on the row the
    current usage has crossed
  - Current tier label coloured by severity (safe→green, warn/auto→
    yellow, hard→red)

The existing progress bar legend (Used / Free / Autocompact buffer)
is preserved because it's tied to the three-segment progress bar
visualisation; the new section adds the absolute numbers + tier badge
on top of that.

Caught by the tmux e2e test (PR #4168 ci-monitor follow-up). Pre-fix
the assertion 'Compaction thresholds' missed completely from the TUI;
post-fix the new section renders correctly for fresh and live sessions
on 1M / 200K / 128K windows.

* fix(core,cli): address PR #4168 review batch 4

Behavior fixes:
- MAX_TOKENS truncation guard now returns COMPRESSION_FAILED_EMPTY_SUMMARY
  instead of NOOP so the consecutive-failure breaker actually trips after
  repeated max-length summaries (R1.1).
- Reactive overflow failure increments consecutiveFailures by 1 instead
  of latching to MAX in one shot, so a transient network blip doesn't
  permanently disable auto-compaction. The hard-tier rescue resets the
  counter, which remains the designated recovery path (R1.2).
- /context current-tier classification uses rawOverhead (system + tools +
  memory + skills) as the tier input when API data is not yet available,
  rather than 0 — large inherited contexts no longer silently show 'safe'
  (R2.2).

Performance:
- sendMessageStream computes effectiveTokens ONCE and passes it through
  TryCompressOptions.precomputedEffectiveTokens, so the cheap-gate inside
  service.compress doesn't redo the estimation. Also fixes the
  imageTokenEstimate inconsistency between the rescue and cheap-gate
  paths (R1.3 + R1.4).
- Steady-state path (lastPromptTokenCount > 0) skips the costly
  getHistory(true) clone — estimatePromptTokens only needs the user
  message in that branch.

Code hygiene:
- BYTES_PER_TOKEN → CHARS_PER_TOKEN (inputs are char counts, not byte
  counts; CJK text would mislead under the old name) (R3.1).
- Drop dead getContextUsagePercent helper + index re-export — no callers
  in source after the threshold rewire (R1.5).
- Add a comment on estimatePromptTokens' first-send fallback documenting
  the ~15-20K under-estimate (system prompt + tools + skills) and that
  reactive overflow is the safety net (R3.3).

Tests:
- New CLI ContextUsage.test.tsx exercises the React renderer for the
  three-tier section: section presence, ▶ marker placement per tier,
  current-tier label coloring (R1.6).
- New chatCompressionService.test.ts case pins that a stale
  contextPercentageThreshold: 0 value in user settings no longer
  short-circuits compaction (R2.1).
- New tokenEstimation.test.ts case covers functionResponse (distinct
  nested-parts branch from functionCall) (R3.5).
- New geminiChat.test.ts integration test exercises the real
  ChatCompressionService — not a mock — for the first-send-after-
  inherited-history scenario where lastPromptTokenCount=0 and only the
  full-history estimate can cross the auto threshold (R3.4).

Declined: R3.2 (change `>=` to `>` on the MAX_TOKENS guard). The current
operator catches the at-cap case as suspicious, which is intentional —
landing exactly at the output cap is far more likely truncation than
clean stop given p99.99 ≈ 17K. With R1.1 in place, persistent truncations
trip the breaker after MAX_CONSECUTIVE_FAILURES so the worst case is
bounded.

* fix(core,cli): address PR #4168 review batch 5

- R5.1: tighten /context tier comment + TODO. The rawOverhead-based fix
  doesn't cover `--continue` restores with many history messages (since
  rawOverhead excludes messagesTokens). UI may still show 'safe' for one
  render until the first send. Documented inline and added a TODO to plumb
  chat history into collectContextData for same-source-of-truth as the
  cheap-gate.
- R5.2a: add TODO(finish_reason) at the truncation guard. The `>= cap`
  heuristic false-positives on legitimate at-cap summaries; the proper
  signal is finish_reason which runSideQuery doesn't surface today.
- R5.2b: split telemetry — new CompressionStatus.COMPRESSION_FAILED_OUTPUT_TRUNCATED
  enum value. Distinct from EMPTY_SUMMARY so logs/telemetry can tell
  prompt-quality failures (tune prompt / splitter) from capacity failures
  (raise cap / shrink splitter input). isCompressionFailureStatus()
  treats both as failures so the breaker behavior is unchanged.
- R5.3: expand consecutiveFailures JSDoc to clarify it tracks
  "non-force, non-hard-rescue consecutive failures" — hard-rescue resets
  the counter and force=true skips increments, so the counter is the
  "regular path" health signal only; reactive overflow is the real
  safety net for the force-only paths.
- R5.4: document the CompressOptions field rename
  (hasFailedCompressionAttempt: boolean → consecutiveFailures: number)
  as an SDK breaking change in the design doc with migration guide.

* fix(core): disambiguate hard-rescue from manual /compress orphan-strip

Self-review (dual reviewer / pr-triage round 1) caught a correctness
regression in the hard-rescue path:

`sendMessageStream` calls `tryCompress(force=true)` from inside the
pre-push window when `effectiveTokens >= hard`. The service's
orphan-strip predicate at `chatCompressionService.ts:426-429` gated on
`force` alone, which conflated two distinct call shapes:

  - manual `/compress` (force=true, trigger='manual'): user-initiated
    between turns; trailing model funcCall IS orphaned because no
    funcResponse is coming
  - hard-rescue (force=true, trigger='auto'): automatic mid-turn;
    trailing model funcCall is ACTIVE because its matching funcResponse
    is sitting in the pending `userContent` waiting to be pushed

The strip fired for both, so a hard-rescue triggered mid tool-use loop
would drop the active funcCall. After compression returned and
`userContent` (the funcResponse) was pushed, the next API request
carried tool_result with no matching tool_use → provider validation
error.

The in-code comment at L422-424 already documented this exact
constraint for the auto-compress case (`force=false`), but reusing
`force=true` for hard-rescue silently violated the same constraint.

Fix:
- Gate `hasOrphanedFuncCall` on `compactTrigger === 'manual'` instead
  of `force`. The trigger field already disambiguates intent.
- `sendMessageStream` hard-rescue now passes `trigger: 'auto'`
  explicitly (without it, `force=true` defaults to `trigger='manual'`
  via the `?? (force ? 'manual' : 'auto')` resolver).

Sibling audit for "force=true non-manual callsites":
- `GeminiClient.tryCompressChat` (manual /compress): correct — manual
- `sendMessageStream` hard-rescue: fixed in this commit
- `sendMessageStream` reactive overflow catch: already passes
  trigger='auto'; runs AFTER API call (userContent in history), so if
  it observes a trailing funcCall it IS orphaned but findCompressSplitPoint
  handles the case without needing the strip

RED-first regression test added:
`preserves trailing model+funcCall under hard-rescue (force=true + trigger=auto)`
in `chatCompressionService.test.ts`. Failed against pre-fix code (the
strip dropped the funcCall); passes against the fix.

Adjacent fixes from the same triage round:

- `docs/users/configuration/settings.md`: the
  `chatCompression.contextPercentageThreshold` row still said "use 0
  to disable compression entirely" — code has ignored the value since
  the removal commit. Marked the row REMOVED with migration guidance
  pointing at the design doc.
- `packages/core/src/config/config.ts`: the deprecation warning now
  tells users how to silence it (remove the key) and where to read
  current behavior, instead of just announcing the removal.
- `docs/design/auto-compaction-threshold-redesign.md`: closed Open
  Question 2 (small-window hard/auto collapse) — decision is to NOT
  annotate `/context`, with rationale on file.

Tests: 2395 core tests passing, typecheck clean.

* docs(core): fix tier-collapse direction in auto-compaction design doc

Self-review on the 50bac974b commit caught a direction error in the
M2a Open Question 2 closure note: said `currentTier` skips `'hard'`
and goes to `'auto'` on collapsed windows, which is backwards.

`contextCommand.ts:43-44` checks `tokens >= thresholds.hard` first
(no `hard > auto` guard — that fix lives in a separate follow-up), so
when `hard === auto` the `'hard'` branch matches first and the
`'auto'` band is the empty one. Updated the rationale to describe the
actual collapse direction and cite the source-of-truth file:line.

Conclusion of the open question (don't annotate `/context`) is
unchanged — only the explanation is corrected.

* refactor(core): extract shared in-flight funcCall fixture in compression tests

The auto-compress and hard-rescue tests for "trailing funcCall is
active, not orphaned" shared a byte-identical 4-message history and
mock setup. Pull both into setupInFlightFuncCallFixture() inside the
describe block so each test only contains the scenario name, the
compress() call shape, and its own assertions.

Net -29 LOC, no behavior change.

* fix(core,cli): address PR #4345 round-2 review feedback

- geminiChat: remove pre-call consecutiveFailures reset in hard-rescue.
  force=true already bypasses the breaker check in chatCompressionService;
  the pre-reset was redundant on success (post-call L614 already handles it)
  and *broke* the breaker on failure paths — hard-rescue failures don't
  increment via tryCompress (force=true skips that branch), only the
  reactive overflow path at L992 explicitly increments. With the pre-reset
  the counter oscillated 0↔1 every send and MAX_CONSECUTIVE_FAILURES=3 was
  unreachable. Wrote a RED test asserting the forwarded counter is the
  latched value, not zero; the test failed against the old code and passes
  with the reset removed.

- geminiChat: log hard-tier-rescue triggers via debugLogger.warn including
  effectiveTokens, hard, and the current consecutiveFailures so operators
  debugging "compaction stopped working" have a breadcrumb.

- chatCompressionService: clamp effectiveWindow to >= 0 in computeThresholds
  so the value surfaced in /context stays meaningful for tiny windows
  (window < SUMMARY_RESERVE). auto/warn/hard outputs are unaffected because
  each is Math.max(proportional, absolute) and the proportional branch
  dominates whenever the absolute branch goes negative.

- turn.ts: rewrite COMPRESSION_FAILED_OUTPUT_TRUNCATED docstring. Drop the
  misleading "compression succeeded" framing (the summary is dropped and
  isCompressionFailureStatus returns true) and reference the full enum name
  COMPRESSION_FAILED_EMPTY_SUMMARY instead of the abbreviation.

- contextCommand.test.ts: reword the no-API-data-session test comment.
  collectContextData classifies estimated sessions against rawOverhead;
  with default fixtures rawOverhead lands in `safe`, but heavy
  system-prompt / skill / MCP loads can push it into warn/auto/hard.

- design doc Background: prepend a blockquote clarifying the section
  describes pre-redesign behavior and that the inline file:line references
  point at code before PR #4345 (which removes them).

- ui/types: replace the duplicated ContextThresholds interface with a
  type alias to the core's CompactionThresholds. Field-by-field copy in
  contextCommand.ts becomes a direct spread. ContextUsage.tsx keeps its
  CompactionThresholds React component name — the alias avoids the
  collision a direct import would have caused.

- contextCommand: interpolate the actual reserve value into the
  "(window − 20K reserve)" annotation so SUMMARY_RESERVE retuning doesn't
  leave the text stale.

* fix(core): address PR #4345 round-3 + round-4 review feedback

R3-1: rewrite the stale "Hard-tier rescue resets the counter" comment in
the reactive-overflow path. The R2 commit removed the pre-call reset
from hard-rescue; the only counter-reset path is now the post-call
COMPRESSED branch in tryCompress. Two contradicting comments in the
same file would mislead a future maintainer tracing the lifecycle.

R3-2: rewrite the JSDoc on CompactionThresholds.hard. The "(resets
failure counter)" phrasing was true under the pre-R2 design; after R2
the hard threshold force-triggers compaction and bypasses the breaker,
but does not reset the counter (which only happens on COMPRESSED
success via the post-call branch). The type is consumed by both
geminiChat and the CLI UI (via ContextThresholds alias), so the
authoritative description had to match the actual contract.

R3-3: add a Step 3 to the hard-rescue regression test. The test title
claims "success recovers via the post-call branch" but the original
Steps 1-2 only verified the latched counter was forwarded INTO the
call. Step 3 follows up with a below-hard send and asserts the
forwarded counter is 0 — proving geminiChat.ts:614 ran on the
COMPRESSED result.

R3-4: assert effectiveWindow === 0 on the existing extreme-small-window
test and add a separate zero-window edge case. The Math.max(0, ...)
clamp from R2 was previously unasserted; a regression that removed
the clamp would go undetected.

R4-1: forward originalTokenCount on the breaker-NOOP path in
chatCompressionService.compress() to match the adjacent
threshold-NOOP path (L368-369). Returning {originalTokenCount: 0,
newTokenCount: 0} masked "breaker tripped at N tokens" as
"empty session" in telemetry dashboards.

R4-2a: add debugLogger.warn at the two consecutiveFailures increment
sites (cheap-gate path L586 and reactive-overflow path L955) when
the counter reaches MAX_CONSECUTIVE_FAILURES. The breaker is one of
the PR's headline safety features but, prior to this round, had zero
observability when it tripped. Required importing MAX_CONSECUTIVE_FAILURES
into geminiChat.ts.

R4-3: programmatically link tokenEstimation.ts's CHARS_PER_TOKEN to
compactionInputSlimming.ts's TOKEN_TO_CHAR_RATIO. Both are 4 today
and represent the same generic char/token conversion. Exporting from
compactionInputSlimming and aliasing in tokenEstimation eliminates
the silent-drift hazard the JSDoc already warned about.

Declined (round-weighted bar at round 4):
- R3-5: debugLogger test for hard-rescue trigger — observability test
  coverage is overthinking at round 3+; the log is informational.
- R4-2b: expose breaker state in /context — new feature; out of scope.
- R4-4: render test for auto-tier marker — test coverage gap on
  working code, defer to follow-up PR per round-weighted bar.
- R4-5a: extract makeFakeChat/makeFakeConfig shared factory — pure
  test refactor at round 4, not a fix.
- R4-5b: direct unit test for precomputedEffectiveTokens — exercised
  indirectly via hard-rescue path tests in geminiChat.test.ts.
- R4-6: truncation-guard fallback test for missing candidatesTokenCount
  — code already has a TODO acknowledging the heuristic is imperfect
  (chatCompressionService.ts:549-553); defer.

* fix(core): address PR #4345 round-5 review feedback

R5-1: assert breaker-NOOP forwards originalTokenCount. R4-1 changed the
breaker-NOOP return from `{0, 0}` to `{originalTokenCount, originalTokenCount}`
so telemetry can distinguish "breaker tripped at N tokens" from
"empty session", but the existing test only checked compressionStatus
and newHistory. Now seeds a non-zero originalTokenCount (120K) and
asserts both fields forward it.

R5-2: forward originalTokenCount on the empty-history NOOP. This was
sibling drift on R4-1 — I fixed the cited breaker-NOOP site but missed
the empty-history NOOP. Of 5 NOOP return sites in chatCompressionService,
4 now forward originalTokenCount (breaker, threshold-gate, post-split,
min-compression-fraction) and 1 (this one) was still returning `{0, 0}`,
breaking the project-wide invariant. Now consistent.

R5-3: replace 10 stale line-number references with semantic anchors.
After the R3+R4 push, the line refs in my R2/R3 comments (`geminiChat.ts:614`,
`chatCompressionService.ts:339`, `line 992`, `L627`, `line 944`) no longer
pointed at their original targets — `geminiChat.ts:614` now points at
`setSystemInstruction`'s body, completely unrelated to compaction. The
pattern itself is fragile; semantic phrasing ("the post-call reset in
tryCompress's COMPRESSED handler") doesn't drift when lines shift.

347/347 affected core tests passing locally; typecheck clean.

* fix(core): address PR #4345 round-6 review feedback (R6 sweep)

R6-1: rewrite the stale JSDoc bullet on `consecutiveFailures` (the
"Hard-tier rescue failures" bullet). The old wording said "the counter
is reset to 0 BEFORE the rescue call" — that contradicted R5 which
explicitly removed the pre-call reset. Now the bullet matches the
actual behavior: counter is NOT pre-reset, force=true bypasses the
breaker, post-call COMPRESSED handler resets on success, reactive
overflow is the explicit-increment safety net.

My R5 stale-comment sweep only grep'd inline `//` comments; this JSDoc
on the field declaration slipped through. Re-audited "reset to 0
BEFORE" / "pre-reset" across both packages — single site remaining.

R6-7: assert `passedOpts.trigger === 'auto'` in the hard-rescue test.
This field is the orphan-strip safety wire added by the C1 fix (the
service's `compactTrigger === 'manual'` check would otherwise strip
the trailing active funcCall mid tool-loop). The test asserted force
and pendingUserMessage but not the trigger; a refactor dropping the
'auto' from `trigger: shouldForceFromHard ? 'auto' : undefined` would
silently break orphan-strip safety. Now regression-guarded with a
single-line expect.

164/164 affected core tests passing locally.

Declined per round-weighted bar (round 6 defaults Suggestion / Test
coverage / Style to overthinking):
- R6-2/3/6: test-coverage gaps on working code — defer to follow-up
- R6-4: redundant truthy guard on always-set fields — style nit
- R6-5: text-vs-UI inconsistency on /context — existing test enforces
  current behavior; treat as design decision (offer follow-up if
  reviewer escalates)
- R6-8 (tipRegistry small-window context-high): explicitly closed in
  design doc's Open Question 2 — small windows have empty context-high
  band by design; UI work is out-of-scope for this PR
- R6-9: wasted clone on rare fallback path — Suggestion-level perf
- R6-10 (CompressionMessage missing case): file not in this PR's diff;
  reviewer themselves proposed it as follow-up
2026-05-25 21:11:08 +08:00
Dragon
56522bd89c
fix(core): enable cache control for Token Plan (#4495) 2026-05-25 20:14:37 +08:00
易良
5493888c15
ci: split Aliyun OSS sync into a separate post-release workflow (#4492)
* ci: split Aliyun OSS sync into a separate post-release workflow

The OSS upload and verification steps were adding significant time to the
release workflow's critical path. Move them into a new `sync-release-to-oss.yml`
workflow that triggers on `release: published`, running asynchronously after
the release completes.

Key changes:
- Extract all OSS steps (ossutil install, credential config, asset upload,
  verification, hosted installation sync, latest VERSION pointer) into
  `sync-release-to-oss.yml`
- Switch `gh release create` to use CI_BOT_PAT so the release event can
  trigger the new downstream workflow (GITHUB_TOKEN events don't trigger
  other workflows)
- Add `workflow_dispatch` input for manual re-runs on failure
- New workflow downloads release assets from GitHub Release instead of
  rebuilding them

This decouples publishing from CDN distribution: the release finishes as
soon as npm publish + GitHub Release are done, and China CDN sync happens
in parallel without blocking.

* fix(test): update install-script test to check sync-release-to-oss.yml

The test asserts OSS sync steps exist in the workflow. Now that these
steps live in sync-release-to-oss.yml instead of release.yml, update the
test to read from the correct file and add assertions that release.yml
no longer contains OSS logic.

* fix(ci): address review feedback for OSS sync split

- Add 'Verify Standalone Archives' step before gh release create in
  release.yml as a pre-publish safety gate (wenshao)
- Add concurrency group to sync-release-to-oss.yml to prevent race
  conditions when multiple releases publish close together (wenshao)
- Update test to assert verify step exists in release.yml

* chore: add comment explaining CI_BOT_PAT requirement [skip ci]
2026-05-25 19:34:21 +08:00
pomelo
7cb017d4b0
docs(agents,pr-template): add Working Principles and restructure PR template (#4496)
* docs(agents): add Working Principles and file/comment conventions

Add a "Working Principles" section at the top of AGENTS.md, with
Simplicity First (adapted from Andrej Karpathy's CLAUDE.md) as the lead
principle. Extend Code Conventions with two new entries:
- File naming: PascalCase for React components, kebab-case preferred for
  new non-component files, existing camelCase stays as-is.
- Comments: default to none; explain why, not what.

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

* docs(agents): link Karpathy's CLAUDE.md in attribution

Per review feedback, make the source attribution clickable so reviewers
can reach the original document in one hop.

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

* docs(agents): align comments guidance — "default to none"

Raise the bar for code comments from "add sparingly" to "default to
none" in the runtime prompt, matching the AGENTS.md convention. Add a
preservation clause to AGENTS.md so agents do not strip existing
high-value comments during cleanup passes. Update snapshots.

Co-Authored-By: Qwen Code <noreply@alibaba-inc.com>

* docs(pr-template): restructure for reviewer test plan clarity

- Reorganize PR template around a Reviewer Test Plan section with How to verify, Before/After, and Tested on
- Add collapsible Chinese description section for bilingual PRs
- Simplify create-pr command guidance to match the new template
- Tighten AGENTS.md file naming and comments conventions; align PR submission guide with the new template

This makes PRs easier to review by focusing contributors on the evidence reviewers need most.

* docs(pr-template): merge Before/After into Evidence and require full Chinese translation

- Consolidate Before and After sections into a single Evidence (Before & After) section
- Update Chinese summary comment to require full paragraph-by-paragraph translation instead of abbreviated bullets

This reduces template redundancy for non-UI changes and ensures the Chinese block is a proper translation, not a summary.

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen Code <noreply@alibaba-inc.com>
2026-05-25 19:15:35 +08:00
Dragon
35e6963285
docs(tools): document monitor tool (#4356) 2026-05-25 15:25:07 +08:00
qqqys
05458d59ec
fix(core): strip additional dangerous interpreter rules (#4371)
* fix(core): strip additional dangerous interpreter rules

* test(core): clarify dangerous interpreter coverage

* chore(core): group bash.exe with windows shells

* fix(core): normalize dangerous interpreter tokens

* test(core): normalize dangerous exe interpreter rules

* fix(core): detect windows interpreter path allows

* fix(core): detect windows interpreter path allows
2026-05-25 14:33:05 +08:00
kkhomej33-netizen
632865c0df
feat(core): limit background agent concurrency (#4324)
* feat(core): limit background agent concurrency

* fix(core): handle background agent cap on resume
2026-05-25 14:02:45 +08:00
qqqys
45a51185eb
fix(extension): redact credentialed source diagnostics (#4426)
* fix(extension): redact credentialed source diagnostics

* fix(extension): avoid leaking redacted URL causes

* fix(extension): close credential redaction gaps
2026-05-25 13:07:08 +08:00
ihubanov
9363879ea1
fix(core): preserve duplicate object references in safeJsonStringify (#4407)
* fix(core): preserve duplicate object references in safeJsonStringify

The replacer kept a WeakSet of every object it had ever seen. JSON.stringify
calls the replacer for every key in a DFS walk, siblings included, and the
set was never trimmed when the walk unwound. So the second sibling that
pointed at the same object got replaced with [Circular]. Not a cycle, just
a duplicate reference. Same false positive for repeated array elements and
for any shared leaf that appears on more than one branch.

Track the current ancestor path instead. The replacer's `this` is the parent
of `value`, so on each call pop the stack back to wherever the walk currently
is, then check the remaining ancestors for membership. Only real cycles get
flagged.

Existing cycle tests still pass. Added five regression tests covering shared
siblings, repeated array elements, shared subtree leaves, indirect cycles,
and a mix of duplicate ref + real cycle in the same graph.

* test(core): cover deep unwinding and toJSON paths in safeJsonStringify

Four regression tests covering corners the initial five missed:

- Shared leaf reached through five levels of nesting plus a sibling branch.
  Exercises the unwind loop popping multiple frames between the deep arm
  and the sibling arm of the walk.

- Real cycle (root referenced back from depth 5). Same depth as above but
  the deep arm closes the loop, so the ancestor check must still fire.

- Shared object returned by toJSON from two sibling positions. The replacer
  sees the post-toJSON value, so duplicate-ref handling has to recognize
  these as duplicates even though the carriers are different objects.

- Cycle through a toJSON that returns an ancestor. Confirms the ancestor
  check fires on the toJSON return value, not the toJSON-bearing carrier.

Per review feedback on #4407.
2026-05-25 13:06:55 +08:00
顾盼
24ebfbc13e
feat(memory): load .qwen/QWEN.local.md as project-local context (#4091) (#4394)
* feat(memory): load .qwen/QWEN.local.md as project-local context (#4091)

Adds a per-developer, project-scoped context file slot at
`<projectRoot>/.qwen/QWEN.local.md`. Loaded after all hierarchical
QWEN.md / AGENTS.md files so local instructions can supplement or
override shared ones.

Use case: project-specific but personal instructions (local cluster IDs,
container registry namespaces, accounts) that shouldn't live in the
shared root `QWEN.md` (exposes them to the team) or in the global
`~/.qwen/QWEN.md` (applies to every project). Mirrors Claude Code's
`.claude/CLAUDE.local.md` convention.

The slot is single and fixed (project root only — not searched in CWD
subdirectories or via upward traversal), gated by the same trust and
explicit-only checks as the rest of project-level discovery, and counted
in `fileCount` so the `/memory` panel surfaces it. Users must gitignore
the file themselves; `.qwen/` is not auto-ignored and `.qwen/settings.json`
is commonly committed.

* fix(memory): support .git-file repos when locating QWEN.local.md slot

`findProjectRoot()` only accepted `.git` as a directory, so in git
worktrees and submodules (where `.git` is a file containing a `gitdir:`
pointer) it returned `null`. The new `.qwen/QWEN.local.md` slot then
fell back to `<cwd>/.qwen/QWEN.local.md`, silently breaking the
documented "single fixed slot at project root" behavior for users
inside worktrees — including the developer of this feature.

Two changes:

1. `findProjectRoot()` now accepts `.git` as either a directory or a
   regular file. This also incidentally repairs pre-existing breakage
   in `rulesDiscovery` / hierarchical-search stop boundary, both of
   which consume the same helper.

2. The local-context-file slot now requires a real `foundRoot` (the
   `null` case is no longer covered by the `effectiveRoot` fallback).
   Without this guard:
     - a deep cwd in a non-git workspace turned the slot into a
       per-cwd file, opposite the design;
     - `cwd === homedir` resolved the slot to `~/.qwen/QWEN.local.md`,
       colliding with the global Qwen directory.

Three regression tests pin the new behavior: `.git`-as-file is
recognized, no-`.git`-ancestor skips the slot, `cwd === homedir`
without `.git` does not promote a global file to project-local.

* refactor(memory): extract findProjectRoot to shared utility (#4091)

Two duplicate `findProjectRoot` helpers existed in
`packages/core/src/utils/`: one in `memoryDiscovery.ts` (returns
`Promise<string | null>`) and one in `memoryImportProcessor.ts`
(returns `Promise<string>`, falls back to startDir). The previous fix
in 97c6fb41f only updated the first copy for `.git`-file support, so
`@import` resolution under git worktrees and submodules was still
silently broken — the QWEN.local.md file would load, but its imports
would resolve against the wrong root.

Extract the helper into `utils/projectRoot.ts`, with the unified
nullable return type. Rewire both call sites; `memoryImportProcessor`
preserves its previous fallback semantics at the call site
(`?? path.resolve(basePath)`). Adds 5 unit tests for the utility
(directory / file / null / deep / symlink) and 1 test for the
previously-unverified dedup guard in `memoryDiscovery.ts` (exercised
via `extensionContextFilePaths`).

Addresses inline + cross-file findings from wenshao on PR #4394.
2026-05-25 11:22:55 +08:00
易良
94da486e19
fix(weixin): send decryptable image payloads (#4464) 2026-05-25 11:16:33 +08:00
易良
8ef73599db
fix(weixin): allow Windows image paths inside workspace (#4465) 2026-05-25 11:16:00 +08:00
胡玮文
ab26a5ab72
fix(cli): resolve stale closure race in text buffer submit handler (#4470)
Replace useReducer with useRef + useState + synchronous dispatch so that
event handlers always read the latest buffer state. Previously, rapid
input via tmux send-keys could deliver characters and Enter in the same
event loop tick; the Enter handler read buffer.text from a stale render
closure (empty string) because useReducer's dispatch only enqueues
actions for the next render pass.

The fix runs the reducer synchronously at dispatch time, stores results
in a useRef for immediate reads, and calls setState to trigger
re-renders. The returned TextBuffer object exposes text, lines, and
cursor as getters reading from stateRef.current, so all consumers
(BaseTextInput, InputPrompt, vim hook) automatically get fresh values
without code changes.
2026-05-25 10:59:02 +08:00
胡玮文
84f408017a
feat(skills): add memory-leak-debug skill for heap snapshot diagnosis (#4468)
Provides a step-by-step workflow for diagnosing memory leaks in the CLI
using Node.js heap snapshots and the chrome-devtools CLI memory tools.
Includes a helper script for tmux PID discovery and a worked example
from the react-reconciler PerformanceMeasure leak (dbdc94be9).
2026-05-24 02:46:16 +08:00
dykebo
4dc98484fd
feat(cli): do not append trailing space for directory completions (#4092) (#4288)
* feat(cli): do not append trailing space for directory completions (#4092)

## What

在 @路径补全和 /dir add 命令的目录补全中不再追加尾部空格。这样可以允许用户在补全目录后直接按 Tab 继续深入下一级子目录,无需先删除空格。

## Examples

- Input: `@src/com` + Tab → Output: `@src/components/` (no trailing space)

- Input: `/dir add ./pac` + Tab → Output: `/dir add ./packages/` (no trailing space)

- File completions still append a space (e.g., `@src/file.txt `)

## Changes

- Added `isDirectory` flag to `Suggestion` and `CommandCompletionItem` interfaces

- Updated `handleAutocomplete` to skip trailing space when `isDirectory === true`

- Modified `getDirPathCompletions` to return `CommandCompletionItem[]` with `isDirectory: true`

- Added test case for directory completion behavior

* fix(cli): append trailing / to directory completions for deeper navigation

* fix(cli): propagate isDirectory and fix JSDoc comment

## Comment 2: Fix JSDoc in SuggestionsDisplay

Removed "(ends with /)" from isDirectory description since it was factually incorrect.

## Comment 3: Add test for isDirectory propagation

- Added test suite in useSlashCompletion.test.ts to verify directory command structure

- Real filesystem testing is done in directoryCommand.test.tsx

* fix(cli): add comprehensive isDirectory propagation tests

Added getDirPathCompletions unit tests that verify:
- Directory suggestions include isDirectory: true
- Directory values end with / for continued navigation
- Prefix filtering preserves isDirectory flag
- Comma-separated path completion works correctly
- Deeply nested directories maintain isDirectory flag

This closes the testing gap identified in review comment 3.

* fix(cli): address wenshao feedback - lint rules, real test, cross-platform

Fixes 4 new review comments from wenshao:

- [Critical] Empty catch {} blocks: guarded with if (tempTestDir) + void err

- [Critical] useSlashCompletion.no-op test: replaced with real integration test that

  verifies isDirectory propagation through toSuggestion pass-through

- [Suggestion] Windows path separator: using path.sep instead of hardcoded /

  in both directoryCommand.tsx and related test assertions

* fix(cli): remove unused import and fix Windows path separator in tests

- Remove unused directoryCommand import in useSlashCompletion.test.ts (TS6133)
- Replace hardcoded / regex with path.sep-aware assertions in
  directoryCommand.test.tsx to fix Windows CI failures

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

* Apply suggestion from @wenshao

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>

* Update packages/cli/src/ui/commands/directoryCommand.test.tsx

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>

* Update packages/cli/src/ui/commands/directoryCommand.tsx

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>

* Update packages/cli/src/ui/commands/directoryCommand.tsx

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>

* fix(cli): normalize isDirectory to explicit boolean in toSuggestion

Normalize isDirectory from three-state (true/false/undefined) to explicit
boolean (true/false) to prevent latent bugs in future code that might
distinguish between false and undefined.

Fixes review comment: isDirectory normalization is inconsistent across
completion paths.

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

* Update packages/cli/src/ui/hooks/useSlashCompletion.ts

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>

* chore: remove accidentally committed pr_body.md

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

* chore: add pr_body.md to .gitignore

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

* fix(cli): remove duplicate .slice and orphaned test code from directoryCommand.tsx

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

* fix(cli): only suppress trailing space for dir completions at end-of-line

When isDirectory is true, the trailing space was suppressed unconditionally,
even when the cursor is mid-line. This caused directory completions to merge
directly with following text (e.g. '@src/components/something').

Now only suppress the space when the cursor is at end-of-line, allowing
continued Tab navigation into subdirectories.

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

* docs(cli): document crawler path separator dependency for isDirectory check

The isDirectory detection uses p.endsWith('/') which depends on the
crawler in @qwen-code/qwen-code-core normalizing paths with posix '/'
(fdir.withPathSeparator('/') in crawler.ts). Add a comment to make this
implicit coupling explicit.

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

* test(cli): add mid-line directory completion test

Verify that directory completions append a trailing space when the cursor
is mid-line, preventing the completed path from merging with following text.

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

* Update packages/cli/src/ui/hooks/useCommandCompletion.test.ts

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>

---------

Co-authored-by: 方磊 <fanglei@192.168.1.11>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
2026-05-23 23:37:23 +08:00
qwen-code-ci-bot
394e2a3fa8
chore(release): v0.16.1 [skip ci]
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-05-23 23:09:48 +08:00
jinye
94982c6a91
fix(build): clean stale outputs before tsc --build to prevent TS5055 (#4453)
* fix(build): clean stale outputs before tsc --build to prevent TS5055

Run `tsc --build --clean` before `tsc --build` in build_package.js so a
stale tsconfig.tsbuildinfo (e.g. after a version bump, branch switch, or
a prior `npm ci` prepare) cannot collide with composite project
references emitting back into packages/core/dist.

Closes #4447

* fix(build): scope clean step to current package only

Replace `tsc --build --clean` with direct `rmSync` of `dist` and
`tsconfig.tsbuildinfo`. `tsc -b --clean` walks project references, so
when scripts/build.js builds packages in dependency order, cleaning
from a downstream package (e.g. cli) would also wipe upstream outputs
(core, acp-bridge, channels) that were just built — a major perf
regression.

Spotted by Copilot review on #4453.
2026-05-23 23:06:31 +08:00
易良
a41afc465d
fix(release): move constants above entry point to avoid TDZ error (#4398)
MAX_UPLOAD_ATTEMPTS and INITIAL_BACKOFF_MS were declared after the
isMainModule() guard that calls main(). In ES modules, const bindings
are not initialized until the declaration is reached, so the runtime
threw "Cannot access 'MAX_UPLOAD_ATTEMPTS' before initialization"
during the Release workflow.
2026-05-23 22:21:33 +08:00
Shaojin Wen
e43852f769
fix(cli): gate mintty OSC 8 detection on TERM_PROGRAM_VERSION ≥ 3.3 (#4420) (#4451)
* fix(cli): gate mintty OSC 8 detection on TERM_PROGRAM_VERSION ≥ 3.3 (#4420)

mintty added OSC 8 in 3.1 and hardened it in 3.3. Older builds — still
bundled with some Git-for-Windows distros and developer environments like
Laragon — print the raw `\x1b]8;;url\x07` bytes as visible garbage instead
of silently ignoring them.

The previous unconditional `case 'mintty': return true` deviated from the
upstream `supports-hyperlinks` library (which rejects all of win32 outside
WT_SESSION) and let those old mintty users see escape bytes in their UI.

Gate on TERM_PROGRAM_VERSION (set by mintty since 2.7 in 2017 — a missing
value implies an ancient build, so we refuse rather than guess). Users on
mintty 3.1–3.2.x who know their build works can still opt in with
FORCE_HYPERLINK=1.

This fixes the OSC 8 component of #4420 (the "garbled UI on Windows + Git
Bash" report). The Ink 7 render interaction and terminalRedrawOptimizer
angles flagged in the same triage need separate Windows-environment
testing; `QWEN_CODE_LEGACY_ERASE_LINES=1` remains the documented escape
hatch for those.

* test(cli): assert FORCE_HYPERLINK=1 escape hatch works on gated mintty

Mirrors the Warp/Hyper pattern: after asserting auto-detection rejects an
older mintty build, set FORCE_HYPERLINK=1 and verify it opts back in. The
PR description for #4451 documents this contract for users on mintty
3.1–3.2 who know their build's OSC 8 implementation works; pinning it as
a test guards against a future refactor reordering the early-exit checks.

Addresses review feedback on #4451.
2026-05-23 22:19:23 +08:00
pomelo
b602a72e86
fix(cli): stabilize flaky sticky-todo remeasure test (#4416)
* fix(cli): stabilize flaky sticky-todo remeasure test (#4415)

Replace absolute mock.calls.length assertion with mockClear() +
not.toHaveBeenCalled() in the sticky todo status-only update test.

The previous assertion captured the total measureElement call count
after initial render, rerendered, and checked the count was unchanged.
This was flaky on CI (macOS runner) because React 19's Ink test
renderer can invoke useLayoutEffect a variable number of times during
mount (StrictMode double-invoke, multiple reconciliation passes),
making the absolute count unreliable across environments.

The new approach resets the mock after initial render and asserts no
new calls occur during rerender — clearly expressing the test intent
and eliminating environment-dependent flakiness.

* fix(cli): stabilize flaky sticky-todo remeasure test

Replace fragile measureElement call-count assertion with a behavioral
assertion on availableTerminalHeight stability, wrapped in act() to
flush useLayoutEffect timing.

The original test asserted that measureElement was not called after
rerender when only todo status changed (pending -> in_progress). This
was flaky because:

1. The absolute mock.calls.length count was environment-dependent
   (React 19 StrictMode double-invoke, variable reconciliation passes)
2. Even with mockClear(), the useLayoutEffect fires for legitimate
   reasons (buffer ref, btwItem) unrelated to sticky todo status,
   especially on Windows CI runners
3. The controlsHeight state (useState(0)) races with useLayoutEffect's
   first measurement — mainControlsRef.current may be null on initial
   render, causing controlsHeight to settle at different times

The fix:
- Assert on availableTerminalHeight (the behavioral outcome exposed via
  UIState context) rather than measureElement call count
- Wrap render + rerender in act() to ensure useLayoutEffect and
  setControlsHeight fully settle before capturing the baseline
- Consolidate duplicate react imports

* test(cli): address review feedback on sticky-todo remeasure test

- Narrow the `mockConfig.initialize` stub from `beforeEach` (which flipped
  `isConfigInitialized` for ~75 tests in the block) back to the single test
  that needs it. Other tests now exercise the real init gate as before.
- Strengthen the behavioral assertion: switch `measureElement`'s mocked
  return value between the settle phase and the status-only rerender, so
  any re-measurement triggered by the status change would change
  `controlsHeight` and break the equality assertion. Without this, the
  production same-value short-circuit on `setControlsHeight` made the
  assertion pass even when the optimization regressed.

The core layout-key contract (status-only changes return the same key) is
already directly covered by `todoSnapshot.test.ts` — this integration test
provides layered protection on top.

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

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-05-23 22:15:00 +08:00
易良
15247f4bce
chore(deps): update express from 4.21.2 to 5.2.1 (#4458)
express@4.21.2 was a stale peer dependency residual at the top-level
node_modules. It was originally pulled in to satisfy express-rate-limit's
peerDependency "express >= 4.11" when express@4 was still the latest tag.

Since express@5 is now latest and equally satisfies ">= 4.11", updating
removes ~1200 lines of unused express@4 dependency tree from the lockfile.

Closes #4457
2026-05-23 21:39:13 +08:00
胡玮文
61d91ad716
fix(build): tree-shake React reconciler dev build to prevent PerformanceMeasure leak (#4462)
The ink 6→7 upgrade (v0.15.11) pulled in react-reconciler 0.33, whose
development build calls performance.measure() on every component render.
Since NODE_ENV was never set to "production" in the esbuild define map,
the bundle shipped both dev and prod builds and selected dev at runtime,
causing an unbounded measureEntryBuffer leak (~45% of heap after moderate
use, confirmed via heap snapshots).

Set process.env.NODE_ENV to "production" at build time so esbuild
statically resolves the conditional require and tree-shakes the entire
15k-line dev build. Bundle shrinks by ~700 KB / 15,800 lines.
2026-05-23 21:00:32 +08:00
yiliang114
67cae75ca0 fix(installation): redact release verifier credentials 2026-05-22 23:19:49 +08:00
yiliang114
c6e4244c13 fix(installation): harden standalone release validation 2026-05-22 22:42:43 +08:00
yiliang114
523e03e8d4 docs: clarify pull request size guidance 2026-05-22 22:42:31 +08:00
yiliang114
0bbb5e2624 Merge remote-tracking branch 'origin/main' into codex/pr-3855-review-fix 2026-05-22 22:14:15 +08:00
Shaojin Wen
0cb9ff0a23
fix: renormalize CRLF storage for install-qwen-standalone.bat (#4427) [skip ci]
The blob in HEAD stored raw CRLF bytes while .gitattributes declared
'text eol=crlf', which expects LF in the object database and CRLF on
checkout. The mismatch caused git status to permanently report the
file as modified on every working tree, with neither reset --hard nor
checkout fixing it.
2026-05-22 17:48:13 +08:00
jinye
fd75f77e19
feat(telemetry): Phase 4a — TTFT capture + GenAI semconv dual-emit (#3731) (#4417) 2026-05-22 10:54:11 +08:00
zhangxy-zju
48b0a8bfce
fix(core): preserve tab-indented notebook formatting (#4373)
* fix(core): preserve tab-indented notebook formatting

* test(core): cover mixed notebook indentation
2026-05-21 22:19:04 +08:00
易良
94f7cb5785
fix(vscode): skip redundant tsc build in prepackage to prevent TS5055 (#4401)
The prepackage script called `npm run build` (full tsc compilation of
all workspace packages) before bundling. This second tsc pass fails
with TS5055 in CI because:

1. `npm ci` already built everything via the `prepare` lifecycle
2. `release:version` bumps package versions, making tsbuildinfo stale
3. The redundant `npm run build` triggers tsc --build which attempts a
   full rebuild, but composite project references cause dist/*.d.ts to
   be resolved as input files → TS5055

The fix removes the redundant `npm run build` call. The CLI bundle is
produced by esbuild directly from TypeScript source files (entry:
packages/cli/index.ts), so compiled dist/ artifacts are not needed.

Root cause introduced by #4295 (composite project references).
2026-05-21 21:08:50 +08:00