Skip to content

Fix setup_handler KeyError and migrate owner_type to DB enum#2316

Merged
hiroshinishio merged 1 commit intomainfrom
wes
Feb 24, 2026
Merged

Fix setup_handler KeyError and migrate owner_type to DB enum#2316
hiroshinishio merged 1 commit intomainfrom
wes

Conversation

@hiroshinishio
Copy link
Collaborator

@hiroshinishio hiroshinishio commented Feb 24, 2026

Summary

  • Fixed KeyError: 'sender_id' in setup_handler that caused setup to silently fail (no Slack notification) for new installations like joeHeld/Unit-Testing-Demo
  • Properly populated all required BaseArgs fields (sender_id, sender_email, sender_display_name, is_fork, pr_title, pr_body, etc.) matching patterns from other handlers
  • Migrated owner_type column from text to PostgreSQL enum (owner_type_enum) in both dev and prod databases across installations, owners, and usage tables
  • Updated schema generator to auto-read PostgreSQL enum values from pg_enum and emit Literal types
  • Added X-Sender-Id header to the /setup_coverage_workflow API endpoint

Social Media Post (GitAuto)

New user installed GitAuto on a single repo. Setup ran, cloned the repo, created a PR branch - then silently crashed. No Slack alert, no error visible to the user. The setup handler was missing a required field (sender_id) that every other handler populates. While fixing it, we found the root cause was deeper: owner_type was a text column in our DB, allowing empty strings and typos like "O" instead of "Organization". Migrated it to a PostgreSQL enum so the DB enforces valid values.

Social Media Post (Wes)

Spent an hour tracing why a new user's setup created a PR branch but never finished. CloudWatch showed a KeyError buried inside an exception handler that swallowed it silently. The fix was straightforward - pass sender_id through to the handler. But digging into the data, I found 227 rows in dev and 14 in prod with empty or malformed owner_type values. The column was plain text with a default of empty string. Changed it to a Postgres enum. No more silent garbage.

@hiroshinishio hiroshinishio self-assigned this Feb 24, 2026
…e owner_type to DB enum

setup_handler was missing sender_id and other required BaseArgs fields,
causing KeyError when chat_with_agent accessed base_args['sender_id'].
Also migrated owner_type from text to PostgreSQL enum in both dev and prod
databases, and updated the schema generator to map DB enums to Python types.
@hiroshinishio hiroshinishio merged commit 9a77337 into main Feb 24, 2026
1 check passed
@hiroshinishio hiroshinishio deleted the wes branch February 24, 2026 03:57
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