Skip to content

perf: bind generic interaction append payloads - #10122

Merged
joeyorlando merged 7 commits into
mainfrom
fix/bind-interaction-append-payload
Nov 3, 2026
Merged

joeyorlando merged 7 commits into
mainfrom
fix/bind-interaction-append-payload

Conversation

@joeyorlando

@joeyorlando joeyorlando commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Generic interaction appends currently embed encoded values into generated INSERT SQL. Large request/response bodies therefore enlarge the SQL PostgreSQL must parse on every call. Bind the payload and generate only validated column references and native casts, preserving omitted-column defaults, cached common shapes, retry semantics and activity accounting.

The migration only replaces a function; it adds no indexes and rewrites no interaction rows. The generated snapshot records the unchanged schema.

Validation: the PostgreSQL 17 CI run passed cross-release migration-history compatibility, migration metadata validation, and the function-upgrade regression checks: encoded JSON/SQL nulls, precision, defaults, existing-row replay, invalid payload rejection and exact activity counts. The migration-check regression verifies a valid stable worktree fails in main mode and passes in release mode. The dedicated validation workflow used for these measurements has been removed from this PR; existing CI retains the migration-check regression. No local test suites were run; the broader merge-queue suite has not run.

The initial synthetic generic-append benchmark improved median timing from 2.59 to 2.22 ms (~64 KB) and from 26.77 to 22.82 ms (~1 MB). These are isolated generic-path measurements, not a claim to explain all append latency.

The provisional release/1.4 backport #10123 was closed before merge. Introducing its migration after main-only migrations would violate the migration prefix rule and cause later upgrades to skip required migrations; do not backport this migration independently.

@joeyorlando
joeyorlando marked this pull request as ready for review November 3, 2026 00:46
@archestra-lobster-reviews

archestra-lobster-reviews Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Archestra reviewed 409f9b1 for @joeyorlando in 22 min 47 s —— View job

Archestra code review

Nothing blocks the merge · reviewed 409f9b1 · 1 finding: 1 low

Address #1 first: run interaction-append-postgres.test.mjs from a retained CI job so its PostgreSQL coverage is exercised on future changes.

Since f386794: 0 fixed · 0 still open · 1 new

Since f386794, the only source change is removal of the one-off interaction-append workflow; platform/backend/src/database/migrations/0618_bind-interaction-append-payload.sql and its PostgreSQL test are unchanged. The retained assertion in .github/scripts/test_check_migration_upgrades.py:124 verifies that the same stable worktree is rejected in main mode and accepted for release/1.3, matching the migration checker’s source/target semantics.

The SQL approach remains sound: 0618_bind-interaction-append-payload.sql:151 derives column names and native types from pg_attribute, while line 157 passes the payload as one bound parameter. The common-shape inserts, retry branch and activity updates are unchanged. 0618_snapshot.json matches 0617_snapshot.json after excluding snapshot IDs, and its prevId links to the previous snapshot.

Focused verification passed: backend type checking, migration journal and lint checks, Drizzle metadata validation, 11 migration-upgrade tests, seven existing append-model tests, and the disposable PostgreSQL 18 test. That test reported medians of 2.50→2.06 ms (~64 KiB) and 27.26→24.53 ms (~1 MiB), consistent with the optimization’s direction; these are local client-observed timings, not a production latency guarantee.

# Severity Finding Location
1 low interaction-append-postgres.test.mjs has no CI invocation platform/backend/scripts/interaction-append-postgres.test.mjs:28
Review notes

Reviewed

  • Append binding (0618_bind-interaction-append-payload.sql, 0594_prepare-interaction-appends.sql)
  • Append callers (interaction-user-activity.ts, interaction-user-activity-append.test.ts)
  • PostgreSQL regression (interaction-append-postgres.test.mjs)
  • Migration metadata (0618_snapshot.json, _journal.json)
  • Upgrade checks (test_check_migration_upgrades.py, check-migration-upgrades.py)

Observations

  • Schema stability (platform/backend/src/database/migrations/meta/0618_snapshot.json): excluding snapshot IDs, its content equals 0617_snapshot.json, and prevId points to the previous snapshot’s ID.
  • Migration scope (platform/backend/src/database/migrations/0618_bind-interaction-append-payload.sql): the migration contains only CREATE OR REPLACE FUNCTION, so it creates no indexes and rewrites no interaction rows.

Tests

File Lines Focus
.github/scripts/test_check_migration_upgrades.py +5 −0 Main mode rejects stable history; release/1.3 mode accepts it
platform/backend/scripts/interaction-append-postgres.test.mjs +185 −0 Generic appends preserve nulls, defaults, replay, and counts of 2

