Skip to content

Fix assistant history text block merging#4449

Merged
icehaunter merged 7 commits into
mainfrom
fix/assistant-text-block-merge
Jun 1, 2026
Merged

Fix assistant history text block merging#4449
icehaunter merged 7 commits into
mainfrom
fix/assistant-text-block-merge

Conversation

@KyleAMathews
Copy link
Copy Markdown
Contributor

Summary

  • merge adjacent reconstructed assistant text messages into the previous text block instead of adding multiple text blocks
  • keep assistant text + tool call grouping intact
  • add a regression test for adjacent assistant text reconstruction

Testing

  • pnpm --dir packages/agents-runtime test test/pi-adapter.test.ts

This avoids OpenAI Responses duplicate fallback item ids like msg_153 when replayed assistant history contains multiple unsigned text blocks in a single assistant message.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

Electric Agents Desktop Builds

Build artifacts for commit 5c7610c.

Platform Status Artifact
macOS Apple Silicon Passed DMG
macOS Intel Passed DMG
Windows x64 Passed Installer
Linux x64 Passed AppImage / deb

Workflow run

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

Electric Agents Mobile Build

Android preview build for commit 5c7610c.

Platform Profile Status Build
Android preview Passed EAS build

Workflow run

@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.23%. Comparing base (b852526) to head (ba47e61).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@                      Coverage Diff                       @@
##           horton/run-failure-details    #4449      +/-   ##
==============================================================
+ Coverage                       56.22%   56.23%   +0.01%     
==============================================================
  Files                             266      266              
  Lines                           28763    28762       -1     
  Branches                         8054     8058       +4     
==============================================================
+ Hits                            16171    16174       +3     
+ Misses                          12577    12573       -4     
  Partials                           15       15              
Flag Coverage Δ
packages/agents 70.37% <ø> (ø)
packages/agents-mobile 85.41% <ø> (ø)
packages/agents-runtime 81.88% <100.00%> (+0.03%) ⬆️
packages/agents-server 75.14% <ø> (ø)
packages/agents-server-ui 5.69% <ø> (ø)
packages/electric-ax 46.33% <ø> (ø)
typescript 56.23% <100.00%> (+0.01%) ⬆️
unit-tests 56.23% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from horton/run-failure-details to main June 1, 2026 13:24
@icehaunter
Copy link
Copy Markdown
Contributor

Needs a rebase on latest main

@icehaunter icehaunter merged commit 9e01e58 into main Jun 1, 2026
18 checks passed
@icehaunter icehaunter deleted the fix/assistant-text-block-merge branch June 1, 2026 16:12
msfstef added a commit that referenced this pull request Jun 3, 2026
… by TS CI

These type errors were sitting on main, hidden while the TS suite was
startup-failing. Reviving it (the ts_tests permission fix in this PR) exposes
them:

- pi-adapter: type the merged assistant `content` so the array spreads into
  prevContent typecheck (was unknown[], from #4449).
- webhook-signature: node:crypto no longer exports JsonWebKey; cast the jwk
  input to JsonWebKeyInput instead.
- sandbox/docker: re-export isDockerAvailable from the docker.ts file so the
  `sandbox/docker` subpath resolves it under the tsconfig path wildcard used by
  dependents (electric-ax, agents-server-ui, conformance-tests).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
msfstef added a commit that referenced this pull request Jun 3, 2026
…nfig (#4495)

## What

Started as a fix for three CI failures observed on `main`; reviving the
TS suite (the first fix) then surfaced pre-existing typecheck breakage
that had been hidden while CI was dark, which this PR also cleans up.

### CI / build fixes

| Job | Verdict | Fix |
|-----|---------|-----|
| **TS tests** | 🔴 Real — startup-failing on *every* run since #4450 |
Job-scoped `packages: write` on the `ensure_sync_service_image` caller |
| **Agents Desktop Canary** | 🔴 Real — fails every run since #4441 |
`-c.channel` → `-c.publish.channel` |
| **Changesets** | 🟡 Flake — intermittent `agents-runtime` dts race |
Promote `skills/types` to a tsdown entry |

### Typecheck fixes (pre-existing breakage exposed by re-enabling TS CI)

| File | Issue | Fix |
|------|-------|-----|
| `agents-runtime/src/pi-adapter.ts` | merged assistant `content` typed
`unknown[]` (#4449) | annotate the block-array type |
| `agents-runtime/src/webhook-signature.ts` | `node:crypto` no longer
exports `JsonWebKey` | cast input to `JsonWebKeyInput` |
| `agents-runtime/src/sandbox/docker.ts` | `isDockerAvailable` not on
the subpath the tsconfig wildcard resolves | re-export it (cascade fix
for `electric-ax` / conformance) |
| `agents-server-ui/tsconfig.json` | UI typechecked agents-runtime's
node-only sandbox source via `paths` | resolve the index via built
`.d.ts`; keep only the browser-safe `client` source-mapped — UI stays
node-free |

## Why (CI fixes)

- **TS tests:** #4450 downgraded the workflow's top-level token to
`packages: read`, but `ts_tests.yml` is the sole caller of the reusable
`ensure_sync_service_image.yml`, whose job requests `packages: write` to
push the sync-service image to GHCR. A called reusable workflow cannot
elevate permissions above the caller's token, so GitHub failed the
**entire run at startup** — meaning the TS test suite had not run on any
commit (main or PR) since. Fixed by granting `packages: write` only on
the caller job, keeping the top-level token at `read` per #4450's
hardening.
- **Agents Desktop Canary:** electron-builder 26.8.1 rejects the config
with `unknown property 'channel'`. `channel` is not a valid root
property — moved under the publish provider (`-c.publish.channel=beta`,
alongside the existing `-c.publish.url`).
- **Changesets:** `agents-runtime` dts build intermittently fails with
`UNLOADABLE_DEPENDENCY: Could not load src/skills/types.d.ts` under CI's
parallel build. Promoting `src/skills/types.ts` to a first-class tsdown
entry makes its `.d.ts` a stable named output instead of a raced chunk.

## Validation

- Workflow files parse as valid YAML.
- All previously-failing typecheck packages (`agents-runtime`,
`electric-ax`, `agents-server-ui`, `agents-server-conformance-tests`)
verified green via CI-faithful isolated (`--frozen-lockfile`) install +
build + typecheck.

## Not in scope (pre-existing, flagged separately)

- `runtime-dsl.test.ts` (92 tests, `401 UNAUTHORIZED: Principal is not
allowed to spawn`) — from #4475's permission enforcement (@icehaunter);
test fixtures need spawn permission seeded. Not a build/type issue.
- An `agents-mcp` dts-race flake in the conformance build (same class as
the `skills/types` one).

## Note for reviewer

The canary maps channel input `canary` → publish channel `beta`.
Preserved the existing value, but flagging in case it should be
`canary`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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