Skip to content

fix(ohos): build CMake crates with Ninja and ungate the cli sha256 helper - #6989

Merged
Hmbown merged 11 commits into
codewhale-hq:mainfrom
shenjackyuanjie:fix/ohos-windows-cmake-ninja
Oct 16, 2026
Merged

Hmbown merged 11 commits into
codewhale-hq:mainfrom
shenjackyuanjie:fix/ohos-windows-cmake-ninja

Conversation

@shenjackyuanjie

@shenjackyuanjie shenjackyuanjie commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #6988.

Two fixes for the OpenHarmony cross-build.

1. scripts/ohos-env.ps1 exports CMAKE_GENERATOR=Ninja

aws-lc-sys builds through the cmake crate, which passes no -G. On Windows CMake then
defaults to the Visual Studio generator, which ignores the clang compiler that
ohos.toolchain.cmake sets and feeds its clang-only flags to cl.exe
(D8021: invalid numeric argument '/Wa,--noexecstack'). When ninja is not on PATH the
script falls back to the SDK-bundled build-tools/cmake/bin/ninja.exe and fails loudly when
neither exists.

2. sha256_hex/hex_bytes move to an ungated crate::hashing module in codewhale-cli

With the generator fixed, the OHOS build reached codewhale-cli and failed E0433: mod update
is #[cfg(not(target_env = "ohos"))], but cloud.rs (two sites) and cloud/work.rs (one site)
called crate::update::sha256_hex without the same gate. Those sites verify downloaded-content
integrity and Work task-context digests, so they stay compiled on OHOS; the helper now lives in
an ungated module, matching the shared codewhale_runtime::hashing implementation the TUI
already uses.

Verification (Windows, DevEco OpenHarmony native SDK 26.0.0, current main)

  • aws-lc-sys v0.45.0 builds in about 43 s, producing libaws_lc_0_45_0_crypto.a (5.9 MB)
  • cargo build --release --target aarch64-unknown-linux-ohos -p codewhale-cli exits 0 in
    28 m 32 s; the binary is an ELF64 AArch64 PIE (116,462,208 bytes) needing only libc.so and
    libtime_service_ndk.so
  • cargo check -p codewhale-cli on the host target exits 0
  • cargo check -p codewhale-cli --tests exits 0
  • cargo fmt --all -- --check exits 0

中文说明

本 PR 修复 Issue #6988,包含两处改动:

  1. scripts/ohos-env.ps1 导出 CMAKE_GENERATOR=Ninja。 aws-lc-sys 通过 cmake crate 构建,该 crate 不传 -G;Windows 上 CMake 因此默认选中 Visual Studio 生成器,无视 ohos.toolchain.cmake 指定的 clang,把只属于 clang 的参数喂给 cl.exe(D8021)。PATH 中无 ninja 时回退 SDK 自带版本,两者皆无则明确失败。

  2. sha256_hex/hex_bytes 移至 codewhale-cli 未门控的 crate::hashing 模块。 生成器修好后 OHOS 构建走到 codewhale-cli 触发 E0433:mod update 带有 #[cfg(not(target_env = "ohos"))],而 cloud.rs(两处)与 cloud/work.rs(一处)未加门控地调用了 crate::update::sha256_hex。这些调用承担下载内容完整性与任务上下文摘要校验,OHOS 上必须保留,因此把助手函数搬到未门控模块,与 TUI 已共享的 codewhale_runtime::hashing 实现保持一致。

验证(Windows,DevEco OHOS native SDK 26.0.0,当前最新 main):aws-lc-sys 约 43 秒构建成功并产出 libaws_lc_0_45_0_crypto.a(5.9 MB);cargo build --release --target aarch64-unknown-linux-ohos -p codewhale-cli 退出码 0(28 分 32 秒),产物为 116,462,208 字节的 ELF64 AArch64 PIE,仅依赖 libc.so 与 libtime_service_ndk.so;宿主目标 cargo check -p codewhale-cli 与 --tests 退出码 0;cargo fmt --all -- --check 通过。

Maintainer qualification (2026-10-15)

Current head: deb491c44b, tree 13d1be6be2d58c66a161870a79c30e8d75cb3db7. It preserves @shenjackyuanjie's original commit 5c6a61ab7f74c466bb65be71addfc8897783bff9, the six original source files and all maintainer follow-ups. The preceding 39ceb861 update carried the shared main repair; this merge additionally carries #6985's exact 9f5ed8eb source so CI can qualify the eventual combined tree before the first PR lands. Only five shared changelog/credit/generated-document conflicts required resolution; both implementations and every contributor's history remain intact.

Merge #6985 as its own PR first, then this original OHOS PR. This source update merges neither PR. Admission requires #6985's exact reviewed head to be merged into live main, this head's fresh native/web/budget checks to pass, and the actual resulting merge tree to match the qualified tree. The source branch remains retained.

The Windows/SDK26 linked build above remains contributor-reported validation. Maintainer Linux-hosted SDK checking of TUI and CLI passed on prior head c59004af, along with its Ubuntu native, web and actual Runtime/persistence gates. Linux cross-compile checking does not establish Windows-host SDK or OHOS-device acceptance.

That head's Windows native job recorded 18,355 passed (1 leaky), 1 failed, 27 skipped. Its sole failure was the inherited tool-metric fixture: both samples used bash, but optional code_execution appeared only in the second full catalog (51→52 tools). The exact interpreter and reason for the differing probe outcomes were not captured. Windows doctests and containment receipt export were skipped after the failure; the original receipt is retained.

The preceding main repair changed only crates/tui/src/dependencies.rs, the existing tool-metric fixture and scripts/mobile-smoke.sh; every other blob from that preceding PR head was preserved. The metric fixture now uses the existing test-only host-capability pin on all test platforms, and the smoke assertions avoid an upstream broken pipe under pipefail. Production probe behavior, catalog budgets and the complete equality assertion remain unchanged.

The three-file repair was validated locally on macOS before committing 51c00f23: 2 existing focused Rust tests passed, the complete extracted tool catalog equals the existing budget with no identity/cap changes, the production CLI binary built, 9 mobile HTTP smoke assertions passed, and npm test && npm run check:web passed 1,312 tests with 0 failures and 7 skipped (540 Node + 772 Vitest). The first isolated smoke launch exceeded macOS's socket-path limit before HTTP assertions; correcting only the artifact launcher then passed all 9 assertions with the same compiled binary. Both attempts are retained. These are focused local results on the main repair, not full native qualification of this PR head.

Current head remains blocked. Its Windows job timed out waiting for Windows Terminal composer readiness before the native suite began. The retained artifact proves PowerShell entered the script; it contains no later stage, readiness, paste or provider-request evidence. The exact blocking statement and cause are unknown. The same clipboard scripts and CI workflow are byte-identical to successful main51 and #6985 checks; no interactive-startup change was found in this OHOS diff.

One bounded retry of that Windows job at unchanged deb491c4 is planned. GitHub rejected the request while the rest of this workflow is still running, so no retry has started and the other legs are left running. The original failure is retained. A repeated failure requires further diagnostics, not a presumed pass or timeout increase. Fresh Linux-SDK TUI+CLI checking, Web Frontend, Safety and the Linux npm smoke have passed; remaining native and actual budget gates still govern admission. Earlier receipts retain their source identities. The contribution and source branch remain preserved; 0.10.2 has not shipped.

— Written by GPT-6 (AI agent) on behalf of the maintainers.

henrikdukefoss and others added 4 commits October 15, 2026 15:01
Adds Standard Compute on the existing compatible-host descriptor path:
Chat Completions at https://api.stdcmpt.com/v1, STANDARDCOMPUTE_API_KEY,
and the `standardcompute` router id as the bootstrap model. Live
GET /v1/models stays the model authority. Billing is recorded as
Unknown in the pricing omission ledger; no provider enum or price row.

Signed-off-by: Henrik Bakke Dukefoss <henrikdukef@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ributor

The vendor budget policy permits optional prepaid Pay as you go on eligible plans. Qualify the default HTTP402 exhaustion behavior in English and Chinese and link the authoritative policy. Keep billing Unknown and model discovery live.

Map Henrik Bakke Dukefoss and the verified author email to @henrikdukefoss; credit the original descriptor contribution on CONTRIBUTORS, CHANGELOG and web release credits. Regenerate packaged changelog and agent docs from their existing owners.

