Skip to content

perf: bind generic interaction append payloads [1.4] - #10123

Closed
joeyorlando wants to merge 2 commits into
release/1.4from
backport/bind-interaction-append-payload-1.4
Closed

joeyorlando wants to merge 2 commits into
release/1.4from
backport/bind-interaction-append-payload-1.4

Conversation

@joeyorlando

@joeyorlando joeyorlando commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Closed before merge: this function-only backport still introduces a new migration timestamp beyond main migrations missing from release/1.4. A later upgrade would skip those migrations under Drizzle's timestamp high-water mark. The migration prefix policy prohibits this pattern; the focused function tests alone do not validate cross-release upgrade safety.

The main-branch optimization remains in #10122. Do not ship this backport. A safe 1.4 solution requires a separately evaluated approach that preserves the supported upgrade history, rather than bypassing the migration guard.

@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 c5a1a56 for @joeyorlando in 6 min 11 s —— View job

Archestra code review

Needs changes before merge · reviewed c5a1a56 · 1 finding: 1 medium

Fix the local setup action reference in #1 so the regression workflow can execute.

The migration replaces payload literals with a bound JSONB parameter while keeping native casts and omitted-column defaults (platform/backend/src/database/migrations/0586_bind-interaction-append-payload.sql:49–56). The validation, replay and activity-accounting blocks match the previous function, and the snapshot differs only in its identifiers. The focused regression passed on PostgreSQL 18, and migration metadata and SQL validation passed. The new regression workflow needs its local action reference corrected.

# Severity Finding Location
1 medium Regression workflow uses an invalid local action reference .github/workflows/interaction-append.yml:43
Review notes

Reviewed

  • Bound values and native casts (0586_bind-interaction-append-payload.sql)
  • Driver encoding and replay (interaction-user-activity.ts, 0566_interaction_user_activity.sql)
  • Upgrade regression and CI (interaction-append-postgres.test.mjs, interaction-append.yml)
  • Migration history (0586_snapshot.json, _journal.json)

Tests

File Lines Focus
platform/backend/scripts/interaction-append-postgres.test.mjs +185 −0 Pins JSON/SQL nulls, 123.1234567890 precision, replay and activity counts of 2

The focused test covers the function upgrade but uses a reduced interactions table. It does not exercise the application encoder or concurrent append calls against the replacement function.

Not covered

  • The backend type check was stopped at the runner’s memory limit.
  • The configured formatter excludes the changed files.
  • Local regression used PostgreSQL 18 rather than CI’s PostgreSQL 17; some remote checks were still running.
History: 1 job
# Started (UTC) Job Result Duration
1 2026-11-03 00:49 review of c5a1a56 (job) changes requested, 1 finding · 3 attempts: 1. f4c1274d non_retriable (failure-field): launch.misconfigured: Details are withheld under Guardrails; a person can read them on the run page., 8 s (run, tier S); 2. 5ccca2af non_retriable (failure-field): image.claude_api_error: Details are withheld under Guardrails; a person can read them on the run page., 28 s (run, tier S); 3. 77393a44 completed, 5 min 26 s (run, tier S) 6 min 11 s

@joeyorlando joeyorlando closed this Nov 3, 2026

@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.

Needs changes before merge · Archestra review of c5a1a56 · 1 finding: 1 medium. Summary

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: $/.github/actions/setup-env

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. [medium] Regression workflow uses an invalid local action reference

The setup step starts its action path with $/ instead of ./.

On a pull request matching the workflow paths, GitHub Actions cannot resolve this as a local action: local action references must start with ./, while remote actions require an owner/repository and revision. The job therefore cannot reach dependency installation, migration metadata validation or the PostgreSQL regression test. The action exists at .github/actions/setup-env/action.yml, and the other workflows reference it with ./.

Recommendation:

Change the reference to ./.github/actions/setup-env.

Suggested change
- uses: $/.github/actions/setup-env
- uses: ./.github/actions/setup-env

@joeyorlando
joeyorlando deleted the backport/bind-interaction-append-payload-1.4 branch November 3, 2026 11:35
bbfisher pushed a commit to anbanai/archestra that referenced this pull request Nov 18, 2026
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](https://github.com/archestra-ai/archestra/actions/runs/41562122376)
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 archestra-ai#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.
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