Skip to content

fix(agent-chat): guard integration lookup in manualPosting modal#1688

Open
giladresisi wants to merge 1 commit into
mainfrom
fix/agent-modal-integration-guard
Open

fix(agent-chat): guard integration lookup in manualPosting modal#1688
giladresisi wants to merge 1 commit into
mainfrom
fix/agent-modal-integration-guard

Conversation

@giladresisi

Copy link
Copy Markdown
Collaborator

Problem

Opening the agent-chat "populated modal" (the manualPosting CopilotKit action) can white-screen the whole chat with:

TypeError: Cannot read properties of undefined (reading 'picture')
  at OpenModal.useCallback[startModal] (agent.chat.tsx:305)

manualPosting builds the modal from properties — the channels the user has selected in the agent-chat sidebar (PropertiesContext, fed by AgentList). It looked up the integration with properties.find(...).picture and no null guard. Whenever the action references an integration that isn't in the selected list, find returns undefined and .picture throws.

This is reachable any time the agent opens the modal for a channel the user hasn't selected in the sidebar — e.g. asking the agent to open a modal for an existing post's channel.

Fix

One-character defensive guard — properties.find(...)?.picture || '' — so the modal degrades to an empty picture instead of crashing. No behavior change when the integration is present.

Notes

Pre-existing latent crash, independent of any specific feature. Small and self-contained.

🤖 Generated with Claude Code

The manualPosting CopilotKit action builds its modal from the channels
the user has selected in the agent-chat sidebar (PropertiesContext). It
read `properties.find(...).picture` with no null check, so whenever the
referenced integration isn't in that selected list the lookup returns
undefined and `.picture` throws, white-screening the chat.

This is reachable whenever the agent opens the modal for an integration
the user hasn't selected in the sidebar (e.g. asking it to open a modal
for an existing post's channel). Guard with optional chaining so the
modal degrades to an empty picture instead of crashing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@postiz-contribution postiz-contribution Bot added the contribution:approved Approved contributor label Jul 8, 2026
@postiz-contribution

Copy link
Copy Markdown

Contribution-checker quality warning
Heuristic score: 16/100 (low). This is a non-blocking warning surfaced by the project's quality settings.

Heuristics that flagged:

  • Excessive inline code references: 10 inline refs (>3)
  • PR doesn't use the repo's PR template: 5 required checkbox items missing (max 1, match ≥80%)
  • Body adds too many extra headers beyond the template: 3 extra headers (>1)
  • AI watermark phrase: Matched: "Generated with Claude Code"
  • Commit message too long: Longest: 749 chars

If this is a genuine contribution, please add detail to your PR description and tighten the diff scope before reviewers look at it.

@postiz-agent

postiz-agent Bot commented Jul 8, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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

Labels

contribution:approved Approved contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant