Skip to content

feat(web): add independent session header Agent icon toggle - #1704

Open
techotaku39 wants to merge 2 commits into
tiann:mainfrom
techotaku39:investigate/session-header-agent-icon
Open

feat(web): add independent session header Agent icon toggle#1704
techotaku39 wants to merge 2 commits into
tiann:mainfrom
techotaku39:investigate/session-header-agent-icon

Conversation

@techotaku39

Copy link
Copy Markdown
Contributor

Summary

  • Add an independent Agent icon display preference.
  • Keep the existing Agent preference for controlling Agent type text.
  • Apply both preferences to desktop/mobile session headers and share previews.
  • Preserve existing behavior by enabling Agent icons by default.
  • Add English/Chinese labels and regression coverage for all display combinations.

Problem / Motivation

The session header previously used one Agent preference to control both the Agent type text and its icon. Users could not display the icon without also displaying the Agent type.

Validation

  • bun typecheck — passed across CLI, Web, Hub, and Relay.
  • bun run test:web -- src/components/SessionHeader.test.tsx src/components/AgentFlavorIcon.test.tsx src/lib/shareTurnMetadata.test.ts src/routes/settings/index.test.tsx — 55/55 passed.
  • Invoke-HapiTaskPlaywright.ps1 -Name investigate-session-header-agent-icon -Suite Root terminal-wrap-fidelity.spec.ts — 2/2 passed.
  • Invoke-HapiTaskPlaywright.ps1 -Name investigate-session-header-agent-icon -Suite Root share-turn.spec.ts — 14/14 passed.
  • bun run build — passed.
  • Public mobile smoke test — 1/1 passed; icon-only spacing verified at approximately 4px.

Related Issues

None

AI Disclosure

AI-assisted implementation using OpenAI Codex (GPT-5.6).

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings

  • [Major] Existing agent: false preferences are migrated to icon-on - before this change, that setting hid both Agent text and its icon. Stored values from current users do not contain agentIcon, so the new true fallback silently restores the icon in session headers and share previews. Evidence: web/src/hooks/useSessionHeaderMetadata.ts:21.

    Suggested fix:

    if (typeof record.agentIcon !== 'boolean' && typeof record.agent === 'boolean') {
        record.agentIcon = record.agent
    }

    Also cover parseSessionHeaderMetadata(JSON.stringify({ agent: false })) and assert that both Agent fields remain disabled.

Summary

  • Review mode: initial
  • One Major persisted-preference migration regression found in the full latest diff.

Testing

  • Not run (automation; PR code was not executed). GitHub CI had passed typecheck and selected E2E tests at review time; the full test job was still running, and the CLI integration job was failing with logs unavailable until workflow completion.

HAPI Bot

export const DEFAULT_SESSION_HEADER_METADATA: SessionHeaderMetadataPreferences = {
showLabels: true,
agent: true,
agentIcon: true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MAJOR] Preserve the previous Agent visibility choice during migration

Before this key existed, agent: false hid both the text and icon. Existing localStorage records therefore contain agent: false but no agentIcon; the generic fallback now resolves the missing key to true, so those users unexpectedly get an icon in both the session header and shared images.

Suggested fix:

const record = parsed as Record<string, unknown>
if (typeof record.agentIcon !== 'boolean' && typeof record.agent === 'boolean') {
    record.agentIcon = record.agent
}

Then add a regression assertion:

expect(
    parseSessionHeaderMetadata(JSON.stringify({ agent: false }))
).toMatchObject({ agent: false, agentIcon: false })

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings

  • None.

Summary

Review mode: follow-up after new commits

  • The prior Major preference-migration issue is resolved by deriving a missing agentIcon value from the stored agent value.
  • No new findings above the 80% confidence threshold in the full latest diff.
  • Residual risk: CI validation is incomplete at review time; the main test job is still running, and the failed integration job log is unavailable until the workflow completes.

Testing

  • Not run (automation; PR code was not executed).

HAPI Bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant