8000 [pull] main from can1357:main by pull[bot] · Pull Request #123 · ericrihm/oh-my-pi · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a6931da
fix(mnemopi): require token boundaries for lexical recall
alphastorm Sep 13, 2026
84af30c
fix(mnemopi): match AAAK word substitutions on whole words only
alphastorm Sep 25, 2026
33268ec
fix(mnemopi): preserve prefix and compound-token recall
alphastorm Sep 13, 2026
0a21eb8
docs(mnemopi): add changelog entry for #13320
alphastorm Sep 25, 2026
7456a13
docs(mnemopi): add changelog entry for #13322
alphastorm Sep 25, 2026
ac45c6f
feat(coding-agent): let retain and learn write to the shared memory bank
alphastorm Sep 25, 2026
546c1e5
fix(mnemopi): keep plural and inflected queries matching stored words
alphastorm Sep 25, 2026
eae8386
docs(coding-agent): add changelog entry for #13324
alphastorm Sep 25, 2026
eebb273
fix(collab): reclaim a host room the relay still holds after a drop
alphastorm Sep 26, 2026
2dcc276
docs(changelog): note the collab host room reclaim fix
alphastorm Sep 26, 2026
5e6296a
fix(cli): exit non-zero when a command ends before completing
alphastorm Sep 26, 2026
14863dc
docs(changelog): note the unfinished-command exit fix
alphastorm Sep 26, 2026
3472de7
fix(collab): cap host reclaim backoff at 5s
Sep 26, 2026
5e5a679
fix(cli): name the stalled command in the unsettled-entry report
Sep 26, 2026
e339caf
Merge PR #13355: fix(collab): reclaim a host room the relay still hol…
Sep 26, 2026
30c9065
Merge PR #13373: fix(cli): exit non-zero when a command ends before c…
Sep 26, 2026
d307be7
ci(tmp): probe darwin-x64 build on macos-14 (throwaway, remove before…
Sep 26, 2026
ebac558
fix(collab): hold a reclaim open until the relay accepts it
Sep 26, 2026
399f224
docs(changelog): cover the collab reclaim and unsettled-command follo…
Sep 26, 2026
1c50922
ci: source-matched PR addons, split native build, in-cluster addon stash
Sep 26, 2026
a2b958b
ci: build darwin-x64 on Apple silicon; fix cross target-list check
Sep 26, 2026
9363552
ci: make main-only addon cache save/prune non-fatal
Sep 26, 2026
9bf23fe
fix(mnemopi): match word forms instead of open-ended prefixes in recall
Sep 26, 2026
c6dbefe
Merge PR #13391: ci: second set of CI uplifts (@H4vC)
H4vC Sep 26, 2026
59c4a89
fix(coding-agent): offer global memory scope only where a shared bank…
Sep 26, 2026
42f1732
Merge PR #13320: fix(mnemopi): match AAAK word substitutions on whole…
H4vC Sep 26, 2026
10fc35e
Merge remote-tracking branch 'origin/main' into pr13322
Sep 26, 2026
03a4002
Merge PR #13322: fix(mnemopi): require token boundaries for lexical r…
H4vC Sep 26, 2026
b8082f2
Merge remote-tracking branch 'origin/main' into pr13324
Sep 26, 2026
061f21e
Merge PR #13324: feat(coding-agent): let retain and learn write to th…
H4vC Sep 26, 2026
ae9b399
fix(mcp): preserve structured results in tool details
shawnkoh Sep 26, 2026
dd60fe3
docs: link structured result fix to upstream review
shawnkoh Sep 26, 2026
eb8450d
test(cli): make initial title PTY probe deterministic
shawnkoh Sep 26, 2026
a179558
fix(mcp): omit spilled structured duplicates from persistence
shawnkoh Sep 26, 2026
d0d5cfa
test(vcs): establish watcher baseline before branch switches
shawnkoh Sep 26, 2026
3f47bc1
chore(mcp): drop unrelated test changes and trim structured-result docs
Sep 26, 2026
763d576
Merge PR #13398: fix(mcp): preserve structured results in tool detail…
H4vC Sep 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions .github/actions/native-artifacts/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: "Install native addon artifacts"
description: >
Downloads the native addons built once by the native_addons job and
Downloads the native addons built once by the native_addons jobs and
installs exact targets without invoking Bazel. The linux-x64 pair ships as
its own small `natives-linux-x64` artifact; the rest (`native-addons`) is
fetched only when a requested target needs it.
fetched only when a requested target needs it. On omp-kata pods the pair is
first restored from the in-cluster stash native_addons writes to the shared
runner-cache PVC, skipping the artifact download.

inputs:
targets:
Expand All @@ -13,6 +15,13 @@ inputs:
description: Destination directory for the .node files
required: false
default: packages/natives/native
stash:
description: >
native_addons `stash` output ("<artifact-relative path>=<sha256>"
pairs). Used only where the stash directory is mounted; any missing
or mismatched entry falls back to the artifact download.
required: false
default: ""

runs:
using: composite
Expand All @@ -22,6 +31,7 @@ runs:
shell: bash
env:
NATIVE_TARGETS: ${{ inputs.targets }}
NATIVE_STASH: ${{ inputs.stash }}
run: |
set -euo pipefail
read -r -a targets <<< "$NATIVE_TARGETS"
Expand All @@ -42,6 +52,31 @@ runs:
echo "::error::PR runs only publish natives-linux-x64; targets outside linux-x64-baseline/linux-x64-modern are unavailable: $NATIVE_TARGETS"
exit 1
fi
# Written by ci.yml native_addons ("Stage native addons for
# consumers"); keep the directory in sync with it.
stash_dir=/opt/bazel-repo-cache/ci-natives
out="$RUNNER_TEMP/omp-native-artifacts"
if [ "$x64" = true ] && [ -n "$NATIVE_STASH" ] && [ -d "$stash_dir" ]; then
read -r -a entries <<< "$NATIVE_STASH"
restored=true
for entry in "${entries[@]}"; do
rel="${entry%%=*}"
sha="${entry##*=}"
mkdir -p "$out/$(dirname "$rel")"
if ! cp "$stash_dir/$sha.node" "$out/$rel" 2>/dev/null \
|| [ "$(sha256sum "$out/$rel" | cut -d' ' -f1)" != "$sha" ]; then
restored=false
break
fi
done
if [ "$restored" = true ]; then
echo "linux-x64 addons restored from the in-cluster stash"
x64=false
else
echo "::warning title=Native addon stash miss::falling back to the natives-linux-x64 artifact"
for entry in "${entries[@]}"; do rm -f "$out/${entry%%=*}"; done
fi
fi
echo "x64=$x64" >> "$GITHUB_OUTPUT"
echo "rest=$rest" >> "$GITHUB_OUTPUT"

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/bazel-cache-warm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ name: Warm bazel disk cache
# bump rewrites Cargo.toml/Cargo.lock), so
# without warming here every release rebuilt the
# darwin addons cold (~40-50 min on
# macos-15-intel — run 30357804722).
# macos-15-intel — run 30357804722). Both scopes
# now build on Apple silicon (darwin-x64 cross-
# compiles; see release_binary_hosted in ci.yml).
# warm_bun (ubuntu-22.04)-> the shared `bun-<os>-<lockhash>` store entry.
# PR jobs restore it but never save (per-PR-ref
# copies of the ~500 MB store once ate ~9.4 GB of
Expand Down Expand Up @@ -70,7 +72,7 @@ jobs:
fail-fast: false
matrix:
include:
- { os: macos-15-intel, target: darwin-x64-baseline, scope: release-darwin-x64 }
- { os: macos-15, target: darwin-x64-baseline, scope: release-darwin-x64 }
- { os: macos-14, target: darwin-arm64, scope: release-darwin-arm64 }
runs-on: ${{ matrix.os }}
steps:
Expand Down
380 changes: 301 additions & 79 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/mnemosyne-memory-backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ The coding-agent wrapper applies scoping on top of the underlying `Mnemopi` pack
- `per-project` writes to and recalls from a bank derived from the current working directory alone — its basename plus a stable hash of its absolute path, independent of the surrounding git layout.
- `per-project-tagged` writes to the project-local bank and recalls from both the project-local bank and the shared global bank, with duplicate recall results merged.

Under `global` and `per-project-tagged`, the `retain` and `learn` tools also accept `scope: "global"`, which writes an item or lesson to the shared bank so every project recalls it. Under `per-project` the option is not offered, because no bank is recalled by every project.

The combined project-plus-global behavior lives in the wrapper. The `@oh-my-pi/pi-mnemopi` package itself still exposes banks and constructor options directly, including `bank` for selecting a bank name. Project-local banks other than the shared bank are stored as sibling bank databases managed by Mnemopi's `BankManager`.

## Recall previews and full-row reads
Expand Down
12 changes: 6 additions & 6 deletions docs/natives-build-release-debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ build --tls_certificate=infra/bazel-remote/ca.crt

### Split Rust validation and addon production

`.github/workflows/ci.yml` separates `rust_validate` from `native_addons`; TypeScript jobs depend only on `native_addons`.
`.github/workflows/ci.yml` separates `rust_validate` from the addon jobs: `native_addons` produces the linux-x64 pair and `native_addons_cross` (non-PR only) the other Linux-hosted targets. TypeScript jobs depend only on `native_addons`.

**Pull requests never build or validate Rust.** Native-affecting PRs are rare enough that they don't warrant a PR-side bazel build: `rust_validate` is skipped entirely (`if: github.event_name != 'pull_request'`), and `native_addons` fetches the latest release's Linux x64 addon pair from the `@oh-my-pi/pi-natives-linux-x64` npm leaf, smoke-loads both, and uploads them as the `natives-linux-x64` workflow artifact. The loader skips its version sentinel for workspace loads, so release-versioned addons load fine under a newer checkout; a symbol added after that release is a throwing stub that names the addon and the rebuild command, rather than `undefined`. A PR whose TypeScript tests depend on changed native behavior fails visibly (and CI emits a notice on any native-touching PR); the Rust side is validated post-merge on main and again at release.
**Pull requests never build or validate Rust.** Native-affecting PRs are rare enough that they don't warrant a PR-side bazel build: `rust_validate` is skipped entirely (`if: github.event_name != 'pull_request'`), and `native_addons` restores the linux-x64 pair main built for the same native sources from actions/cache (`natives-linux-x64-v1-<hash>`, hashed over the same inputs as the bazel-cache config and source hashes). Without an exa 10BC8 ct entry (the PR changes native inputs, or main has not built that state yet) it takes main's newest entry, and without any entry the latest `@oh-my-pi/pi-natives-linux-x64` npm release. It smoke-loads the pair, uploads it as the `natives-linux-x64` workflow artifact, and emits a notice whenever the addons are not source-matched. The loader skips its version sentinel for workspace loads, so any of these load fine under a newer checkout; a symbol added after that build is a throwing stub that names the addon and the rebuild command, rather than `undefined`. A PR whose TypeScript tests depend on its own native changes fails visibly; the Rust side is validated post-merge on main and again at release. Only main saves the cache entry (other refs' entries are unreadable elsewhere but still count against the 10 GB repo quota) and prunes all but the newest two.

On non-PR events both jobs run on `omp-kata` pods against the cluster remote cache. `rust_validate` runs:
On non-PR events all three jobs run on `omp-kata` pods against the cluster remote cache. `rust_validate` runs:

```bash
bazelisk --bazelrc="$rc" test //crates/... # full Rust suite
Expand All @@ -160,7 +160,7 @@ bazelisk --bazelrc="$rc" build --config=rustfmt //crates/...
- `--config=clippy` = rules_rust clippy aspect + `-Dwarnings`; `--config=clippy-strict` layers the generated `bazel/clippy.bazelrc` for crates with `[lints] workspace = true`.
- `--config=rustfmt` = rustfmt aspect against the workspace `rustfmt.toml`.

`native_addons` on main builds the six Linux-hosted targets one at a time to avoid concurrent-link OOMs, then builds `//:natives-linux-all` as an aggregate consistency check. It uploads the linux-x64 pair as the `natives-linux-x64` workflow artifact and every other `.node` output as `native-addons`, so the TS test jobs (which need only the pair) skip the larger download. Downstream jobs use `.github/actions/native-artifacts`, which always downloads `natives-linux-x64`, adds `native-addons` only when a requested target is outside that pair, and installs the requested target set without invoking Bazel.
On main, `native_addons` builds `NATIVES_X64_TARGETS` and `native_addons_cross` builds `NATIVES_CROSS_TARGETS` in parallel, each one target per invocation to avoid concurrent-link OOMs; the cross job then checks that the two lists together equal the `//:natives-linux-all` srcs. The TS fan-out waits only for the pair. `native_addons` uploads the pair as `natives-linux-x64` and also stashes it content-addressed on the shared runner-cache PVC (`/opt/bazel-repo-cache/ci-natives/<sha256>.node`, pruned after two days); `native_addons_cross` uploads everything else as `native-addons`. Downstream jobs use `.github/actions/native-artifacts`: on omp-kata it restores the pair from the stash by the digests in `native_addons`' `stash` output (re-verified, falling back to the artifact on any miss), elsewhere it downloads `natives-linux-x64`; it adds `native-addons` only when a requested target is outside that pair, and installs the requested target set without invoking Bazel.

Bazel native jobs need no toolchain setup: bazelisk is on the GitHub images and baked into the kata runner image, while Bazel fetches Rust/zig/LLVM/xwin hermetically. The Windows ARM64 host build uses the Rust, Ninja, CMake, and Visual Studio ARM64 tools installed on `windows-11-arm`; `rust-toolchain.toml` selects the pinned nightly.

Expand All @@ -181,11 +181,11 @@ Hosted disk caches use `bazel-disk-v3-<scope>-<os>-<arch>-<config-hash>-<source-

### Native artifact actions

`.github/actions/bazel-natives` is the direct builder: `bazel-cache` → `OMP_BAZEL_RC=<rc> bun scripts/bazel-natives.ts <targets> --dest <dest>`, followed by a disk-cache save after a hosted miss. `.github/actions/native-artifacts` is the no-build consumer: download `natives-linux-x64` (plus `native-addons` for any other target) → run the same driver with `--source`.
`.github/actions/bazel-natives` is the direct builder: `bazel-cache` → `OMP_BAZEL_RC=<rc> bun scripts/bazel-natives.ts <targets> --dest <dest>`, followed by a disk-cache save after a hosted miss. `.github/actions/native-artifacts` is the no-build consumer: in-cluster stash or `natives-linux-x64` download (plus `native-addons` for any other target) → run the same driver with `--source`.

### Release binary builds and publishing

Binary builds are build-only and run in parallel with the test fan-out. `release_binary` (Linux plus cross-built win32-x64) needs only `native_addons`, whose workflow artifact supplies its addons. `release_binary_hosted` needs only `release_metadata` and starts when a release is detected: each Darwin leg builds through `bazel-natives` with scope `release-<target_id>` (seeded near HEAD by the warm workflow), while the `windows-11-arm` leg builds its native addon through Cargo/N-API. Every leg then runs `bun run ci:release:build-binaries` and smoke-tests the executable on its target architecture. Publishing is held behind `release_gate`: `release_native_leaves` downloads all built addons and publishes the six `@oh-my-pi/pi-natives-<tag>` leaves from one Linux runner, and the GitHub release / verify / core npm chain runs beside it.
Binary builds are build-only and run in parallel with the test fan-out. `release_binary` (Linux plus cross-built win32-x64) needs only the two addon jobs, whose workflow artifacts supply its addons. `release_binary_hosted` needs only `release_metadata` and starts when a release is detected: each Darwin leg builds through `bazel-natives` with scope `release-<target_id>` (seeded near HEAD by the warm workflow), both on Apple silicon — darwin-x64 cross-compiles on `macos-15`, whose Rosetta (unlike macOS 14's) runs the AVX2 bun-darwin-x64 runtime for the smoke test — while the `windows-11-arm` leg builds its native addon through Cargo/N-API. Every leg then runs `bun run ci:release:build-binaries` and smoke-tests the executable. Publishing is held behind `release_gate`: `release_native_leaves` downloads all built addons and publishes the six `@oh-my-pi/pi-natives-<tag>` leaves concurrently from one Linux runner (each leaf packs in its own directory; per-leaf logs are grouped, and any failure fails the step after all six finish), and the GitHub release / verify / core npm chain runs beside it.

## Debugging playbook

Expand Down
26 changes: 26 additions & 0 deletions docs/tools/eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,32 @@ JS helpers are asynchronous; Python file helpers are synchronous while `tool.<na

`display()` captures JSON-compatible structures, images, markdown, or text according to the backend.

### MCP structured results

MCP calls return an object with `text` and MCP-specific `details`. When the server
supplies `structuredContent`, it is available as `details.structuredContent`:

```js
const result = await tool.mcp__example_page({});
if (result.hasError) throw new Error(result.text);
const page = result.details.structuredContent;
if (page === undefined) throw new Error("Server did not return structured data");
display(page.next_cursor);
```

Python callers use `result["details"].get("structuredContent")`. The property is
absent when the server supplies no structured result; OMP does not infer it from
JSON-looking text. Error results can also carry structured data, so check
`hasError` before treating a payload as a successful result.

`text` remains the model-facing rendering, including any JSON echo and output
truncation notices. Truncation does not trim `details.structuredContent`: code
receives the complete server-supplied object even when the rendering spills. Use
server-side pagination/bounds for large data and display only the fields needed
by the model. The object is not validated against the server's output schema or
treated as trusted. Ordinary tools keep their existing return shapes, including
bare strings for text-only results without details.

### `completion()`

A stateless, tool-free one-shot model call that returns a `CompletionHandle` immediately:
Expand Down
6 changes: 4 additions & 2 deletions docs/tools/learn.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

## Registration / Visibility
- `loadMode = "essential"` and `strict = true`, so the tool remains top-level rather than mounting under `xd://`.
- Approval is dynamic: a call containing `skill`, or any call while `memory.backend = "local"`, has `approval = "write"`; a memory-only Hindsight/Mnemopi call has `approval = "read"`.
- Approval is dynamic: a call containing `skill` or `scope: "global"`, or any call while `memory.backend = "local"`, has `approval = "write"`; any other memory-only Hindsight/Mnemopi call has `approval = "read"`.
- Registration requires `autolearn.enabled = true` (default `false`) and `memory.backend` equal to `"hindsight"`, `"mnemopi"`, or `"local"`.
- Enabled top-level sessions auto-include `learn` in an ordinary explicit tool list. Subagents do not discover or auto-receive it, but may use it when their requested-tools/frontmatter list explicitly includes it.
- Execution is single-shot and emits no progress updates.
Expand All @@ -22,6 +22,7 @@
|---|---|---:|---|
| `memory` | `string` | Yes | Durable, self-contained lesson to remember: what, when, and why. The schema has no minimum length; backend-specific sanitization/storage determines whether an empty value succeeds. |
| `context` | `string` | No | Source context for the lesson. |
| `scope` | `"project" \| "global"` | No | `global` stores the lesson in the Mnemopi bank every project recalls. In the schema and tool description only when `memory.backend = "mnemopi"` and `mnemopi.scoping` is `global` or `per-project-tagged`; omitted means `project`. |
| `skill` | `{ action: "create" \| "update"; name: string; description: string; body: string }` | No | Managed skill to create or enhance after the lesson succeeds. `body` is Markdown without frontmatter. |

## Outputs
Expand All @@ -36,8 +37,9 @@
## Flow
1. `LearnTool.createIf(...)` exposes the tool only when `autolearn.enabled` is true and `memory.backend` is `"hindsight"`, `"mnemopi"`, or `"local"`.
2. `execute(...)` stores the lesson before attempting any skill mutation:
- Mnemopi: calls `rememberScoped(...)` with `source: "coding-agent-learn"`, `importance: 0.8`, `scope: "bank"`, extraction enabled, `veracity: "tool"`, `memoryType: "fact"`, and session/cwd/context metadata; an absent returned id is treated as failure.
- Mnemopi: for `scope: "global"`, first resolves `state.getGlobalRetainTarget()`, which throws under `per-project` scoping before anything is stored or any skill is written; then calls `rememberScoped(...)` (with that target for a global lesson) with `source: "coding-agent-learn"`, `importance: 0.8`, `scope: "bank"`, extraction enabled, `veracity: "tool"`, `memoryType: "fact"`, and session/cwd/context metadata; an absent returned id is treated as failure.
- Local backend: calls `localBackend.save(...)`, which normalizes and writes a project-scoped `learned.md`; `stored === 0` is treated as failure.
- Local backend and Hindsight reject `scope: "global"` with `Global memory scope is only available with the Mnemopi backend.` before storing, queueing, or writing a skill.
- Hindsight: enqueues retention with `state.enqueueRetain(memory, context)` and reports the lesson as queued.
3. If `skill` is absent, the tool returns after the memory write/queue.
4. If `skill.action == "create"`, the tool checks the lowercased/validated name against active authored skills. A conflict returns an error result after the lesson has already been stored or queued.
Expand Down
Loading
Loading
0