Skip to content

fix: backport #31568, #31953, #32236, #26497 to 0.12.1 - #33748

Closed
chenmingwei23 wants to merge 4 commits into
release/0.12.0from
backport/0.12.1-crewlog-perf
Closed

chenmingwei23 wants to merge 4 commits into
release/0.12.0from
backport/0.12.1-crewlog-perf

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Ship 3 crew-log write-path performance fixes and 1 chat localization fix that merged to main after the 0.12 cut to 0.12.1 users.

Why it matters

On 0.12, every queued crew-log append pays its own write and fsync, all sessions share one writer, and the board relay decision runs on that writer thread. Busy crews see log writes back up behind each other. Separately, gateway status rows built outside the dashboard (a discarded queued message, a turn timeout, an eager-spawn stop, restart/close interruptions) stay in English on a non-English dashboard.

Not a goal

  • No fix beyond these 4. Other main fixes go in their own batches.
  • No CI, test-only, docs-only or dev-tooling commits.

What changed (motivation -> approach -> change)

One git cherry-pick -x of each main merge commit, on release/0.12.0 at d684523f65. The 3 crew-log commits depend on each other and on #31415 (already on the branch as b628d827ae), so they go in this order:

# PR Main merge commit What users hit
1 #31568 7b34f182ba each queued crew-log append for a session did its own write and fsync
2 #31953 39b0c928ed all sessions' crew-log writes waited on one writer; now up to four lanes
3 #32236 3686b1ce7f the board relay decision ran on the writer thread and delayed writes
4 #26497 665858eabb gateway status rows composed outside the dashboard were not localized

#31568, #31953 and #32236 picked cleanly.

Conflict resolution in #26497 (test and catalog files only; no source file conflicted):

Backwards compatibility

Compatible. The crew-log changes keep the on-disk log format and the order of entries within a session. #26497 adds meta.notice / meta.notice_args to existing rows and keeps their English content byte-identical for channel mirrors and SSE readers. Each main PR states its own compatibility.

Removes nothing: no field, API, key or config is removed.

Tests

Run on this branch at c445defc77, in a clean Python 3.12 venv (uv sync --frozen --all-extras --python 3.12), with a temp KIROCREW_HOME, pytest -n 2, over every test file the 4 source PRs added or changed:

  • test/test_crew_log_cut_counter.py, test/test_crew_log_emit_write_path.py, test/test_crew_log_relay_feed.py, test/test_crew_log_writer_group_commit.py, test/test_crew_log_writer_lanes.py, test/test_gateway_notice_sites.py, test/test_queue_discard_sender_notice.py, test/test_session_turn_timeout.py, test/test_transient_notice_parity.py, test/test_turn_dispatch.py: 263 passed
  • website/src/test/gatewayNotice.test.tsx (vitest run): 130 passed
  • tsc -p tsconfig.app.json: clean; check-i18n-strings.mjs: OK (218 untranslated, baseline 332)
  • flake8, isort --check-only on the 42 touched Python files: clean; mypy on the 32 touched source files: Success: no issues found in 32 source files

Proof: not provable -- other: a cherry-pick batch of already-merged main fixes, each proven in its own main PR

Manual verification

N/A: each fix was verified in its own main PR, and this batch carries them with only the test-count resolution above.

Screenshots / video

Why no screenshot: the #26497 frontend pick carries the same rendered change as its main PR, which shows it.

Related Issues

0.12.1 backport batch: #31568, #31953, #32236, #26497.

Checklist

  • Each commit is a cherry-pick -x of a main commit with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