Artifact-only verification on exact contributor head f7805eb:
- Existing credit checker fails before and passes after on captured exact PR and CI synthetic-merge ancestry (9 canonical contributors).
- All26 generated doc topic IDs, slugs and source paths/order unchanged; only PROVIDERS and CONTRIBUTORS content/hash entries change,50 others identical.
- Existing changelog sync --check, baseline/generated-doc consistency, patch apply and whitespace checks pass.
- No native build, npm gate or resulting-head CI claimed; fresh checks pending before merge.

Original contributor commits and canonical shared build inputs are preserved.

Refs codewhale-hq#6985

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
…enerated docs

Regenerate agent docs from merged provider and contributor sources. Preserve the Standard Compute budget qualification, canonical author mapping, all contributor credit surfaces, and main documentation. All other paths auto-merge.

Use the existing docs derivation owner on the exact automatic-merge sources:26 topics,52 entries and39 paths. Only the documented conflict paths are replaced. Static full-tree and replacement-blob review, generation consistency and diff whitespace checks pass. No new production edits or canonical checkout changes.

Both original contributor ancestry and main68f4dd3406 are retained. Fresh resulting-head native and web CI remain pending; this source reconciliation is not a merge-readiness or release claim.

Refs codewhale-hq#6985

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
…lper

The Windows OpenHarmony cross-build failed twice over. aws-lc-sys drives
CMake through the cmake crate, which passes no -G; on Windows CMake then
defaults to the Visual Studio generator, which ignores the clang compiler
the OHOS toolchain file sets and feeds clang flags to cl.exe (error
D8021). scripts/ohos-env.ps1 now exports CMAKE_GENERATOR=Ninja, falling
back to the SDK-bundled ninja and failing loudly when neither exists.

With that fixed, codewhale-cli for aarch64-unknown-linux-ohos hit E0433:
mod update is cfg'd out on OHOS, but three cloud call sites reached for
crate::update::sha256_hex without the same gate. Those sites verify
downloaded content integrity, so they are not cfg'd out either; the helper
and its hex encoder move to an ungated crate::hashing module, matching the
shared codewhale_runtime::hashing implementation the TUI already uses.

Verified: aws-lc-sys builds in 43.16s (libaws_lc_0_45_0_crypto.a, 5.9 MB);
cargo build --release --target aarch64-unknown-linux-ohos -p codewhale-cli
exits 0 and produces a 111 MB ELF64 AArch64 PIE needing only libc.so and
libtime_service_ndk.so; cargo check -p codewhale-cli exits 0 on the host
target; cargo check -p codewhale-cli --tests exits 0; cargo fmt --all
--check exits 0.
Copilot AI balanced review requested due to automatic review settings October 15, 2026 16:34

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused changes address both build failures while preserving hashing behavior, with no unresolved findings.

0 open findings

What changed in this PR

Fixes Windows OpenHarmony cross-build failures by selecting Ninja and making CLI hashing available on OHOS.

Changes:

  • Selects Ninja, with an SDK fallback and an explicit error if unavailable.
  • Moves hashing helpers into an ungated module and updates callers without changing digest behavior.
File Description
scripts/​ohos-env.ps1 Configures Ninja and SDK fallback.
crates/​cli/​src/​update.rs Imports the relocated hashing helper.
crates/​cli/​src/​lib.rs Registers hashing without an OHOS gate.
crates/​cli/​src/​hashing.rs Houses the unchanged hashing helpers.
crates/​cli/​src/​cloud/​work.rs Uses ungated hashing for context verification.
crates/​cli/​src/​cloud.rs Updates integrity-check and dispatch-stamp hashing calls.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

CodeWhale Bot added 2 commits October 15, 2026 10:06
Reconcile original PR codewhale-hq#6989 with main23e9119 while preserving
shenjackyuanjie's commit5c6a61ab and unchanged CMake/hash implementation.
The existing OHOS job compiled only codewhale-tui, so an ungated CLI
call into the target-gated updater escaped it. Include codewhale-cli
in the same real-SDK cargo check and trigger it for the PowerShell
setup script. Preserve download/context integrity checks on OHOS.

