From 7a3f818bc3583cf0af8ea3b0693f229818c619c2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 13:37:38 +0000 Subject: [PATCH 1/4] Initial plan From 70c1e87f54318ade42b1a485a137cd58ef2f22bd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 13:42:40 +0000 Subject: [PATCH 2/4] Initial plan for draft_issue content_type support Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com> --- .github/aw/serena-tool.md | 203 +++++++++++++++++++++++++++----------- 1 file changed, 145 insertions(+), 58 deletions(-) diff --git a/.github/aw/serena-tool.md b/.github/aw/serena-tool.md index b95c22085b..706ebface3 100644 --- a/.github/aw/serena-tool.md +++ b/.github/aw/serena-tool.md @@ -1,86 +1,173 @@ # Serena Language Server Tool -Serena is an **advanced static analysis tool** that provides deep code understanding through language server capabilities. It is designed for **advanced coding tasks** that require sophisticated code analysis. +Serena is a **language service protocol (LSP) MCP server** for semantic code analysis. Use it ONLY when you need deep code understanding beyond text manipulation. -## When to Use Serena +## Quick Decision: Should I Use Serena? -⚠️ **Important**: Serena should only be suggested when the user **explicitly requests advanced static analysis** for specific programming languages. +**✅ YES - Use Serena when you need:** +- Symbol navigation (find all usages of a function/type) +- Call graph analysis across files +- Semantic duplicate detection (not just text matching) +- Refactoring analysis (functions in wrong files, extraction opportunities) +- Type relationships and interface implementations -**Appropriate use cases:** -- Deep code refactoring requiring semantic understanding -- Complex code transformations across multiple files -- Advanced type checking and inference -- Cross-file dependency analysis -- Language-specific semantic analysis +**❌ NO - Use simpler tools when:** +- Searching text patterns → Use `grep` +- Editing files → Use `edit` tool +- Running commands → Use `bash` +- Working with YAML/JSON/Markdown → Use `edit` tool +- Simple file operations → Use `bash` or `create` -**NOT recommended for:** -- Simple file editing or text manipulation -- Basic code generation -- General workflow automation -- Tasks that don't require deep code understanding +**Rule of thumb**: If `grep` or `bash` can solve it in 1-2 commands, don't use Serena. ## Configuration -When a user explicitly asks for advanced static analysis capabilities: +Add to workflow frontmatter: ```yaml tools: - serena: [""] # Specify the programming language(s) + serena: ["go"] # Specify language(s): go, typescript, python, ruby, rust, java, cpp, csharp ``` -**Supported languages:** -- `go` -- `typescript` -- `python` -- `ruby` -- `rust` -- `java` -- `cpp` -- `csharp` -- And many more (see `.serena/project.yml` for full list) - -## Detection and Usage - -**To detect the repository's primary language:** -1. Check file extensions in the repository -2. Look for language-specific files: - - `go.mod` → Go - - `package.json` → TypeScript/JavaScript - - `requirements.txt` or `pyproject.toml` → Python - - `Cargo.toml` → Rust - - `pom.xml` or `build.gradle` → Java - - etc. - -## Example Configuration +Multi-language repositories: +```yaml +tools: + serena: ["go", "typescript"] # First language is default fallback +``` + +## Available Serena Tools + +### Navigation & Analysis +- `find_symbol` - Search for symbols by name +- `get_symbols_overview` - List all symbols in a file +- `find_referencing_symbols` - Find where a symbol is used +- `find_referencing_code_snippets` - Find code snippets using a symbol +- `search_for_pattern` - Search for code patterns (regex) + +### Code Editing +- `read_file` - Read file with semantic context +- `create_text_file` - Create/overwrite files +- `insert_at_line` - Insert content at line number +- `insert_before_symbol` / `insert_after_symbol` - Insert near symbols +- `replace_lines` - Replace line range +- `replace_symbol_body` - Replace symbol definition +- `delete_lines` - Delete line range + +### Project Management +- `activate_project` - **REQUIRED** - Activate Serena for workspace +- `onboarding` - Analyze project structure +- `restart_language_server` - Restart LSP if needed +- `get_current_config` - View Serena configuration +- `list_dir` - List directory contents + +## Usage Workflow + +### 1. Activate Serena First + +**Always call activate_project before other Serena tools:** + +```javascript +// activate_project tool +{ + "path": "/home/runner/work/gh-aw/gh-aw" +} +``` + +### 2. Combine with Other Tools + +**Best practice**: Use bash for discovery, Serena for analysis ```yaml tools: - serena: ["go"] # For Go repositories requiring advanced static analysis + serena: ["go"] + bash: + - "find pkg -name '*.go' ! -name '*_test.go'" + - "cat go.mod" + github: + toolsets: [default] +``` + +**Pattern**: +1. Use `bash` to list files +2. Use Serena to analyze semantic structure +3. Use `edit` to make changes + +### 3. Use Cache for Recurring Analysis + +Track analysis state across runs: + +```yaml +tools: + serena: ["go"] + cache-memory: true # Store analysis history +``` + +Load cache → Analyze new/changed files → Save results → Avoid redundant work + +## Common Patterns + +### Pattern 1: Find All Function Usages + +``` +1. Use find_symbol to locate function definition +2. Use find_referencing_code_snippets to find call sites +3. Analyze patterns ``` -## User Interaction Pattern +### Pattern 2: Code Quality Analysis -When a user describes a task: +``` +1. Use get_symbols_overview on multiple files +2. Use find_symbol for similar function names +3. Use search_for_pattern for duplicate logic +4. Identify consolidation opportunities +``` -1. **Analyze the request**: Does it require advanced static analysis? -2. **If NO**: Use standard tools (bash, edit, etc.) -3. **If YES**: Ask the user if they want to use Serena for advanced static analysis -4. **Only add Serena** if the user explicitly confirms +### Pattern 3: Daily Code Analysis -**Example conversation:** +``` +1. Load previous state from cache-memory +2. Select files using round-robin or priority +3. Use Serena for semantic analysis +4. Save findings to cache +5. Generate improvement tasks +``` + +## Production Examples + +Workflows successfully using Serena: + +- **go-fan** (97.6% success) - Go module usage analysis with round-robin +- **sergo** (94.4% success) - Daily code quality with 50/50 cached/new strategies +- **semantic-function-refactor** - Function clustering and outlier detection +- **daily-compiler-quality** - Rotating file analysis with cache tracking -User: "I need to refactor the authentication logic across multiple files with proper type safety" +## Common Pitfalls -Agent: "This task involves complex cross-file refactoring. Would you like me to use the Serena language server for advanced static analysis? This will provide deeper code understanding but adds complexity to the workflow." +❌ **Using Serena for non-code files** - Use `edit` for YAML/JSON/Markdown +❌ **Forgetting activate_project** - Always call first +❌ **Not combining with bash** - Use bash for file discovery +❌ **Missing language configuration** - Must specify language(s) -User: "Yes, use Serena" +## Supported Languages -Agent: *Adds `serena: ["go"]` to the workflow configuration* +Primary languages with full LSP features: +- `go` (gopls) +- `typescript` (TypeScript/JavaScript) +- `python` (jedi/pyright) +- `ruby` (solargraph) +- `rust` (rust-analyzer) +- `java`, `cpp`, `csharp` -## Best Practices +See `.serena/project.yml` for complete list (25+ languages). -- **Default to simpler tools** when possible -- **Only suggest Serena** for genuinely complex analysis tasks -- **Ask before adding** Serena to a workflow -- **Explain the benefits** when suggesting Serena -- **Consider the trade-offs** (added complexity vs. better analysis) +## Decision Tree + +``` +Task requires code semantics/structure? +├─ NO → Use bash/edit/view +└─ YES + ├─ Simple text search/replace? → Use grep/bash + ├─ Config/data files? → Use edit + └─ Symbol/structure/semantic patterns? → Use Serena ✅ +``` From 105435344f7bfc3e08f9a59406fe86d2b7f85c20 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 13:46:15 +0000 Subject: [PATCH 3/4] Add draft_issue support to update_project schema and validation Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com> --- .github/workflows/smoke-project.lock.yml | 13 ++++++++++++- pkg/workflow/safe_output_validation_config.go | 4 +++- schemas/agent-output.json | 12 ++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/smoke-project.lock.yml b/.github/workflows/smoke-project.lock.yml index 3d927f11ad..616ac3895a 100644 --- a/.github/workflows/smoke-project.lock.yml +++ b/.github/workflows/smoke-project.lock.yml @@ -691,9 +691,20 @@ jobs: "type": "string", "enum": [ "issue", - "pull_request" + "pull_request", + "draft_issue" ] }, + "draft_body": { + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "draft_title": { + "type": "string", + "sanitize": true, + "maxLength": 256 + }, "fields": { "type": "object" }, diff --git a/pkg/workflow/safe_output_validation_config.go b/pkg/workflow/safe_output_validation_config.go index 5ab3dfbbff..ba9926d8a1 100644 --- a/pkg/workflow/safe_output_validation_config.go +++ b/pkg/workflow/safe_output_validation_config.go @@ -239,10 +239,12 @@ var ValidationConfig = map[string]TypeValidationConfig{ // When provided, the update-project safe output applies a "z_campaign_" label. // This is part of the campaign tracking convention but not required for general use. "campaign_id": {Type: "string", Sanitize: true, MaxLength: 128}, - "content_type": {Type: "string", Enum: []string{"issue", "pull_request"}}, + "content_type": {Type: "string", Enum: []string{"issue", "pull_request", "draft_issue"}}, "content_number": {OptionalPositiveInteger: true}, "issue": {OptionalPositiveInteger: true}, // Legacy "pull_request": {OptionalPositiveInteger: true}, // Legacy + "draft_title": {Type: "string", Sanitize: true, MaxLength: 256}, + "draft_body": {Type: "string", Sanitize: true, MaxLength: MaxBodyLength}, "fields": {Type: "object"}, }, }, diff --git a/schemas/agent-output.json b/schemas/agent-output.json index bde09366d4..9e57a62682 100644 --- a/schemas/agent-output.json +++ b/schemas/agent-output.json @@ -504,8 +504,8 @@ }, "content_type": { "type": "string", - "enum": ["issue", "pull_request"], - "description": "Type of content to add to the project board" + "enum": ["issue", "pull_request", "draft_issue"], + "description": "Type of content to add to the project board. Use 'issue' or 'pull_request' to add existing repo content, or 'draft_issue' to create a draft item inside the project." }, "content_number": { "oneOf": [{ "type": "number" }, { "type": "string" }], @@ -519,6 +519,14 @@ "oneOf": [{ "type": "number" }, { "type": "string" }], "description": "PR number (legacy field, use content_number instead)" }, + "draft_title": { + "type": "string", + "description": "Title for a Projects v2 draft issue. Required when content_type is 'draft_issue'." + }, + "draft_body": { + "type": "string", + "description": "Optional body for a Projects v2 draft issue (markdown). Only used when content_type is 'draft_issue'." + }, "fields": { "type": "object", "description": "Custom project field values to set/update. Creates fields if missing.", From 8941a62bf6717dd6937df6b7454056533eb41ac1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 13:53:18 +0000 Subject: [PATCH 4/4] Final validation - draft_issue support complete Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com> --- .github/workflows/dependabot-burner.lock.yml | 13 ++++++++++++- .github/workflows/package-lock.json | 10 ++++++++++ .github/workflows/security-alert-burndown.lock.yml | 13 ++++++++++++- .github/workflows/test-project-url-default.lock.yml | 13 ++++++++++++- 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dependabot-burner.lock.yml b/.github/workflows/dependabot-burner.lock.yml index 0c3dd741b9..82c18cb798 100644 --- a/.github/workflows/dependabot-burner.lock.yml +++ b/.github/workflows/dependabot-burner.lock.yml @@ -568,9 +568,20 @@ jobs: "type": "string", "enum": [ "issue", - "pull_request" + "pull_request", + "draft_issue" ] }, + "draft_body": { + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "draft_title": { + "type": "string", + "sanitize": true, + "maxLength": 256 + }, "fields": { "type": "object" }, diff --git a/.github/workflows/package-lock.json b/.github/workflows/package-lock.json index 2e2800d33f..303d9dcb80 100644 --- a/.github/workflows/package-lock.json +++ b/.github/workflows/package-lock.json @@ -83,6 +83,7 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==", "license": "Apache-2.0", + "peer": true, "engines": { "node": ">=8.0.0" } @@ -104,6 +105,7 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-2.4.0.tgz", "integrity": "sha512-jn0phJ+hU7ZuvaoZE/8/Euw3gvHJrn2yi+kXrymwObEPVPjtwCmkvXDRQCWli+fCTTF/aSOtXaLr7CLIvv3LQg==", "license": "Apache-2.0", + "peer": true, "engines": { "node": "^18.19.0 || >=20.6.0" }, @@ -116,6 +118,7 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.4.0.tgz", "integrity": "sha512-KtcyFHssTn5ZgDu6SXmUznS80OFs/wN7y6MyFRRcKU6TOw8hNcGxKvt8hsdaLJfhzUszNSjURetq5Qpkad14Gw==", "license": "Apache-2.0", + "peer": true, "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, @@ -131,6 +134,7 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.208.0.tgz", "integrity": "sha512-Eju0L4qWcQS+oXxi6pgh7zvE2byogAkcsVv0OjHF/97iOz1N/aKE6etSGowYkie+YA1uo6DNwdSxaaNnLvcRlA==", "license": "Apache-2.0", + "peer": true, "dependencies": { "@opentelemetry/api-logs": "0.208.0", "import-in-the-middle": "^2.0.0", @@ -533,6 +537,7 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.4.0.tgz", "integrity": "sha512-RWvGLj2lMDZd7M/5tjkI/2VHMpXebLgPKvBUd9LRasEWR2xAynDwEYZuLvY9P2NGG73HF07jbbgWX2C9oavcQg==", "license": "Apache-2.0", + "peer": true, "dependencies": { "@opentelemetry/core": "2.4.0", "@opentelemetry/semantic-conventions": "^1.29.0" @@ -549,6 +554,7 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-2.4.0.tgz", "integrity": "sha512-WH0xXkz/OHORDLKqaxcUZS0X+t1s7gGlumr2ebiEgNZQl2b0upK2cdoD0tatf7l8iP74woGJ/Kmxe82jdvcWRw==", "license": "Apache-2.0", + "peer": true, "dependencies": { "@opentelemetry/core": "2.4.0", "@opentelemetry/resources": "2.4.0", @@ -566,6 +572,7 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.39.0.tgz", "integrity": "sha512-R5R9tb2AXs2IRLNKLBJDynhkfmx7mX0vi8NkhZb3gUkPWHn6HXk5J8iQ/dql0U3ApfWym4kXXmBDRGO+oeOfjg==", "license": "Apache-2.0", + "peer": true, "engines": { "node": ">=14" } @@ -788,6 +795,7 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -1125,6 +1133,7 @@ "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", "license": "MIT", + "peer": true, "dependencies": { "accepts": "^2.0.0", "body-parser": "^2.2.1", @@ -1992,6 +2001,7 @@ "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/.github/workflows/security-alert-burndown.lock.yml b/.github/workflows/security-alert-burndown.lock.yml index 582f7b9fc7..a8207cc9d5 100644 --- a/.github/workflows/security-alert-burndown.lock.yml +++ b/.github/workflows/security-alert-burndown.lock.yml @@ -564,9 +564,20 @@ jobs: "type": "string", "enum": [ "issue", - "pull_request" + "pull_request", + "draft_issue" ] }, + "draft_body": { + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "draft_title": { + "type": "string", + "sanitize": true, + "maxLength": 256 + }, "fields": { "type": "object" }, diff --git a/.github/workflows/test-project-url-default.lock.yml b/.github/workflows/test-project-url-default.lock.yml index fea0cd1a8d..0ff72c73b1 100644 --- a/.github/workflows/test-project-url-default.lock.yml +++ b/.github/workflows/test-project-url-default.lock.yml @@ -487,9 +487,20 @@ jobs: "type": "string", "enum": [ "issue", - "pull_request" + "pull_request", + "draft_issue" ] }, + "draft_body": { + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "draft_title": { + "type": "string", + "sanitize": true, + "maxLength": 256 + }, "fields": { "type": "object" },