chenmingwei23 and others added 4 commits November 9, 2026 06:22
…one fsync (#31568)

On a loaded host every syscall of a crew-log append re-takes the GIL, and the
single writer thread paid the whole lock/stat/open/write/fsync sequence per
entry. A pass now writes a session's consecutive run of plain `_write` entries
with one `CrewLog.append_many` (one lock, one tail read, one write, one fsync)
and acknowledges each member only after that call returned.

- writer: `GroupPart` on an APPEND job; a run fails, retains and drops as a
  whole; a refused run is retried one job at a time; ungrouped jobs are
  barriers; `group_max_entries` caps a run and skips the window when full.
- writer: a waiting `flush()` skips the batching pause; a synchronous caller
  hands its job over when the writer thread is already running instead of
  waiting up to 5 s for it to go idle.
- store: an append whose rollback failed (IndeterminateAppend) has its bytes
  cut under the lock before the path's next append, so a retry does not land
  the run twice. Only line-end digests are kept, for at most 64 files.

Part of #31502

Co-authored-by: Raymond Chen <chenmingwei23@users.noreply.github.com>
(cherry picked from commit 7b34f18)
…riter lanes (#31953)

The crew-log writer drained every session on one executor thread, so one
slow session's fsync held every other session's appends behind it, and on a
GIL-contended host the single thread got a small share of the interpreter.

Up to WriterLimits.lanes (4) drain loops now share the buffer on a pool with
one worker per lane. A pass claims one session at a time and holds it until
its batch is written, retained or dropped; a held session is claimed by no
other lane and written inline by no caller, so each session still has one
writer and keeps its order. The units of one slot share one hold
(writer_groups.py), so a work entry's append and its publish to the slot's
work-unit-order file stay in append order across units. Retry, loss-marker, refusal and lease rules are
unchanged. Stall reporting is per thread. WarningBudget moves to
writer_warnings.py (re-exported) to keep writer.py under the line cap.

Part of #31502

Co-authored-by: Raymond Chen <chenmingwei23@users.noreply.github.com>
(cherry picked from commit 39b0c92)
The charge relay read the unit header, the binding file and the board's
newest unit inside the append job, on a writer lane, and its first call
in a process listed every unit header in the store. The append job now
reads only what fixes the board at commit (the unit's slot as the
writer noted it, and the binding: one stat, a read only when the file
changed) and queues the entry. A consumer thread finds the board's
newest unit, builds the copy and hands the writer one follow-on per
board unit and run, written with one append_many and one order publish.

A full queue (4096 wakes) is decided inline on the writer after every
wake queued before it, so no copy is dropped or reordered. flush and
drain_for_shutdown wait for the relay. Copies stay in memory until they
land, as the follow-on did before, so a crash in that window still
loses the copy; a crash-durable relay is a follow-up.

Closes #31502

Co-authored-by: Raymond Chen <chenmingwei23@users.noreply.github.com>
(cherry picked from commit 3686b1c)
…board (#26497)

* fix(chat): localize the gateway status rows composed outside the dashboard (#25829)

The status rows whose text the gateway builds from another component's
output -- a dropped/discarded queued message, an eager-spawn stop, a
turn that failed before it started, the turn-timeout and never-started
cards, the restart/close interruption rows, the crew no-permit card and
the tool-limits capability card -- shipped bare English the dashboard
could not translate.

Each now carries a meta.notice token from the gateway_notice table, plus
meta.notice_args for the values its copy interpolates (the containment
change, a message excerpt, a start error, a command, the limit, the wait,
the config path). The row's content stays the same English for channel
mirrors and SSE readers; the dashboard renders the localized frame with
the variable detail verbatim inside it, so no card loses its detail. The
frontend resolver, the legacy pattern table and every shipped locale gain
the new tokens; the parity test discovers and pins them on both sides.

Rows whose whole text is an exception, a provider instruction or another
formatter's output (str(exc) auth/entitlement cards, the credential
give-up, the approval and refusal cards, the app-agent admission
refusals) keep their English with a written reason in code: a token would
localize no frame of ours and would drop that text.

The permission-auto-rejected line re-appended from the ACP handle stays
English for now: its reason and tool title are fused into the ACP event's
text at the source with no structured field to localize from, and adding
one changes the event shape other consumers read. A follow-up tracks that
ACP token hop.

fix(chat): word the turn-limit, wait and excerpt on the frontend (#25829)

Address review on the gateway status rows composed outside the dashboard: the
turn-limit and never-started cards handed the frontend pre-worded English, so a
non-English card read "30-minute limit" and "5 minutes" in the middle of
translated prose.

- turn_dispatch: pass the limit as a NUMBER plus a unit key (minute/hour) and
  the scope, and the wait as a minute count, instead of English words. The
  frontend words them with the catalog's plural keys; the English content (the
  channel/SSE/model fallback) is byte-identical.
- gatewayNotice: compose the limit phrase, the two scope-selected remedy hints,
  the never-started wait and the dropped/discarded excerpt label from the
  structured args; a pre-token row on disk still renders its English captures.
- delivery_containment: pass the bare redacted excerpt; the frontend owns the
  localized Text label.
- eager_spawn_stopped: pass the failure count as a plural `count` and add
  `_one`/`_few`/`_many`/`_other` forms per locale (registered in pluralKeys),
  so the count agrees grammatically (ru no longer uses one fixed plural form).
- gateway_notice_meta: accept a float arg value (a 1.5-hour limit); the notice
  return types are narrowed so the meta builder type-checks.
- catalogs: plural + hint keys in every locale with each language's own
  categories; the pseudolocale is regenerated; catalog values carry no edge
  whitespace (the separating space is added at render).
- tests: a zh-CN row renders no English minute/hour words; the abandoned-turn
  call site is pinned; the excerpt-redaction test's docstring is made honest.

* chore(website): raise the ModelEffortDropdown bundle budget for the added English strings

This change adds about 3.6 KB of en.json strings that are part of the fix.
They land in the ModelEffortDropdown chunk through the eagerly imported
English catalog (i18n/enCatalog.ts), which pushes the measured chunk to
558.6 KB, just over its previous 558 KB budget. Raise the budget to 560 KB.
The bundle-size gate is a size budget, not a security gate.

---------

Co-authored-by: kirocrew-agent <agent@kirocrew.local>
(cherry picked from commit 665858e)

Backport conflict resolution for release/0.12.0: release has one gateway
token family fewer than main had before this change, so the pinned counts
keep that offset (78/78/80 tokens, 35 sites, 91 copy keys, frontend 78).
pluralKeys.json keeps the release list and adds only this change's four
keys. The SEND_DISCARD_HARD_STOP_STEER test row is dropped: that cause
comes from #23772, which is not on release/0.12.0.
@chenmingwei23
chenmingwei23 requested review from a team and KiroCrewCaptain as code owners November 9, 2026 06:30
@chenmingwei23
chenmingwei23 requested review from Zedmor and removed request for a team November 9, 2026 06:30
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of c445defc77426b2178395bf0585c4ab7bdbc0af8 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

This PR cherry-picks four fixes that already merged to main. The reversed one-writer pin (_MAX_CREW_LOG_WORKERS = 1) is declared ("now up to four lanes") and was reversed upstream in #31953.

What this change ships

Inventory (8 items) — 7 justified

Intent: give 0.12.1 users faster crew-log writes and localized gateway status rows, which main already has. This is a FIX.

  1. A session's queued crew-log appends share one write and one fsync instead of one each — justified
  2. Different sessions' crew-log writes run on up to four lanes instead of one shared writer — justified
  3. The board relay decision no longer runs on the crew-log writer thread — justified
  4. Gateway status rows (discarded queued message, turn timeout, eager-spawn stop, restart/close interruption) now show in the dashboard's language — justified
  5. The issue-radar "no permit" card is also localized (this is part of fix(chat): localize the gateway status rows composed outside the dashboard #26497) — justified
  6. The ModelEffortDropdown chunk's bundle budget goes up from 558 KB to 560 KB — undeclared
  7. The new strings are translated in 13 locale catalogs — justified
  8. The crew-log emitter/projection specs and the testing-conventions spec are updated to match — justified

[FIRST-PRINCIPLES-REVIEWED] c445def

Description read

[DESCRIPTION-READ] 1594c953e365f328c6e63e75483885642ea38ed16457e4ba4a0e8e1342353612

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

UX-level review of c445defc77426b2178395bf0585c4ab7bdbc0af8 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

cannot evaluate: missing screenshots of the localized gateway status rows. The blind read was not performed because the PR supplies no image.

Evidence gaps

  • New notice families on a non-English dashboard. gatewayNotice.ts routes 13 new tokens through NOTICE_FAMILIES, including send_discarded, turn_timeout, eager_spawn_stopped and turn_interrupted_restart. Each is styled as card: 'error' or card: 'notice', tone: 'warn', with new copy in 13 locale files. The blind-read report says "BLIND READ NOT PERFORMED", and ux-screenshots.txt is empty. To close the gap, attach stills of at least one warn notice (send_discarded) and one error card (turn_timeout), each in English and one non-English locale.
  • Copy built from structured args. The limit phrase (turn_limit_minutes_* / turn_limit_hours_*), the session-or-global hint and the send_excerpt label are put together on the client. No screenshot shows the finished sentence, so there is no proof that its spacing and word order read correctly once translated. Close it with a still of a turn_timeout card that has limit_scope: session, shown in a non-English locale.

Notes

  • background_turn_abandoned and crew_turn_no_permit show the raw config key `dashboard.max_background_turns` to users in every locale. Name the Settings location instead, as turn_timeout_hint_global already does.

[UX-REVIEWED] c445def

Description read

[DESCRIPTION-READ] b375bb057d72f9a2fbb86879c563a97b4e0aa2b9e53ce7b7c96975288bac9b70

That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of c445defc77426b2178395bf0585c4ab7bdbc0af8 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Clean cherry-pick backport of four already-merged main fixes. Nothing it removes or moves is still read by code outside the patch, and the localization part only translates existing rows without changing any surface.

Notes

[DESIGN-REVIEWED] c445def

Description read

[DESCRIPTION-READ] 290649af6cb2a0fe9e24e5897e0c1b187fa42db329d2da54e13639df30cae561

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed c445defc77426b2178395bf0585c4ab7bdbc0af8 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] c445def

Verdict parsed from the review's SHA-scoped output markers for commit c445defc77426b2178395bf0585c4ab7bdbc0af8.

False positive or not applicable? A repository writer can comment:
/ai-review override fable c445defc77426b2178395bf0585c4ab7bdbc0af8 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of c445defc77426b2178395bf0585c4ab7bdbc0af8 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] c445def

False positive or not applicable? A repository writer can comment:
/ai-review override gpt c445defc77426b2178395bf0585c4ab7bdbc0af8 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Nov 9, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Closing: release backports are picked by the release owner from the main PR links (#31568, #31953, #32236, #26497), so this duplicate batch is not needed. Branch kept.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant