Skip to content

fix(service): widen session execution scope admission_id to fit coordination ids - #3559

Closed
wahllllll wants to merge 1 commit into
agentscope-ai:mainfrom
wahllllll:fix/service-admission-id-width
Closed

wahllllll wants to merge 1 commit into
agentscope-ai:mainfrom
wahllllll:fix/service-admission-id-width

Conversation

@wahllllll

Copy link
Copy Markdown
Contributor

Problem

Starting a managed chat turn on Kubernetes fails with:

ERROR: value too long for column "admission_id" (varchar(128))

This is problem 1 of #3558 (the reporter worked around it with a manual ALTER TABLE ... TYPE VARCHAR(1024)).

Root cause

The data plane persists the per-turn coordination id as builder_session_execution_scope.admission_id:

  • TurnLeaseService.acquireOrConflictFenced mints leaseOwnerId = instanceId.get() + "/" + UUID.randomUUID().
  • SessionTurnRunner passes lease.coordinationId() into SessionNativeLogService.beginAdmission -> ManagedEventOutbox.beginAdmission, which stores it as admission_id.

The same value is stored in builder_coord_lease.instance_id, which is varchar(255), but admission_id was only varchar(128). BuilderInstanceId falls back to prefix + "-" + host + "-" + pid + "-" + 8 hex chars (and pid already contains the host), so a long pod/host name pushes instanceId - and therefore the coordination id - past 128 chars. Admission then fails before the turn can start.

Fix

  • Widen SessionExecutionScopeEntity.admissionId to length = 255, matching builder_coord_lease.instance_id. The coordination id can never exceed what the lease column already accepts, so the two columns now agree.
  • Update agent-event-mirror-outbox-postgresql.sql: the CREATE TABLE uses varchar(255), and an idempotent ALTER TABLE ... ALTER COLUMN admission_id TYPE varchar(255) widens existing deployments created as varchar(128) (Hibernate ddl-auto: update does not change the length of an existing column).

Test

Added SessionExecutionScopeAdmissionIdTest, which persists a 203-char admission id through JPA. It fails on the old schema with Value too long for column "ADMISSION_ID CHARACTER VARYING(128)" and passes after the change.

mvn -pl agentscope-service/service-common -am test -Dtest=SessionExecutionScopeAdmissionIdTest

Note: the same report also shows a ux_builder_session_event_seq duplicate-key warning. That is the separate concurrent-append path in SessionEventLog and is intentionally not touched by this change.

…ination ids

The data plane stores the turn coordination id ("<instanceId>/<uuid>") as
builder_session_execution_scope.admission_id, but the column was varchar(128)
while the same value is stored in builder_coord_lease.instance_id as
varchar(255). Long pod/host names push the coordination id past 128 chars, so
admission fails with "value too long for column admission_id".

Widen admission_id to varchar(255) to match the coordination lease column, and
add an idempotent ALTER so existing deployments created as varchar(128) are
widened too.

Fixes agentscope-ai#3558
@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@wahllllll

Copy link
Copy Markdown
Contributor Author

Closing: #4154 removed the agentscope-service tree from main, including the session execution scope tables this widened. The change no longer has a target on the default branch.

@wahllllll wahllllll closed this Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 重要不紧急

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants