-
Notifications
You must be signed in to change notification settings - Fork 14
refactor(agent): remove visible primary-agent mode picker (#239) #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a096344
feat(config): add default_agent migration module
Astro-Han 0ea6e3a
refactor(agent): remove plan agent; wire default_agent migration
Astro-Han 2087f83
refactor(app): remove @-mention subagent typeahead
Astro-Han 20b0717
refactor(agent): broaden explore prompt to multi-domain research
Astro-Han 345bc1b
fix(ui): render historical AgentPart mentions as plain text
Astro-Han 1c6e397
test: add picker-removal verification harnesses
Astro-Han 47c649a
fix(agent): address PR #242 review feedback
Astro-Han 4b3aebe
test(app): regression coverage for AgentPart history restore
Astro-Han a2a6cdb
test(app): assert @bot stays plain text in mixed-parts case
Astro-Han File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import { test, expect } from "bun:test" | ||
| import * as fs from "node:fs/promises" | ||
| import * as path from "node:path" | ||
|
|
||
| const APP_SRC = __dirname | ||
| // packages/app/src → up 2 to packages → into ui/src/components | ||
| const UI_COMPONENTS = path.resolve(__dirname, "..", "..", "ui", "src", "components") | ||
|
|
||
| // Allowlist: legitimate references to mode === "primary" outside the picker context. | ||
| // Each entry: { file: relative-to-APP_SRC, line: 1-based, reason: short justification }. | ||
| // Add entries here only when you have read the line and confirmed it is not picker-related. | ||
| const MODE_PRIMARY_ALLOWLIST: { file: string; line: number; reason: string }[] = [ | ||
| { | ||
| file: "context/global-sync/utils.ts", | ||
| line: 15, | ||
| reason: "type guard isAgent: validates agent shape, accepts any of subagent|primary|all (not picker logic)", | ||
| }, | ||
| ] | ||
|
|
||
| async function walk(dir: string, acc: string[] = []): Promise<string[]> { | ||
| const entries = await fs.readdir(dir, { withFileTypes: true }) | ||
| for (const entry of entries) { | ||
| const full = path.join(dir, entry.name) | ||
| if (entry.isDirectory()) { | ||
| if (entry.name === "node_modules" || entry.name.startsWith(".")) continue | ||
| await walk(full, acc) | ||
| } else if (entry.isFile() && /\.(ts|tsx)$/.test(entry.name) && !/\.test\.tsx?$/.test(entry.name)) { | ||
| acc.push(full) | ||
| } | ||
| } | ||
| return acc | ||
| } | ||
|
|
||
| test("i18n bundles contain no primary-agent / mode-picker copy", async () => { | ||
| const zh = await fs.readFile(path.join(APP_SRC, "i18n", "zh.ts"), "utf8") | ||
| const en = await fs.readFile(path.join(APP_SRC, "i18n", "en.ts"), "utf8") | ||
| const re = /primary agent|default agent|agent mode|mode picker/i | ||
| expect(zh).not.toMatch(re) | ||
| expect(en).not.toMatch(re) | ||
| }) | ||
|
|
||
| test('no source file in packages/app/src uses mode === "primary" outside the allowlist', async () => { | ||
| const files = await walk(APP_SRC) | ||
| const re = /mode\s*[!=]==?\s*['"]primary['"]/ | ||
| const offenders: { file: string; line: number; text: string }[] = [] | ||
| for (const file of files) { | ||
| const text = await fs.readFile(file, "utf8") | ||
| const lines = text.split(/\r?\n/) | ||
| lines.forEach((lineText, i) => { | ||
| if (!re.test(lineText)) return | ||
| const relPath = path.relative(APP_SRC, file) | ||
| const ok = MODE_PRIMARY_ALLOWLIST.some((a) => a.file === relPath && a.line === i + 1) | ||
| if (!ok) offenders.push({ file: relPath, line: i + 1, text: lineText.trim() }) | ||
| }) | ||
| } | ||
| if (offenders.length > 0) { | ||
| const summary = offenders.map((o) => ` ${o.file}:${o.line} ${o.text}`).join("\n") | ||
| throw new Error( | ||
| `Found ${offenders.length} mode === "primary" reference(s) in packages/app/src not in MODE_PRIMARY_ALLOWLIST:\n${summary}\n\nIf the reference is legitimate (not picker-related), add it to MODE_PRIMARY_ALLOWLIST in this test file with a one-line reason.`, | ||
| ) | ||
| } | ||
| }) | ||
|
|
||
| test("agentList memo is gone from prompt-input.tsx", async () => { | ||
| const file = path.join(APP_SRC, "components", "prompt-input.tsx") | ||
| const text = await fs.readFile(file, "utf8") | ||
| expect(text).not.toContain("agentList") | ||
| }) | ||
|
|
||
| test("message-part.tsx no longer renders agent pill", async () => { | ||
| // After Task 5, HighlightedText drops agents from allRefs and the type union no | ||
| // longer includes "agent". Source-grep guards against future regressions that | ||
| // re-introduce a styled pill via the same data-highlight marker. | ||
| const file = path.join(UI_COMPONENTS, "message-part.tsx") | ||
| const text = await fs.readFile(file, "utf8") | ||
| // Match data-highlight="agent" / 'agent' / `agent` to survive quote-style changes. | ||
| expect(text).not.toMatch(/data-highlight\s*=\s*["'`]agent["'`]/) | ||
| }) |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.