The focused tests cover the changed generic path; no changed behavior lacked a runtime check. The new PostgreSQL script does not repeat all four credential-shape combinations covered by the existing PGlite suite.

Not covered

  • The full backend and merge-queue suites were not run; verification used focused checks.
  • The local PostgreSQL run used version 18; the cited PostgreSQL 17 workflow was not rerun on this revision.
  • The repository linter excludes the standalone .mjs test, so no configured lint rule applied to it.
History: 6 jobs
# Started (UTC) Job Result Duration
1 2026-11-03 00:49 review of 99cc5ac (job) superseded by dd7dd41 2 min 18 s
2 2026-11-03 00:51 review of dd7dd41 (job) changes requested, 1 finding (run, tier S) 20 min 42 s
3 2026-11-03 01:48 review of f386794 (job) canceled 1 min 3 s
4 2026-11-03 01:49 review of f386794 (job) approved, 0 findings (run, tier S) 17 min 48 s
5 2026-11-03 10:51 review of 409f9b1 (job) canceled 1 min 2 s
6 2026-11-03 10:53 review of 409f9b1 (job) commented, 1 finding (run, tier S) 22 min 47 s

@archestra-lobster-reviews archestra-lobster-reviews 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.

Changes requested, resolved in f386794 · Archestra review of dd7dd41 · 1 finding: 1 medium. Summary

@archestra-lobster-reviews
archestra-lobster-reviews Bot dismissed their stale review November 3, 2026 02:07

The review of f386794 finds nothing that blocks the merge.

@archestra-lobster-reviews archestra-lobster-reviews 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.

Nothing blocks the merge · Archestra review of 409f9b1 · 1 finding: 1 low. Summary

const current = definitions.at(-1);
const profileId = "00000000-0000-4000-8000-000000000001";

test("append upgrade preserves encoded values, defaults, replay and accounting", async (t) => {

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.

1. [low] interaction-append-postgres.test.mjs has no CI invocation

The PostgreSQL regression test added for the bound generic path is no longer referenced by any workflow or package test script.

The latest revision removes the dedicated interaction-append workflow, which was the only caller of this test. The current workflows and package scripts contain no invocation of interaction-append-postgres.test.mjs; the existing model suite uses PGlite instead.

If a later migration changes generic native casting in a way supported by PGlite but rejected by PostgreSQL, the retained CI checks can pass without executing this regression test. The actual database behavior this PR relies on is therefore unprotected despite keeping the test file.

Recommendation:

Invoke this test from an existing migration-validation workflow with an isolated PostgreSQL service and its required connection variable.

@joeyorlando
joeyorlando added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 265414b Nov 3, 2026
65 of 66 checks passed
@joeyorlando
joeyorlando deleted the fix/bind-interaction-append-payload branch November 3, 2026 12:03
bbfisher pushed a commit to anbanai/archestra that referenced this pull request Nov 18, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.5.0-rc.21](archestra-ai/archestra@platform-v1.5.0-rc.20...platform-v1.5.0-rc.21)
(2026-11-04)


### Features

* **agent-runtime:** audit live terminal attaches and confirm Ctrl+C
before it reaches the agent
([archestra-ai#10134](archestra-ai#10134))
([536445b](archestra-ai@536445b))
* **guardrails:** Break the glass settings let blocked calls through
with a yell, unattended runs included
([archestra-ai#10126](archestra-ai#10126))
([dd9fa12](archestra-ai@dd9fa12))
* **guardrails:** connect ChatGPT desktop with native plugin setup
([archestra-ai#10051](archestra-ai#10051))
([bc24cbd](archestra-ai@bc24cbd))
* **guardrails:** rename Soft block to Other blocked calls; Yell tool
first ([archestra-ai#10174](archestra-ai#10174))
([0f46b43](archestra-ai@0f46b43))
* **llm-proxy:** rename Model Router to Unified Model API
([archestra-ai#10138](archestra-ai#10138))
([25cc30c](archestra-ai@25cc30c))
* **llm:** connect to a model pool with the LLM Proxy connect steps
([archestra-ai#10157](archestra-ai#10157))
([11c7f9d](archestra-ai@11c7f9d))
* **model-pools:** support Gemini and Vertex destinations
([archestra-ai#10088](archestra-ai#10088))
([dc1ab2d](archestra-ai@dc1ab2d))
* **models:** clean up unconfigured request-discovered entries
([archestra-ai#10150](archestra-ai#10150))
([981f2a4](archestra-ai@981f2a4))
* **sre:** migrate agent to built-in object permissions
([archestra-ai#10146](archestra-ai#10146))
([699b428](archestra-ai@699b428))


### Bug Fixes

* **agents:** clarify agent creation choices and responsive layout
([archestra-ai#10172](archestra-ai#10172))
([9b6af74](archestra-ai@9b6af74))
* **agents:** return chat-capable built-in agents in search
([archestra-ai#10136](archestra-ai#10136))
([d3dda50](archestra-ai@d3dda50))
* **backend:** scope user agent runtime gateway tokens and enforce
start_agent_run subagent allowlists
([archestra-ai#10119](archestra-ai#10119))
([f4d1ba7](archestra-ai@f4d1ba7))
* **backend:** tests install the published native addons when a checkout
has none
([archestra-ai#10135](archestra-ai#10135))
([bff6802](archestra-ai@bff6802))
* **bedrock:** guard oversized Converse prompts before inference
([archestra-ai#10143](archestra-ai#10143))
([ac769a3](archestra-ai@ac769a3))
* **connect:** count Desktop instruction code points
([archestra-ai#10121](archestra-ai#10121))
([a8bf336](archestra-ai@a8bf336))
* **frontend:** explain why personal Claude subscription requires
archestra-claude-code command
([archestra-ai#10179](archestra-ai#10179))
([ed95113](archestra-ai@ed95113))
* **guardrails:** keep human review by default after the Break the glass
upgrade
([archestra-ai#10164](archestra-ai#10164))
([e8e9ffc](archestra-ai@e8e9ffc))
* **knowledge:** configure environments for uploaded files
([archestra-ai#10145](archestra-ai#10145))
([e418a87](archestra-ai@e418a87))
* **llm-proxy:** abort provider requests when clients disconnect
([archestra-ai#10092](archestra-ai#10092))
([7adb963](archestra-ai@7adb963))
* **llm-proxy:** block unpriced vLLM requests under spend limits
([archestra-ai#10151](archestra-ai#10151))
([95f533e](archestra-ai@95f533e))
* **llm-proxy:** show unknown usage when streams end early
([archestra-ai#10177](archestra-ai#10177))
([383ad0c](archestra-ai@383ad0c))
* **mcp:** expose gateway access flags and agent skill policies
([archestra-ai#10116](archestra-ai#10116))
([14afd2b](archestra-ai@14afd2b))
* **mcp:** unwrap run_tool wrappers around nullable params
([archestra-ai#10155](archestra-ai#10155))
([1d72de4](archestra-ai@1d72de4))
* **models:** block new requests to hidden models
([archestra-ai#10087](archestra-ai#10087))
([b9fa196](archestra-ai@b9fa196))
* **observability:** log LLM proxy pre-handler denials
([archestra-ai#10178](archestra-ai#10178))
([ca7e990](archestra-ai@ca7e990))
* **openappa:** let Claude Code read its own background command output
([archestra-ai#10139](archestra-ai#10139))
([e1e1980](archestra-ai@e1e1980))
* **openappa:** support GitHub Enterprise in the github battery and
repin OpenAPPA
([archestra-ai#10133](archestra-ai#10133))
([1fcac6c](archestra-ai@1fcac6c))
* **teams:** honor effective Enterprise entitlement for Team Sync
([archestra-ai#10153](archestra-ai#10153))
([ab73d4b](archestra-ai@ab73d4b))
* **teams:** require update permission for MCP team management
([archestra-ai#10165](archestra-ai#10165))
([6abae54](archestra-ai@6abae54))
* **teams:** roll up budgets and delegate member key management
([archestra-ai#10175](archestra-ai#10175))
([548a726](archestra-ai@548a726))


### Performance Improvements

* bind generic interaction append payloads
([archestra-ai#10122](archestra-ai#10122))
([265414b](archestra-ai@265414b))


### Code Refactoring

* **dev:** serialize checks and restore portable compiler caches
([archestra-ai#10104](archestra-ai#10104))
([2a1bffd](archestra-ai@2a1bffd))


### Miscellaneous Chores

* **openappa:** pin OpenAPPA with the annotator label-guide fixes
([archestra-ai#10131](archestra-ai#10131))
([fde9743](archestra-ai@fde9743))
* update agent runtime CLIs
([archestra-ai#10125](archestra-ai#10125))
([0e71d0b](archestra-ai@0e71d0b))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: archestra-ci[bot] <222894074+archestra-ci[bot]@users.noreply.github.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.

1 participant