Skip to content

fix: 0.12.1 batch 42 - seven fixes from Bolin's queue - #32613

Merged
buluoray merged 7 commits into
release/0.12.0from
crew/slack/0.12.1-batch-42
Nov 7, 2026
Merged

buluoray merged 7 commits into
release/0.12.0from
crew/slack/0.12.1-batch-42

Conversation

@buluoray

@buluoray buluoray commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Bring seven fixes from Ray's 0.12.1 picks in Bolin's queue that merged on main after v0.12.0 onto release/0.12.0, one commit each, in a PR of its own.

Why it matters

PR Reported What a 0.12.0 user sees today
#32475 #29805 (CrysisDeu) A cron job's set_project (and other person-only directives) is silently dropped instead of refused, with no audit row.
#32424 #29043 (iamwhatever) The pinned pysqlite3 wheel bundles a SQLite that can deadlock a WAL close against an open.
#32450 #27808 (jongaffen) A UTF-16 instances.json or hooks.json raises instead of loading (Windows editors save them that way).
#32379 #23768 (RohanK6) kirocrew setup --slack leaves an older lowercase .env token in force on Windows.
#32306 #17026 (bolichen97) One malformed metadata field breaks a whole slot restore.
#32249 #31580 (ryanleecode) On Claude, the agent role is not restored after a timed-out compaction.
#32426 #27178 (RohanK6) A typed /stop is dropped on a governance-denied iMessage, Teams, Webex, WeCom or Weixin channel, so the reply keeps running.

Not a goal

What changed (motivation → approach → change)

Each main squash commit was cherry-picked with -x onto release/0.12.0 @ 44e6f443e4, in merge order on main, one commit each.

# PR main commit release commit Pick
1 #32475 refuse set_project from a cron job out loud d71889ee10 bc51ee732d one import line by hand
2 #32424 exclude the pysqlite3 wheel whose sqlite can deadlock 6005c082e9 fa7bc1ef2f clean
3 #32450 load a utf-16 instances.json or hooks.json 94d12e095a 7bdc0589f0 clean
4 #32379 let new setup --slack tokens replace older lowercase .env lines eae2b50299 ad013851a5 clean
5 #32306 stop malformed metadata from breaking slot restores 83f46345de e84b814f1d clean
6 #32249 restore the agent role after a timed-out claude compaction 36a9fed3cc 53f59f0380 clean
7 #32426 keep a typed /stop working on a governance-denied channel 386d0301f3 62492ce674 one comment hunk by hand

Hand-resolved hunks. No prerequisite was pulled in.

PR File Resolution
#32475 slack/gateway_runtime/cron_dispatch.py imports EVENT_TOOL_RESULT from kiro_crew.acp.types instead of agent_sdk.context.CONTEXT_EVENT_TOOL_RESULT, which #24384 (idle compaction, a feature) adds on main. Both are the string "tool_result". The pick applied cleanly but failed at import time on this branch, so its own tests found this
#32426 wecom/transport_dispatch.py comment-only: kept this branch's longer attachment comment (another main change shortened it) and moved the log line and command-intercept header below the gate, as #32426 does

Every other file has added and removed lines identical to its main commit. Each hand-resolved commit is authored with the public identity the push guard requires and names its original author in its message; clean picks keep their original author.

builder-security checked: no bind, listener, route, auth mechanism or storage grant changes. #32426 lets only a message the channel's own parser reads as /stop claim the governance gate's existing pure-cancel exemption.

Backwards compatibility

Compatible: each change is the one already merged on main, and its compatibility note applies unchanged.

Removes nothing: no setting, key or caller is removed.

Tests

Proof: not provable -- other: a backport of main commits whose proofs ran on their own PRs

  • CI does not run the backend suite on PRs into release/*, so the related set was run here: every touched test file plus every test file that imports a touched module, 114 files, -n 4 --dist loadgroup. Before the fix: refuse set_project from a cron job out loud #32475 import fix: 4243 passed, 8 failed. After it, the 36 tests in the three failing files pass except one:
    • test_sqlite_compat.py::test_the_bundled_sqlite_cannot_deadlock_a_wal_close_against_an_open asserts the installed SQLite is at least 3.51.2. The local environment has 3.51.1, and the test fails the same way on a main checkout; the pin this PR carries is what CI's fresh install resolves.
  • flake8 passes on the changed Python files.

Manual verification

N/A - each fix was verified on its own main PR. The 0.12.1 RC soak is the end-to-end check.

Screenshots / video

N/A - no frontend file changes.

Related Issues

Backport to the 0.12 line for 0.12.1 of #32475, #32424, #32450, #32379, #32306, #32249 and #32426. Source issues: #29805, #29043, #27808, #23768, #17026, #31580, #27178.

Sibling sweep

Siblings: none -- each source PR carried its own sibling sweep; this PR only carries those fixes.

Pattern harvest

Not generalizable: this PR only carries fixes already on main. The source PRs have their own harvest.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • 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.

buluoray and others added 7 commits November 7, 2026 20:41
No session-directive consumer read a cron turn's stream, so a cron
job's set_project (or reset_conversation, chat_tag, suggest_followup)
ended with the tool's own "requested" text and no audit row. The cron
stream wrapper now names each tool call the way the dashboard's
out-of-band claim does, so KAS's title-only frames count, and refuses
each completed person-only directive with the user-origin gate's own
wording and SEL denied row. The refusals are run-scoped and lead the
run's result on both the single-agent and the sequence path.

Closes #29805

(cherry picked from commit d71889e)

Original author: Bolin Chen (#32475). One line resolved by hand in
src/kiro_crew/slack/gateway_runtime/cron_dispatch.py: imports
EVENT_TOOL_RESULT from kiro_crew.acp.types instead of main's
agent_sdk.context.CONTEXT_EVENT_TOOL_RESULT, which comes from #24384
(idle compaction, a feature not on this branch). Both are "tool_result".
)

pysqlite3-binary 0.5.4.post2 bundles SQLite 3.51.1. That release can
deadlock a thread closing a WAL database's last connection against a
thread opening the same file (SQLite 3.51.2 fixes it), and pysqlite3
closes with the GIL held, so the whole process stops: no log line, no
timeout, no event loop. That is what wedged the single-flight
store-open tests on Linux CI, and a gateway can stop the same way.

Exclude that one wheel so the resolver picks 0.5.4 (SQLite 3.46.1,
which predates the deadlocking check), and pin that the bundled SQLite
is not 3.51.0 or 3.51.1.

Closes #29043

(cherry picked from commit 6005c08)
…32450)

* fix: don't save over an unreadable instances.json or hooks.json

Builds on #28505.

Adding, editing or removing one remote instance after instances.json
could not be read (a UTF-8 byte-order mark, a Windows sharing
violation) saved only that change and erased every other instance and
hop lease, and a script hook store whose startup load failed saved its
empty list over hooks.json on the first hook edit.

Registry mutators now read strictly and raise RegistryUnreadableError
before anything is written; the add, edit and remove routes answer
503 instances_file_unreadable. Readers and the strict read both accept
a leading byte-order mark. A hook store whose load failed reloads
before its next edit and refuses the save while the file still cannot
be loaded.

Closes #27807

Co-authored-by: Gary Jennings <garysjennings@gmail.com>

* fix: load a utf-16 instances.json or hooks.json instead of raising

Windows PowerShell 5.1 saves UTF-16LE with a byte-order mark by default.
The instances registry and the script hook store read these files as
UTF-8 text and caught only parse and OS errors, so such a file raised
UnicodeDecodeError past their tolerant loaders, and a UTF-16 hooks.json
made gateway startup raise.

Both stores, the strict hooks.json read and the import sanitizer now hand
json.loads the bytes, which reads UTF-8 with or without a mark, UTF-16
and UTF-32. Bytes none of those decode count as a failed read: readers
degrade with a warning and every write is refused. The sanitizer change
keeps an imported UTF-16 hooks.json from arriving with its command hooks
switched on now that the store loads it.

---------

Co-authored-by: Gary Jennings <garysjennings@gmail.com>
(cherry picked from commit 94d12e0)
…32379)

On Windows os.environ is case-insensitive and boot keeps the first
non-empty spelling of a name in .env. The setup step read and merged
.env by literal name, so an older slack_bot_token line stayed ahead of
the new SLACK_BOT_TOKEN line and kept the old token in force.

The step folds every spelling of the app token, bot token and owner ID
into the canonical name, matched with _env_name_key and carrying the
value in force, so the prompt shows that value and the save replaces
it. On POSIX the names are separate variables and nothing changes.

Builds on #28557.

Closes #23768

(cherry picked from commit eae2b50)
…32306)

A recent-session restore that raised after registering its slot (a
non-string persisted title, a malformed row) left the half-built slot
behind and stopped every later session from restoring. The build now
undoes its own slot and restricted marker, as the open-tab restore
already does, and both recent-restore drivers log the session and go
on to the next.

A raise in the reads History resume runs after the slot is built leaked
its construction mark, so the key stayed reserved and counted against
the live-slot cap for the process lifetime. Those reads now undo the
build the same way the materialiser's own rollback does.

A JSON null origin was read as the string "None". The constructor
keywords and the default-model follow now read it as no origin.

Closes #17026

(cherry picked from commit 83f4634)
A Claude-backend compaction that outlives the compaction budget is
abandoned without telling the backend, which can still finish it. The
next turn's pre-turn drain drops the late frames only after that turn's
prompt was built, so nothing restored the session-start context and the
agent ran without its role contract. The timeout now arms the one-shot
re-injection once the /compact was sent; a budget spent waiting for the
turn permit sent nothing and arms nothing.

Closes #31580

(cherry picked from commit 36a9fed)
iMessage, Teams, Webex, WeCom and Weixin called the per-message channels
governance gate with no text, so its pure-cancel exemption never applied:
once the operator denied the channel, a typed /stop was dropped and the
reply it was meant to halt kept running. iMessage had no /stop at all.

Each dispatcher now passes the text to the gate only when its own
parse_command reads the message as a stop (as Feishu already does), so a
cancel word another channel spells and every other message keep the
strict gate. A Teams or Webex card press is never treated as a stop. The
gate moves after callback admission on the four channels that ran it
first, because the stop check parses the message and nothing may be
parsed before admission. iMessage gains /stop (alias /cancel), a
cooperative cancel that mirrors the Weixin one.

Closes #27178

(cherry picked from commit 386d030)

Original author: Bolin Chen (#32426). One comment-only hunk resolved by
hand in src/kiro_crew/wecom/transport_dispatch.py: kept this branch's
longer attachment comment (main shortened it in another change) and moved
the log line and command-intercept header below the gate, as #32426 does.
@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 7, 2026 20:43
@buluoray
buluoray requested review from tim-finnigan and removed request for a team November 7, 2026 20:43
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/hook_runtime/hook_dispatch.py

  • src/kiro_crew/hook_runtime/script_hooks.py

  • No reasoning template for 62492ce yet.

How to clear this check:

  1. The PR author posts the template below as a PR comment, with
    every field filled (N/A needs a reason). Keep the
    Head commit line: it must name the current head SHA.
  2. The check turns green within a minute, with no push.
  3. A new push resets this check: post it again for the new head.

Only the author's comment counts this way. A reviewer can instead
paste the filled template into an "Approve" review on this head.
Merging still needs a reviewer's approval.

## Sensitive change review
- Head commit: 62492ce674dceffa1856b1a36d358f5d3877c405
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 62492ce674dceffa1856b1a36d358f5d3877c405 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: these are seven cherry-picks of fixes already merged on main, and the design was reviewed on each source PR. The two hand-resolved hunks are an import of the same string and a comment.

Notes

  • CI does not run the backend suite on release/* PRs, so the only proof is the local run of the 114 related files. Running the backend suite on this branch before tagging would close that gap.
  • test_the_bundled_sqlite_cannot_deadlock_a_wal_close_against_an_open fails locally (SQLite 3.51.1). Excluding 0.5.4.post2 is only proven fixed once a fresh install on Linux x86_64 resolves to a bundled SQLite at 3.51.2 or later. Confirm that in the RC soak.

[DESIGN-REVIEWED] 62492ce

Description read

[DESCRIPTION-READ] 5d911846a93325df90714c32b96054336e010934ca20f20a52789f88c67dda98

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 7, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 62492ce674dceffa1856b1a36d358f5d3877c405 — 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

Nothing blocks. Each of the seven backports is a fix that has already merged on main, has a linked issue and ships its own regression test. The two hunks resolved by hand stay within their source fixes.

What this change ships

Inventory (8 items) — 8 justified

Intent: give 0.12.x users seven defect fixes that have already merged on main (#29805, #29043, #27808, #23768, #17026, #31580, #27178). This is a FIX.

  1. A cron job's person-only directive (set_project and the like) is now refused and audited, where before it was silently dropped. — justified
  2. The install no longer resolves pysqlite3-binary 0.5.4.post2, whose bundled SQLite can deadlock a WAL close. — justified
  3. A UTF-16 instances.json or hooks.json now loads instead of raising. — justified
  4. setup --slack tokens now replace older lowercase .env lines on Windows. — justified
  5. One malformed metadata field no longer breaks a whole slot restore. — justified
  6. On Claude, the agent role comes back after a timed-out compaction. — justified
  7. A typed /stop now works on a governance-denied iMessage, Teams, Webex, WeCom or Weixin channel. Clicks and presses are still gated, and the tests that pin this were widened to parametrize a /stop, not loosened. — justified
  8. The cron refusal on this branch imports the existing kiro_crew.acp.types.EVENT_TOOL_RESULT instead of the constant from feat(session): opt-in idle compaction before prompt-cache expiry #24384, which is not on this branch. — justified

[FIRST-PRINCIPLES-REVIEWED] 62492ce

Description read

[DESCRIPTION-READ] a7a83cd3890781eefb3a775c959f152c507868a62299d882d02af0bee1dd9d49

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 7, 2026

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 62492ce674dceffa1856b1a36d358f5d3877c405 newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: adjudicated, zero confirmed regressions.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 10 classified, 0 newly refused, 10 still allowed.
  • ubuntu-latest (platform posix): 10 classified, 0 newly refused, 10 still allowed.
  • windows-latest (platform windows): 6 classified, 0 newly refused, 6 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: Nothing in this diff touches the shell deny composite: no sensitive-bash, exfil or deny-rules tier changes, and SHELL_DENY_TIERS in src/kiro_crew/hooks.py is not modified. Every stricter rule here sits outside what the classifier can check: the registry write refusal, the hook-store save refusal, and the cron refusal of person-only directives. Those three are named under UNADJUDICATED below. The channel governance edits loosen the gate rather than tighten it: a typed /stop now gets the pure-cancel exemption.

TIGHTENING: Saves now refuse when the file read fails. Three changes do this, and each refuses one threat: writing an empty or partial document over records the read could not load.

  • InstancesRegistry mutators read through the new _read_for_update, which raises RegistryUnreadableError "before anything is written" for "any other read error, a decode or parse error, a non-object root or a non-list instances". The routes answer 503 instances_file_unreadable.
  • ScriptHookStore._write_hooks_file refuses if self._load_failed: with WebhookStoreUnreadable ("refusing to overwrite it and erase the hooks it holds").
  • _cron_stream_with_posttoken_resume refuses USER_ORIGIN_DIRECTIVES calls on a cron turn through refuse_user_origin_directive.

ADJUDICATED: 16 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE:

  • posix (10 rows): reading or backing up instances.json and hooks.json, converting a UTF-16 file with iconv, the new and touched test files, and the pysqlite3-binary pin plus its version check. These cover the posix spellings of the paths and tools the diff assumes: ~/.kiro/crew/..., python3, pip.
  • windows (6 rows): $env:USERPROFILE\... paths with \ separators, PowerShell Get-Content, Copy-Item and Out-File -Encoding utf8 (the PowerShell 5.1 UTF-16 case the diff names), .venv\Scripts\python.exe, and kirocrew.exe. These cover the diff's Windows assumptions: the sharing-violation retry, UTF-16 files, and case-insensitive os.environ.
  • any (0 rows): none written, because every candidate names a path or an executable.
  • Not covered by a row: the Windows case-insensitive .env fold in cli_setup._fold_env_spellings. It edits a credentials file in Python and runs no shell command, and a row would have to carry a Slack token name and value.

UNADJUDICATED:

  • InstancesRegistry._read_for_update / RegistryUnreadableError.
    • Call path: POST/PATCH/DELETE /api/instances → api_instances_add / api_instances_update / api_instances_remove → reg.add / update / remove_cascade → _read_for_update. Also lend_hop, remove, and cloud.connect.register_instance → add.
    • Legitimate inputs I would have submitted:
      • a UTF-8 file with a byte-order mark (the diff's tests cover this);
      • UTF-16 and UTF-32 (tested);
      • a missing file (tested);
      • a file whose top level has extra keys beside instances;
      • a file with no instances key at all, which passes because .get("instances", []) defaults to a list;
      • a file in a legacy code page such as cp1252 with a non-ASCII name. Readers degrade it to empty, but every mutation is now refused until the user re-encodes the file. That is a deliberate new refusal, it is tested, and it can be argued as a narrowing, not confirmed as a regression.
    • Narrowing I can argue but not confirm: on Windows, a sharing violation that outlasts read_bytes_with_retry now refuses an add, where it used to succeed by writing the registry from empty.
  • ScriptHookStore _load_failed refusal.
    • Call path: the Hooks page routes → create / update / toggle / delete → _atomic_mutation, which reloads first → _write_hooks_file. Also the status write-back through _persist_current.
    • Legitimate inputs I would have submitted:
      • a store built while the file was briefly locked, which then reloads cleanly (tested);
      • a root that is not an object and is later repaired (tested);
      • a file holding only webhook resume contexts and no hooks key, which passes because of the default [].
    • Not checkable: a hook firing on a store whose load failed now drops its status write. The test shows the file is left unchanged, but no shell row can measure that.
  • Cron refusal of person-only directives (set_project, reset_conversation, chat_tag, suggest_followup).
    • Call path: cron job → _cron_run_single / _cron_run_sequence → _cron_stream_with_posttoken_resume with on_event=_refuse_person_only → directive_tool_from_call → refuse_user_origin_directive.
    • Legitimate input I would have submitted: a cron job whose agent calls set_project. That call already did nothing on a cron turn, so this is a refusal that is now reported, not an operation that is lost.
    • What a flow test would check: the refusal is keyed on tool_call_id and tool_final, so a non-directive tool whose wire title mimics @<core>/set_project gets a refusal line and an audit row but is not blocked. Only an end-to-end flow test can confirm that, not a shell row.

[SCOPE-REVIEWED] 62492ce

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 62492ce

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

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 62492ce

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

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

@buluoray
buluoray merged commit 0489138 into release/0.12.0 Nov 7, 2026
25 of 29 checks passed
@buluoray
buluoray deleted the crew/slack/0.12.1-batch-42 branch November 7, 2026 21:08
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Nov 7, 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.

2 participants