Credit the diagnosis and repair on all three release surfaces, and
regenerate the TUI changelog. Existing contributor-credit checker:
10 contributors found, all3 surfaces PASS (exact original PR ancestry).
Existing changelog sync check PASS; actionlint for changed workflow
exit0; byte comparison confirms hashing implementation moved unchanged
and all3 cloud callers only change module path. No new dependencies,
production logic, test functions or code comments in this follow-up.

Original CI38770088645 version gate failed missing website credit;
Windows job116543508599 failed composer-readiness acceptance before
native tests ran. Preserve that failure. Contributor-reported Windows
OHOS release build is a separate self-report; current hosted OHOS success
covers only the TUI. New-head CLI target, native, npm and web qualification
remain pending before merge. No gate is waived and no release is published.
Canonical checkout/index/HEAD remain unchanged.

Refs codewhale-hq#6989, codewhale-hq#6988

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
…#6989)

The contributor-credit follow-up changed docs/CONTRIBUTORS.md but omitted its generated website snapshot, so exact-head web CI passed772 existing tests then failed check:facts for stale agent docs.

Run the unchanged committed deriveAgentDocs owner against all39 exact-head source paths. The26 topics and52 source entries are retained; only the contribution topic source content/hash changes to include @shenjackyuanjie. Captured old snapshot fails derivation equality; regenerated snapshot passes. No native source, workflow, registry, test, or comment changes. Fresh hosted web/native qualification remains pending; no local full npm gate or release publication is claimed.

Signed-off-by: Hunter Bown <hunter@shannonlabs.dev>
CodeWhale Bot added 2 commits October 15, 2026 12:32
Preserve the contributor's original history and integrate main
248634f. This carries authoritative,
isolated Runtime fixtures and settlement of stale approval/input requests,
plus the earlier macOS LLVM setup and Windows startup diagnostics.

The clean merge retains this PR's measured budgets and gate policies.
The Standard Compute descriptor, metadata and contributor credit are unchanged.

Main repair validation: 387 existing focused Rust tests passed, 0 failed;
npm 1312 passed, 0 failed, 7 skipped; check:web passed. Exact merged-tree
review preserved each PR delta and the main repair. This resulting PR head
still needs fresh hosted qualification; previous runs remain historical.
No provider traffic, deployment or publication.

Signed-off-by: Hunter Bown <hunter@shannonlabs.dev>
Preserve the contributor's original history and integrate main
248634f. This carries authoritative,
isolated Runtime fixtures and settlement of stale approval/input requests,
plus the earlier macOS LLVM setup and Windows startup diagnostics.

The clean merge retains this PR's measured budgets and gate policies.
The OHOS Ninja setup, portable SHA helper and contributor credit are unchanged.

Main repair validation: 387 existing focused Rust tests passed, 0 failed;
npm 1312 passed, 0 failed, 7 skipped; check:web passed. Exact merged-tree
review preserved each PR delta and the main repair. This resulting PR head
still needs fresh hosted qualification; previous runs remain historical.
No provider traffic, deployment or publication.

Signed-off-by: Hunter Bown <hunter@shannonlabs.dev>
Hmbown pushed a commit that referenced this pull request Oct 15, 2026
Retain the original candidate and contributor histories while qualifying the
combined source in parallel with original PRs #6985 and #6989. Both contributor
PRs must still land as themselves before this candidate's conditional squash.
The source-navigation work in draft PR #6393 is excluded pending its author's
scope decision and successful qualification.

Include current main 248634f: worker ownership and late completion receipts,
stale approval/input settlement, shared mock authority, isolated fixture
workspaces, macOS LLVM setup and Windows clipboard launch diagnostics.
Carry @henrikdukefoss's Standard Compute descriptor with Unknown billing and
@shenjackyuanjie's OHOS Ninja selection and ungated CLI hashing unchanged.
Resolve CI/credit/generated-document intersections, synchronize approval
documentation with Engine execution IDs and captured input, and narrow the
Windows 10 1607 statement to verified dynamic lookup behavior.

Verification: object-only merge and authored/generated-document review;
72 feature rows and 26 documentation topics preserved; git diff --check passed.
No build or native/npm test was run on this combined source. Prior source
receipts remain separate; hosted exact-head qualification is required.
Canonical main and its index remain unchanged. No publication is authorized.

Signed-off-by: Hunter Bown <hunter@shannonlabs.dev>
CodeWhale Bot added 3 commits October 15, 2026 14:15
Carry main 51c00f2 without changing the original PR-specific
source. Pin the no-host-tools metric fixture through its existing test-only
capability seam and remove echo/grep pipe races from mobile smoke.

Main repair verification: 2 focused existing Rust tests passed; full tool
catalog JSON unchanged; default CLI build and all 9 mobile HTTP assertions
passed; npm 1312 passed, 0 failed, 7 skipped; check:web, scoped rustfmt,
ShellCheck, Bash syntax and diff checks passed. Original isolated mobile
launch failed socket-path length before assertions; corrected only the
launcher and reran the same binary. Fresh resulting-head hosted native
qualification remains required; no old-source CI result is relabeled.

Only the three inherited probe paths differ from the previous PR head.
Both histories are retained. No new test, publication or branch cleanup.

Refs CW-6439

Signed-off-by: Hunter Bown <hunter@shannonlabs.dev>
Carry main 51c00f2 without changing the original PR-specific
source. Pin the no-host-tools metric fixture through its existing test-only
capability seam and remove echo/grep pipe races from mobile smoke.

Main repair verification: 2 focused existing Rust tests passed; full tool
catalog JSON unchanged; default CLI build and all 9 mobile HTTP assertions
passed; npm 1312 passed, 0 failed, 7 skipped; check:web, scoped rustfmt,
ShellCheck, Bash syntax and diff checks passed. Original isolated mobile
launch failed socket-path length before assertions; corrected only the
launcher and reran the same binary. Fresh resulting-head hosted native
qualification remains required; no old-source CI result is relabeled.

Only the three inherited probe paths differ from the previous PR head.
Both histories are retained. No new test, publication or branch cleanup.

Refs CW-6439

Signed-off-by: Hunter Bown <hunter@shannonlabs.dev>
Preserve the original codewhale-hq#6985 and codewhale-hq#6989 histories and qualify their combined
source on the existing OHOS PR branch. Land codewhale-hq#6985 as its own PR first;
codewhale-hq#6989 remains held until exact-head CI and the actual resulting-main tree
are reviewed. Neither contributor PR is merged by this source update.

Resolve only five shared changelog, credit and generated-document paths
using the previously reviewed contributor-only source. Preserve both
contributors on every existing credit surface. No Rust, descriptor or
OHOS implementation conflict; the three verified main51 probe-repair
blobs are unchanged. No new tests or comments are introduced by this
maintainer resolution.

Source review: both merge orders produce tree
13d1be6. All non-conflicting source
comes directly from the two PR heads. Full native and web CI on this
combined tree is pending; earlier passing receipts retain their original
source identities. Canonical main stays clean and unchanged.

Signed-off-by: Hunter Bown <hunter@shannonlabs.dev>
Hmbown pushed a commit that referenced this pull request Oct 15, 2026
Record the Standard Compute and OHOS contributor heads through #6989
while preserving the complete candidate source tree at
4a27e34. The five shared release
documentation and credit conflicts retain the already reviewed candidate
blobs, including both original contributor credits. No source content changes.

This prevents a final intake merge conflict. The original #6985 and #6989
PRs still merge as themselves before the conditional #6968 squash.
Existing test receipts remain attached to their original heads and unchanged
source tree; this new commit awaits fresh required CI before merge admission.
No tests were repeated locally for the identical source tree.

Signed-off-by: Hunter Bown <hunter@shannonlabs.dev>
@Hmbown
Hmbown merged commit 53918dd into codewhale-hq:main Oct 16, 2026
48 of 49 checks passed
Hmbown pushed a commit that referenced this pull request Oct 16, 2026
Brings in #6985 (Standard Compute), #6989 (OHOS), the CW-6880 mobile
approval-card fix, the CW-7427 queue notice and logging fix and the G1
stdio MCP handoff, so the candidate's CI qualifies the tree the squash
will produce.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NBKbhx19BRbZtvWK8rVKjz
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.

OHOS cross-build fails on Windows (aws-lc-sys CMake uses the Visual Studio generator) and codewhale-cli then fails E0433

4 participants