Skip to content

feat(Assignments) - #522

Merged
marcelklehr merged 23 commits into
mainfrom
feat/assignments
May 11, 2026
Merged

feat(Assignments)#522
marcelklehr merged 23 commits into
mainfrom
feat/assignments

Conversation

@marcelklehr

@marcelklehrmarcelklehr commented May 5, 2026

Copy link
Copy Markdown
Member

Todo:

  • Refactored ChattyLLMController to factor out business logic into a service
  • Implemented Assignments backend logic (db, APIController, Service, BgJob)
  • Implemented RRule checking
  • Implement front-end
    • Small header for assignment sessions to indicate what's going on
    • Maybe disable the chat input for assignment sessions?
    • Maybe a small icon for the chat session overview for assignment sessions
    • Query the session list regularly and for assignment sessions we need to check for new generations regularly
  • Implement better session titles for assignment sessions
  • Implement notification for mid-assignment approvals

Use the assignment tools in nextcloud/context_agent#162 to schedule assignments from the UI, or use curl :)

some stuff still missing
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Move business logic from CHattyLLMController to ChatServiec
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces an “Assignments” backend for the Assistant app and refactors the existing chat controller by moving business logic into a dedicated ChatService. It adds persistence (DB + migration), an OCS API for CRUD operations, and a background job to execute recurring assignments using RRULEs.

Changes:

  • Refactor: extract chat/session/message/task scheduling logic from ChattyLLMController into lib/Service/ChatService.php.
  • Feature: add Assignments domain (DB entity + mapper, OCS controller, service layer, OpenAPI schema) plus RRULE-based “due” evaluation.
  • Operations: add a timed background job to run due assignments per user; add simshaun/recurr dependency.

Reviewed changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 15 comments.

Show a summary per file
FileDescription
tests/psalm-baseline.xmlAdds Psalm baseline suppressions for logger('assistant') usage in the new Assignment entity.
openapi.jsonAdds Assignment schema and CRUD-ish assignment endpoints under /ocs/v2.php/apps/assistant/assignments.
lib/Service/UnauthorizedException.phpNew service-layer exception type for auth failures.
lib/Service/NotFoundException.phpNew service-layer exception type for missing resources.
lib/Service/InternalException.phpNew service-layer exception type for internal failures.
lib/Service/BadRequestException.phpNew service-layer exception type for validation/user input issues.
lib/Service/ChatService.phpNew service encapsulating chat session/message logic and task scheduling.
lib/Service/AssignmentsService.phpImplements assignment creation and due-run scheduling (including chat session linkage).
lib/ResponseDefinitions.phpAdds Psalm type AssistantAssignment used for response typing/OpenAPI extraction.
lib/Migration/Version030500Date20260430083738.phpCreates assistant_assignments table and adds assignment_id column/index to chat sessions.
lib/Listener/ChattyLLMTaskListener.phpUses new Message::ROLE_ASSISTANT constant instead of raw string.
lib/Db/ChattyLLM/SessionMapper.phpAdds getUserSessionForAssignment() lookup by assignment_id.
lib/Db/ChattyLLM/Session.phpAdds assignmentId field and serializes assignment_id.
lib/Db/ChattyLLM/MessageMapper.phpUses Message::ROLE_HUMAN constant; updates return typing docblock.
lib/Db/ChattyLLM/Message.phpIntroduces ROLE_HUMAN / ROLE_ASSISTANT constants.
lib/Db/AssignmentMapper.phpNew mapper to load assignments and enumerate due assignments.
lib/Db/Assignment.phpNew Assignment entity with RRULE validation and “due to run” logic.
lib/Controller/ChattyLLMController.phpRefactors controller to delegate to ChatService and map service exceptions to HTTP responses.
lib/Controller/AssignmentsApiController.phpNew OCS controller implementing assignment endpoints.
lib/BackgroundJob/RunAssignmentsJob.phpNew timed background job to run due assignments for a user.
composer.lockLocks new dependencies pulled in by RRULE library.
composer.jsonAdds simshaun/recurr dependency.
appinfo/info.xmlBumps app version to 3.5.0-dev.1.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadlib/Controller/AssignmentsApiController.php Outdated
Comment threadlib/Controller/AssignmentsApiController.php
Comment threadlib/Controller/AssignmentsApiController.php Outdated
Comment threadlib/Service/AssignmentsService.php Outdated
Comment threadlib/Service/AssignmentsService.php
Comment threadlib/Controller/ChattyLLMController.php Outdated
Comment threadlib/ResponseDefinitions.php Outdated
Comment threadopenapi.json
Comment threadopenapi.json Outdated
Comment threadlib/Db/ChattyLLM/Session.php

@julien-ncjulien-nc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🐘

Comment threadlib/Migration/Version030500Date20260430083738.php Outdated
Comment threadlib/Migration/Version030500Date20260430083738.php
Comment threadlib/Service/ChatService.php Outdated
Comment threadlib/Service/ChatService.php Outdated
marcelklehrand others added 2 commits May 7, 2026 07:37
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 24 changed files in this pull request and generated 23 comments.

Comment threadlib/Controller/AssignmentsApiController.php
Comment threadlib/Controller/AssignmentsApiController.php
Comment threadlib/Controller/AssignmentsApiController.php Outdated
Comment threadlib/Controller/AssignmentsApiController.php
Comment threadlib/Controller/AssignmentsApiController.php
Comment threadlib/Service/ChatService.php Outdated
Comment threadlib/Service/ChatService.php Outdated
Comment threadopenapi.json
Comment threadopenapi.json
Comment threadtests/psalm-baseline.xml
marcelklehrand others added 4 commits May 7, 2026 08:36
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 24 changed files in this pull request and generated 8 comments.

Comment threadlib/Controller/AssignmentsApiController.php Outdated
Comment threadlib/Controller/AssignmentsApiController.php Outdated
Comment threadlib/Service/AssignmentsService.php
Comment threadlib/Service/AssignmentsService.php
Comment threadlib/Db/Assignment.php
Comment threadlib/Db/Assignment.php
Comment threadlib/Service/ChatService.php
Comment threadlib/Service/ChatService.php Outdated
Signed-off-by: Marcel Klehr <mklehr@gmx.net>

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 24 changed files in this pull request and generated 11 comments.

Comment threadlib/Controller/AssignmentsApiController.php
Comment threadlib/Controller/AssignmentsApiController.php
Comment threadlib/Controller/AssignmentsApiController.php Outdated
Comment threadlib/Service/AssignmentsService.php
Comment threadlib/Service/AssignmentsService.php
Comment threadlib/Service/ChatService.php
Comment threadlib/Service/ChatService.php Outdated
Comment threadlib/Service/ChatService.php
Comment threadlib/Controller/ChattyLLMController.php Outdated
Comment threadlib/Db/Assignment.php
Signed-off-by: Marcel Klehr <mklehr@gmx.net>

@julien-ncjulien-nc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💥

*/
#[NoAdminRequired]
#[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT, tags: ['assignments'])]
#[Http\Attribute\ApiRoute(verb: 'DELETE', url: '/assignments/{id}')]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not importing Http\Attribute\ApiRoute?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

🤷

@marcelklehr
marcelklehr merged commit 8159324 into mainMay 11, 2026
16 checks passed
@marcelklehr
marcelklehr deleted the feat/assignments branch May 11, 2026 12:35
janepie added a commit that referenced this pull request May 21, 2026
@janepiejanepie mentioned this pull request Aug 4, 2026
Sign up for freeto 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.

3 participants

@marcelklehr@julien-nc