Skip to content

Fix create_project title field validation mismatch between schema and validation config#10124

Merged
pelikhan merged 6 commits intomainfrom
copilot/fix-schema-validation-mismatch
Jan 15, 2026
Merged

Fix create_project title field validation mismatch between schema and validation config#10124
pelikhan merged 6 commits intomainfrom
copilot/fix-schema-validation-mismatch

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

Fix create_project title field validation mismatch

Issue: CI Failure #21035582213 - Schema validation mismatch in create_project

Summary

Fixed inconsistency between safe_outputs_tools.json and safe_output_validation_config.go where the title field for create_project was marked as optional in the tool schema but required in the validation config, causing validation failures for workflows using auto-generated titles.

Plan

  • Explore repository and understand the issue
  • Fix the validation config: Change Required: true to Required: false for title field in create_project
  • Run unit tests to verify the fix
  • Run formatting to ensure code style compliance
  • Verify schema alignment
  • Merge main branch (first time)
  • Merge main branch again and recompile (as requested)
  • Document the fix and update summary

Root Cause

PR #10068 added title-prefix configuration for auto-generating project titles when the title parameter is not provided. The implementation updated:

  • pkg/workflow/js/safe_outputs_tools.json - Removed title from required array (empty array)
  • actions/setup/js/create_project.cjs - Added auto-generation logic using title-prefix
  • pkg/workflow/create_project.go - Added TitlePrefix config field
  • MISSED: pkg/workflow/safe_output_validation_config.go:250 still had Required: true

Changes Made

File: pkg/workflow/safe_output_validation_config.go
Line: 250
Change: Required: trueRequired: false

This allows workflows to use create_project without an explicit title parameter, relying on auto-generation from the title-prefix configuration (default: "Campaign") combined with issue context.

Merge Details

  • First merge (88c4c30): Merged main branch, resolved conflict for campaign-generator.lock.yml (accepted deletion)
  • Second merge (4f28d82): Merged latest main branch updates and recompiled all workflows

Verification

Schema Alignment Confirmed:

  • JSON Schema: required: [] (title is optional)
  • Go Validation: Required: false (title is optional)

Tests Pass: All create_project related tests pass
Code Formatting: Passed
Main Branch Merged: Up to date with main (commit 4f28d82)
Workflows Recompiled: Successfully recompiled 124 workflows

Impact

This fix allows workflows to create projects with auto-generated titles, as originally intended in PR #10068:

safe-outputs:
  create-project:
    target-owner: myorg
    title-prefix: "Campaign"  # Auto-generates: "Campaign: <issue-title>"

The workflow can now call create_project without a title parameter, and the system will automatically generate one based on the issue context.

Original prompt

This section details on the original issue you should resolve

<issue_title>[CI Failure Doctor] Schema validation mismatch in create_project: title field inconsistency between safe_outputs_tools.json and safe_output_validation_config.go</issue_title>
<issue_description># 🏥 CI Failure Investigation - Run githubnext/gh-aw#21035582213

Summary

CI failed due to incomplete schema update in PR #10068. The title field for create_project was made optional in the tool schema (safe_outputs_tools.json) but remains marked as required in the validation config (safe_output_validation_config.go), causing a validation mismatch.

Failure Details

Root Cause Analysis

PR #10068 added a title-prefix configuration feature to allow auto-generation of project titles when the title parameter is not provided. The implementation updated:

pkg/workflow/js/safe_outputs_tools.json - Removed title from required array
actions/setup/js/create_project.cjs - Added auto-generation logic using title-prefix
pkg/workflow/create_project.go - Added TitlePrefix config field
pkg/workflow/safe_outputs_config_generation.go - Added title-prefix handling

MISSED: pkg/workflow/safe_output_validation_config.go line 250 still has Required: true for the title field

The Problem

// pkg/workflow/safe_output_validation_config.go:250
"create_project": {
    DefaultMax: 1,
    Fields: map[string]FieldValidation{
        "title": {Required: true, Type: "string", Sanitize: true, MaxLength: 256},  // ❌ Should be false
        // ...
    },
},

This creates a mismatch:

  • Tool schema says: title is optional (can be auto-generated)
  • Validation config says: title is required (must be provided)

Impact

Any workflow using create_project without an explicit title parameter (relying on auto-generation) will fail runtime validation with an error like:

Error: Required field 'title' is missing

This breaks the intended functionality of the title-prefix feature.

Recommended Fix

File: pkg/workflow/safe_output_validation_config.go
Line: 250
Change:

 "create_project": {
     DefaultMax: 1,
     Fields: map[string]FieldValidation{
-        "title": {Required: true, Type: "string", Sanitize: true, MaxLength: 256},
+        "title": {Required: false, Type: "string", Sanitize: true, MaxLength: 256},
         "owner": {Type: "string", Sanitize: true, MaxLength: 128},
         // ...
     },
 },

Validation Steps:

  1. Make the change above
  2. Run make test to verify tests pass
  3. Run make agent-finish to ensure full validation
  4. Commit and push

Prevention Strategies

For Future Development

Rule: When changing a field's required status in any tool schema, ALWAYS update BOTH:

  1. pkg/workflow/js/safe_outputs_tools.json (tool schema)
  2. pkg/workflow/safe_output_validation_config.go (validation config)

These files must stay in sync. The validation config enforces what the tool schema declares.

Detection Pattern

Search for the pattern: "making X field optional" or "removing X from required"

When found, verify updates in:

  • Tool schema JSON file
  • Validation config Go file
  • Implementation code (JavaScript)
  • Go config structs

AI Team Self-Improvement

Add to AGENTS.md or developer instructions:

### Safe Output Schema Changes

When modifying safe-output tool schemas (making fields optional/required):

1. **ALWAYS update both files together**:
   - `pkg/workflow/js/safe_outputs_tools.json` - Tool schema definition
   - `pkg/workflow/safe_output_validation_config.go` - Runtime validation rules

2. **Search both files** for the field name when making changes
   
3. **Pattern to remember**:
   - Making a field optional? Update `Required: true``Required: false` in validation config
   - Making a field required? Update `Required: false``Required: true` and add to `required` array in JSON

4. **Validation**: Run `make test` to catch mismatches before committing

Historical Context

This is a common pattern when adding "optional with auto-generation" features. Previous similar changes successfully updated both files. This appears to be an oversight rather than a systemic issue.

Pattern: INCOMPLETE_SCHEMA_UPDATE
First occurrence: Run githubnext/gh-aw#21035582213
Related failures: None found

Investigation Metadata

  • Investigator: CI Failure Doctor
  • Investigation Date: 2026-01-15T15:20:00Z
  • Investigation File: /tmp/gh-aw/cache-memory/investigations/2026-01-15-21035582213.json
  • ...

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ch JSON schema

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix schema validation mismatch for create_project title field Fix create_project title field validation mismatch between schema and validation config Jan 15, 2026
Copilot AI requested a review from mnkiefer January 15, 2026 19:20
@pelikhan pelikhan marked this pull request as ready for review January 15, 2026 21:11
@pelikhan
Copy link
Contributor

@copilot merge main

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot merge main

Main branch merged in commit 88c4c30. Resolved merge conflict for campaign-generator.lock.yml (accepted deletion from main).

@pelikhan
Copy link
Contributor

@copilot merge main, recompile

Copilot AI and others added 2 commits January 15, 2026 21:25
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot merge main, recompile

Main branch merged and workflows recompiled in commit ed89ec4. Successfully compiled 124 workflows.

@pelikhan pelikhan merged commit 6859cfd into main Jan 15, 2026
47 checks passed
@pelikhan pelikhan deleted the copilot/fix-schema-validation-mismatch branch January 15, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants