Skip to content

Fix agent unavailable error on on-premises in Inbound E-Documents page#6380

Merged
Groenbech96 merged 4 commits intomainfrom
copilot/fix-agents-unavailable-bug
Feb 1, 2026
Merged

Fix agent unavailable error on on-premises in Inbound E-Documents page#6380
Groenbech96 merged 4 commits intomainfrom
copilot/fix-agents-unavailable-bug

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 30, 2026

Agent-related code in PopulateTaskInfo() fails on on-premises environments where agents are not available, causing page crash with "Agents are temporarily unavailable" error.

Changes

  • Add IsSaaSInfrastructure() check before accessing Agent Task records
  • Add ReadPermission() check to ensure user has access to Agent Task table
  • Clear AgentTask and AgentTaskStatus at procedure start for consistent UI state
local procedure PopulateTaskInfo()
var
    EnvironmentInformation: Codeunit "Environment Information";
begin
    Clear(AgentTask);
    AgentTaskStatus := '';
    if not EnvironmentInformation.IsSaaSInfrastructure() then
        exit;
    if not AgentTask.ReadPermission() then
        exit;
    // ... agent task lookup
end;

Follows existing pattern in EDocPOCopilotMatching.Codeunit.al for SaaS-only feature guards.


💡 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.

Fixes AB#620192

Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com>
ventselartur
ventselartur previously approved these changes Jan 30, 2026
…splay

Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com>
@github-actions github-actions bot added the AL: Apps (W1) Add-on apps for W1 label Jan 30, 2026
Copilot AI changed the title [WIP] Fix bug with agents temporarily unavailable message Fix agent unavailable error on on-premises in Inbound E-Documents page Jan 30, 2026
Copilot AI requested a review from Groenbech96 January 30, 2026 09:33
@Groenbech96
Copy link
Copy Markdown
Contributor

@copilot I would also add something like "If not AgentTask.ReadPermission then exit".

Also ask yourself, do we need to clear the task if we dont find anything, if we already clearaed it before?

Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 30, 2026

@copilot I would also add something like "If not AgentTask.ReadPermission then exit".

Also ask yourself, do we need to clear the task if we dont find anything, if we already clearaed it before?

Added ReadPermission() check and removed the redundant Clear(AgentTask) after FindFirst() in commit a8e656b.

@Groenbech96 Groenbech96 marked this pull request as ready for review January 30, 2026 09:39
@Groenbech96 Groenbech96 requested a review from a team as a code owner January 30, 2026 09:39
@Groenbech96 Groenbech96 enabled auto-merge (squash) February 1, 2026 09:12
@Groenbech96 Groenbech96 added the Linked Issue is linked to a Azure Boards work item label Feb 1, 2026
@github-actions github-actions bot added this to the Version 28.0 milestone Feb 1, 2026
@Groenbech96 Groenbech96 merged commit 8eb271c into main Feb 1, 2026
42 of 45 checks passed
@Groenbech96 Groenbech96 deleted the copilot/fix-agents-unavailable-bug branch February 1, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Linked Issue is linked to a Azure Boards work item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants