Fix setup_handler KeyError and migrate owner_type to DB enum#2316
Merged
hiroshinishio merged 1 commit intomainfrom Feb 24, 2026
Merged
Fix setup_handler KeyError and migrate owner_type to DB enum#2316hiroshinishio merged 1 commit intomainfrom
hiroshinishio merged 1 commit intomainfrom
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
KeyError: 'sender_id'insetup_handlerthat caused setup to silently fail (no Slack notification) for new installations like joeHeld/Unit-Testing-DemoBaseArgsfields (sender_id,sender_email,sender_display_name,is_fork,pr_title,pr_body, etc.) matching patterns from other handlersowner_typecolumn fromtextto PostgreSQL enum (owner_type_enum) in both dev and prod databases acrossinstallations,owners, andusagetablespg_enumand emitLiteraltypesX-Sender-Idheader to the/setup_coverage_workflowAPI endpointSocial 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.