fix(hooks): improve agent-scoped hook error messaging#1224
Open
bclermont wants to merge 3 commits into
Open
Conversation
When creating an agent-scoped hook without an explicit tenant_id, the config may be initialized with SentinelTenantID. The previous logic only checked for uuid.Nil when deciding whether to fill TenantID from context, causing the sentinel value to be passed to validation, which then fails with 'agent scope requires a real tenant_id'. Fix: Check for both uuid.Nil AND SentinelTenantID when deciding to fill TenantID from the request context. Fixes: agent-scoped hooks now properly inherit tenant context from the request connection, matching behavior of tenant-scoped hooks. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Frontend: Allow empty string in tenant_id schema validation (Zod) - Frontend: Validate tenant_id requirement only for agent scope (superRefine) - Frontend: Auto-fill tenant_id from auth context on agent-scope hook submit - Frontend: Fix Save button onClick to properly execute form submission - Dev: Add docker-compose.dev.yml for SQLite-based local dev (no PG needed) - Dev: Add DEV.md guide for local iteration (Go+Vite or Docker) This completes the fix for "agent scope requires a real tenant_id" error. Agent-scoped hooks now auto-populate tenant_id from user's auth context, never requiring manual entry. Save button is responsive in form dialog. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Agent-scoped hooks cannot be created in the master/system tenant. Updated error message to clearly indicate this requirement and guide users to create a workspace tenant. Changes: - Backend: Auto-fill tenant_id for both tenant and agent scopes - Backend: Improve error message for agent scope validation - Frontend: Auto-fill tenant_id from auth context for agent scope - Frontend: Allow empty string in tenant_id schema validation - Frontend: Validate tenant_id requirement only for agent scope The core issue: agent-scoped hooks require a real workspace tenant, not the master/system tenant where most users operate. This is by design to enforce proper tenant isolation. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
edf0a56 to
efe7155
Compare
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
Agent-scoped hooks cannot be created in the master/system tenant by design (for tenant isolation). This PR improves the error messaging to clearly explain this requirement.
Changes
tenant_idfor both tenant and agent scopestenant_idfrom auth context for agent scopetenant_idschema validationDesign Discussion
This PR assumes that agent-scoped hooks should NOT be allowed in the master/system tenant (by design, for tenant isolation). Is this the intended behavior?
🤖 Generated with Claude Code