The Big One #43

Merged
k.marinus merged 93 commits from feat/reset-experiment-and-phase into dev 2026-01-26 19:20:45 +00:00
k.marinus commented 2026-01-16 14:44:24 +00:00 (Migrated from git.science.uu.nl)

Three big topics in this merge request:

  • AgentSpeak generation
    • Refactored program definition
    • Parse program into intermediate representation (AST)
    • Convert AST to AgentSpeak
    • BDI program manager
    • ...
  • Semantic belief detection
    • Detect semantic beliefs from norms and triggers
    • Detect goal completion of goals that can fail, including subgoals
  • User interruptions
    • When program is ran, creates mapping between goals, triggers and conditional norms and their IDs
    • Sends through conditional norm updates via "status" topic to UI
    • Sends trigger start/end, transition phase and goal start updates via "experiment topic to UI
    • Force trigger, (de)activate norm, override goal, pause, skip phase

To verify, perform extensive system testing using the scripts in the knowledge base. For this, use the dev branch in the RI and the feat/monitoringpage in the UI.

Since this is such a large merge request, it doesn't make sense to have individual checkmarks for each bit of functionality, so just start threads on whatever is on your mind.

  • Style checks pass
  • Pipeline (tests) pass
  • Documentation is up to date
  • Tests are up to date (new code is covered)
  • Code makes sense
Three big topics in this merge request: * AgentSpeak generation * Refactored program definition * Parse program into intermediate representation (AST) * Convert AST to AgentSpeak * BDI program manager * ... * Semantic belief detection * Detect semantic beliefs from norms and triggers * Detect goal completion of goals that can fail, including subgoals * User interruptions * When program is ran, creates mapping between goals, triggers and conditional norms and their IDs * Sends through conditional norm updates via "status" topic to UI * Sends trigger start/end, transition phase and goal start updates via "experiment topic to UI * Force trigger, (de)activate norm, override goal, pause, skip phase To verify, perform extensive system testing using the scripts in the knowledge base. For this, use the `dev` branch in the RI and the `feat/monitoringpage` in the UI. Since this is such a large merge request, it doesn't make sense to have individual checkmarks for each bit of functionality, so just start threads on whatever is on your mind. - [x] Style checks pass - [x] Pipeline (tests) pass - [x] Documentation is up to date - [x] Tests are up to date (new code is covered) - [x] Code makes sense
k.marinus commented 2026-01-16 14:46:43 +00:00 (Migrated from git.science.uu.nl)

requested review from @9828273

requested review from @9828273
k.marinus commented 2026-01-16 14:48:34 +00:00 (Migrated from git.science.uu.nl)

changed the description

changed the description
0950726 commented 2026-01-16 14:50:50 +00:00 (Migrated from git.science.uu.nl)

changed the description

changed the description
k.marinus commented 2026-01-16 15:18:03 +00:00 (Migrated from git.science.uu.nl)

added 1 commit

  • db64eaeb - fix: failing tests and warnings

Compare with previous version

added 1 commit <ul><li>db64eaeb - fix: failing tests and warnings</li></ul> [Compare with previous version](/ics/sp/2025/n25b/pepperplus-cb/-/merge_requests/43/diffs?diff_id=136903&start_sha=7f7e0c542ee5bb61bbff2ed94662c669ff75e0ce)
k.marinus commented 2026-01-16 15:20:31 +00:00 (Migrated from git.science.uu.nl)

requested review from @s.o.h.luijkx and removed review request for @9828273

requested review from @s.o.h.luijkx and removed review request for @9828273
k.marinus commented 2026-01-16 15:20:41 +00:00 (Migrated from git.science.uu.nl)

requested review from @9828273 and removed review request for @s.o.h.luijkx

requested review from @9828273 and removed review request for @s.o.h.luijkx
8464960 commented 2026-01-16 15:47:30 +00:00 (Migrated from git.science.uu.nl)

changed the description

changed the description
9828273 commented 2026-01-19 14:03:06 +00:00 (Migrated from git.science.uu.nl)

Consider adding relevant information in Docstrings for these functions (not at these lines); some functionality is not completely clear from just the function name (and the scattered AST terms can be hard to read and understand at first glance).

Consider adding relevant information in Docstrings for these functions (not at these lines); some functionality is not completely clear from just the function name (and the scattered AST terms can be hard to read and understand at first glance).
9828273 commented 2026-01-19 14:03:06 +00:00 (Migrated from git.science.uu.nl)

Quick docstring would be nice.

Quick docstring would be nice.
9828273 commented 2026-01-19 14:03:07 +00:00 (Migrated from git.science.uu.nl)

Quick docstring would help:)

Quick docstring would help:)
9828273 commented 2026-01-19 14:03:07 +00:00 (Migrated from git.science.uu.nl)
```suggestion:-10+0 ```
9828273 commented 2026-01-19 14:03:07 +00:00 (Migrated from git.science.uu.nl)

Quick docstring please:)

Quick docstring please:)
9828273 commented 2026-01-19 14:03:07 +00:00 (Migrated from git.science.uu.nl)

Small docstring explaining what a default loop is would help readability

Small docstring explaining what a default loop is would help readability
9828273 commented 2026-01-19 14:03:07 +00:00 (Migrated from git.science.uu.nl)

Tiny docstring could help:)

Tiny docstring could help:)
9828273 commented 2026-01-19 14:03:08 +00:00 (Migrated from git.science.uu.nl)

Compact docstring helps

Compact docstring helps
9828273 commented 2026-01-19 14:03:08 +00:00 (Migrated from git.science.uu.nl)

Magic number (2000), consider adding to the environment variables, or add indications for developers to be able to change and find this more easily.

Magic number (2000), consider adding to the environment variables, or add indications for developers to be able to change and find this more easily.
9828273 commented 2026-01-19 14:03:08 +00:00 (Migrated from git.science.uu.nl)

Maybe include a small comment about how the SpeechAction gets handled as a Goal/Plan in the AgentSpeak file, rather than returning it as a 'DO_ACTION' statement type.

Maybe include a small comment about how the SpeechAction gets handled as a Goal/Plan in the AgentSpeak file, rather than returning it as a 'DO_ACTION' statement type.
9828273 commented 2026-01-19 14:03:08 +00:00 (Migrated from git.science.uu.nl)

left review comments

left review comments
9828273 commented 2026-01-19 14:03:50 +00:00 (Migrated from git.science.uu.nl)

marked the checklist item Pipeline (tests) pass as completed

marked the checklist item **Pipeline \(tests\) pass** as completed
9828273 commented 2026-01-19 14:03:55 +00:00 (Migrated from git.science.uu.nl)

marked the checklist item Style checks pass as completed

marked the checklist item **Style checks pass** as completed
9828273 commented 2026-01-19 14:06:45 +00:00 (Migrated from git.science.uu.nl)

marked the checklist item Tests are up to date (new code is covered) as completed

marked the checklist item **Tests are up to date \(new code is covered\)** as completed
9828273 commented 2026-01-19 14:07:08 +00:00 (Migrated from git.science.uu.nl)

marked the checklist item Code makes sense as completed

marked the checklist item **Code makes sense** as completed
9828273 commented 2026-01-19 14:10:00 +00:00 (Migrated from git.science.uu.nl)

Consider changing this into an environment variable, or having a less hard-coded variant of selecting the correct file.

Consider changing this into an environment variable, or having a less hard-coded variant of selecting the correct file.
9828273 commented 2026-01-19 14:11:21 +00:00 (Migrated from git.science.uu.nl)
    async def _transition_phase(self, old: str, new: str):
        assert self._phase is not None
        if old != str(self._phase.id):
```suggestion:-1+0 async def _transition_phase(self, old: str, new: str): assert self._phase is not None if old != str(self._phase.id): ```
9828273 commented 2026-01-19 14:12:45 +00:00 (Migrated from git.science.uu.nl)
    def _extract_current_beliefs(self) -> list[Belief]:
        beliefs: list[Belief] = []
        assert self._phase is not None

        for norm in self._phase.norms:
            if isinstance(norm, ConditionalNorm):
                beliefs += self._extract_beliefs_from_belief(norm.condition)
        
        for trigger in self._phase.triggers:
            beliefs += self._extract_beliefs_from_belief(trigger.condition)

        return beliefs
```suggestion:-10+0 def _extract_current_beliefs(self) -> list[Belief]: beliefs: list[Belief] = [] assert self._phase is not None for norm in self._phase.norms: if isinstance(norm, ConditionalNorm): beliefs += self._extract_beliefs_from_belief(norm.condition) for trigger in self._phase.triggers: beliefs += self._extract_beliefs_from_belief(trigger.condition) return beliefs ```
9828273 commented 2026-01-19 14:17:50 +00:00 (Migrated from git.science.uu.nl)
    def _extract_current_goals(self) -> list[Goal]:
        """
        Extract all goals from the program, including subgoals.

        :return: A list of Goal objects.
        """
        goals: list[Goal] = []
        assert self._phase is not None

        for goal in self._phase.goals:
            goals.extend(self._extract_goals_from_goal(goal))

        return goals
```suggestion:-11+0 def _extract_current_goals(self) -> list[Goal]: """ Extract all goals from the program, including subgoals. :return: A list of Goal objects. """ goals: list[Goal] = [] assert self._phase is not None for goal in self._phase.goals: goals.extend(self._extract_goals_from_goal(goal)) return goals ```
9828273 commented 2026-01-19 14:19:06 +00:00 (Migrated from git.science.uu.nl)
        while True:
            assert self.sub_socket is not None
            topic, body = await self.sub_socket.recv_multipart()
```suggestion:-1+0 while True: assert self.sub_socket is not None topic, body = await self.sub_socket.recv_multipart() ```
9828273 commented 2026-01-19 14:27:05 +00:00 (Migrated from git.science.uu.nl)

Consider adding docstrings

Consider adding docstrings
9828273 commented 2026-01-19 14:27:18 +00:00 (Migrated from git.science.uu.nl)

Consider a quick docstring

Consider a quick docstring
9828273 commented 2026-01-19 14:27:57 +00:00 (Migrated from git.science.uu.nl)

Small docstring por favor

Small docstring por favor
9828273 commented 2026-01-19 14:28:49 +00:00 (Migrated from git.science.uu.nl)

Small docstring s'il vous plaît

Small docstring s'il vous plaît
9828273 commented 2026-01-19 14:29:44 +00:00 (Migrated from git.science.uu.nl)

Un po' docstring per favore

Un po' docstring per favore
9828273 commented 2026-01-19 14:32:09 +00:00 (Migrated from git.science.uu.nl)

Consider putting two tabs before this patch of prompt. Not sure if this is to make it more readable, however, its technically part of the _infer_beliefs function.

Consider putting two tabs before this patch of prompt. Not sure if this is to make it more readable, however, its technically part of the `_infer_beliefs` function.
9828273 commented 2026-01-19 14:34:04 +00:00 (Migrated from git.science.uu.nl)

Consider putting two tabs before this patch of prompt. Not sure if this is to make it more readable, however, its technically part of the _infer_goal function.

Consider putting two tabs before this patch of prompt. Not sure if this is to make it more readable, however, its technically part of the `_infer_goal` function.
9828273 commented 2026-01-19 14:37:16 +00:00 (Migrated from git.science.uu.nl)

Consider adding a (few) comment(s), and possible changing "retval" to "return_value" or something to make this more easy to read and understand when going over it.

Consider adding a (few) comment(s), and possible changing "retval" to "return_value" or something to make this more easy to read and understand when going over it.
9828273 commented 2026-01-19 14:43:46 +00:00 (Migrated from git.science.uu.nl)

Pylance doesn't like the fact that JSONLike is this broad - resulting in potential type mismatches where it is used...

Consider

  • assertion or type narrowing after the function is called
  • casting to (dict[str, bool | None] | None, result) in case you're confident about the LLM return format (after the function is called)
  • updating the type annotation to be more specific (in case that's possible).

Of course, if this is too much work, or pollutes the code quality, feel free to ignore this comment.

Pylance doesn't like the fact that JSONLike is this broad - resulting in potential type mismatches where it is used... Consider - assertion or type narrowing after the function is called - casting to `(dict[str, bool | None] | None, result)` in case you're confident about the LLM return format (after the function is called) - updating the type annotation to be more specific (in case that's possible). Of course, if this is too much work, or pollutes the code quality, feel free to ignore this comment.
9828273 commented 2026-01-19 14:46:04 +00:00 (Migrated from git.science.uu.nl)

Could be leftover debug- You can delete or modify this (to make it more sophisticated than "handling rn")

Could be leftover debug- You can delete or modify this (to make it more sophisticated than "handling rn")
9828273 commented 2026-01-19 14:56:36 +00:00 (Migrated from git.science.uu.nl)

I've added some comments about asserting phase is not None. In the case of the loops, you can also opt for or [] if you prefer that.

I've added some comments about asserting phase is not None. In the case of the loops, you can also opt for `or []` if you prefer that.
s.o.h.luijkx commented 2026-01-19 14:59:04 +00:00 (Migrated from git.science.uu.nl)

Add docstrings please

Add docstrings please
9828273 commented 2026-01-19 15:03:22 +00:00 (Migrated from git.science.uu.nl)

The user_interupt_agent and folder shouldn't be on the same level as the other folders. It should be in, for example, the communication folder.

The user_interupt_agent and folder shouldn't be on the same level as the other folders. It should be in, for example, the communication folder.
9828273 commented 2026-01-19 15:04:35 +00:00 (Migrated from git.science.uu.nl)
        while True:
            assert self.sub_socket is not None
            topic, body = await self.sub_socket.recv_multipart()
```suggestion:-1+0 while True: assert self.sub_socket is not None topic, body = await self.sub_socket.recv_multipart() ```
9828273 commented 2026-01-19 15:08:15 +00:00 (Migrated from git.science.uu.nl)

You can add an early return or other functionality to account for the unbound belief_name that would otherwise be send to the bdi core.

You can add an early return or other functionality to account for the unbound `belief_name` that would otherwise be send to the bdi core.
s.o.h.luijkx commented 2026-01-19 15:08:56 +00:00 (Migrated from git.science.uu.nl)

Outdated docstring

Outdated docstring
s.o.h.luijkx commented 2026-01-19 15:12:08 +00:00 (Migrated from git.science.uu.nl)

approved this merge request

approved this merge request
8464960 commented 2026-01-19 15:29:37 +00:00 (Migrated from git.science.uu.nl)

mentioned in merge request !45

mentioned in merge request !45
k.marinus commented 2026-01-26 11:23:27 +00:00 (Migrated from git.science.uu.nl)

changed this line in version 3 of the diff

changed this line in [version 3 of the diff](/ics/sp/2025/n25b/pepperplus-cb/-/merge_requests/43/diffs?diff_id=137820&start_sha=db64eaeb0b03e683e23950a13d8b4a271f17136b#5acd08ff0bc3dd407bb2d3cb170a1d8a1f7f5cae_258_365)
k.marinus commented 2026-01-26 11:23:41 +00:00 (Migrated from git.science.uu.nl)

added 1 commit

  • b9df47b7 - docs: add docstrings to AgentSpeak stuff

Compare with previous version

added 1 commit <ul><li>b9df47b7 - docs: add docstrings to AgentSpeak stuff</li></ul> [Compare with previous version](/ics/sp/2025/n25b/pepperplus-cb/-/merge_requests/43/diffs?diff_id=137820&start_sha=db64eaeb0b03e683e23950a13d8b4a271f17136b)
0950726 commented 2026-01-26 12:19:54 +00:00 (Migrated from git.science.uu.nl)

Adding tabs here would send those tabs to the LLM. This is fine.

Adding tabs here would send those tabs to the LLM. This is fine.
0950726 commented 2026-01-26 12:20:23 +00:00 (Migrated from git.science.uu.nl)

Adding tabs here would send those tabs to the LLM. This is fine.

Adding tabs here would send those tabs to the LLM. This is fine.
0950726 commented 2026-01-26 14:52:23 +00:00 (Migrated from git.science.uu.nl)

Depending on the given schema, the output really can be any of those types.

Depending on the given `schema`, the output really can be any of those types.
0950726 commented 2026-01-26 15:13:59 +00:00 (Migrated from git.science.uu.nl)

changed this line in version 4 of the diff

changed this line in [version 4 of the diff](/ics/sp/2025/n25b/pepperplus-cb/-/merge_requests/43/diffs?diff_id=137867&start_sha=b9df47b7d160ba8c54b46a82ce86cf10f429feac#342e3f03170932c4a43fa2ee2227c86507e9dc89_389_418)
0950726 commented 2026-01-26 15:14:09 +00:00 (Migrated from git.science.uu.nl)

changed this line in version 4 of the diff

changed this line in [version 4 of the diff](/ics/sp/2025/n25b/pepperplus-cb/-/merge_requests/43/diffs?diff_id=137867&start_sha=b9df47b7d160ba8c54b46a82ce86cf10f429feac#091256ee799d163c7f176b295ce1c5003a85a072_30_28)
0950726 commented 2026-01-26 15:14:11 +00:00 (Migrated from git.science.uu.nl)

added 1 commit

  • d8dc558d - docs: update existing docstrings and add new docs

Compare with previous version

added 1 commit <ul><li>d8dc558d - docs: update existing docstrings and add new docs</li></ul> [Compare with previous version](/ics/sp/2025/n25b/pepperplus-cb/-/merge_requests/43/diffs?diff_id=137867&start_sha=b9df47b7d160ba8c54b46a82ce86cf10f429feac)
0950726 commented 2026-01-26 15:50:42 +00:00 (Migrated from git.science.uu.nl)

All these not None assertions don't really help the problem. It'll give the same error during runtime, even if the type checker is happy. Alternative is adding early returns if it is None.

All these `not None` assertions don't really help the problem. It'll give the same error during runtime, even if the type checker is happy. Alternative is adding early returns if it is None.
k.marinus commented 2026-01-26 18:28:21 +00:00 (Migrated from git.science.uu.nl)

changed this line in version 5 of the diff

changed this line in [version 5 of the diff](/ics/sp/2025/n25b/pepperplus-cb/-/merge_requests/43/diffs?diff_id=137879&start_sha=d8dc558d3ea76ee253425b1292b0f2fec3593df9#5acd08ff0bc3dd407bb2d3cb170a1d8a1f7f5cae_563_565)
k.marinus commented 2026-01-26 18:28:21 +00:00 (Migrated from git.science.uu.nl)

changed this line in version 5 of the diff

changed this line in [version 5 of the diff](/ics/sp/2025/n25b/pepperplus-cb/-/merge_requests/43/diffs?diff_id=137879&start_sha=d8dc558d3ea76ee253425b1292b0f2fec3593df9#091256ee799d163c7f176b295ce1c5003a85a072_78_78)
k.marinus commented 2026-01-26 18:28:23 +00:00 (Migrated from git.science.uu.nl)

changed this line in version 5 of the diff

changed this line in [version 5 of the diff](/ics/sp/2025/n25b/pepperplus-cb/-/merge_requests/43/diffs?diff_id=137879&start_sha=d8dc558d3ea76ee253425b1292b0f2fec3593df9#cb029a1a5b68aa61cd7e036a31c8c9dd5245e10a_148_148)
k.marinus commented 2026-01-26 18:28:23 +00:00 (Migrated from git.science.uu.nl)

added 1 commit

  • 650050fa - chore: move magic numbers to env and cleanup

Compare with previous version

added 1 commit <ul><li>650050fa - chore: move magic numbers to env and cleanup</li></ul> [Compare with previous version](/ics/sp/2025/n25b/pepperplus-cb/-/merge_requests/43/diffs?diff_id=137879&start_sha=d8dc558d3ea76ee253425b1292b0f2fec3593df9)
k.marinus commented 2026-01-26 18:46:29 +00:00 (Migrated from git.science.uu.nl)

added 9 commits

  • 650050fa...e7e305c4 - 8 commits from branch dev
  • bc1fa2ea - Merge branch 'dev' into feat/reset-experiment-and-phase

Compare with previous version

added 9 commits <ul><li>650050fa...e7e305c4 - 8 commits from branch <code>dev</code></li><li>bc1fa2ea - Merge branch &#39;dev&#39; into feat/reset-experiment-and-phase</li></ul> [Compare with previous version](/ics/sp/2025/n25b/pepperplus-cb/-/merge_requests/43/diffs?diff_id=137880&start_sha=650050fa0fb76e6972bc429d37eb3ba661a3e38d)
0950726 commented 2026-01-26 18:51:57 +00:00 (Migrated from git.science.uu.nl)

marked the checklist item Documentation is up to date as completed

marked the checklist item **Documentation is up to date** as completed
0950726 commented 2026-01-26 18:53:02 +00:00 (Migrated from git.science.uu.nl)

Added early return for _transition_phase, assertions with messages in the two functions that should only get called when self._phase is not None.

Added early return for `_transition_phase`, assertions with messages in the two functions that should only get called when `self._phase` is not None.
k.marinus commented 2026-01-26 18:54:03 +00:00 (Migrated from git.science.uu.nl)

resolved all threads

resolved all threads
0950726 commented 2026-01-26 18:55:30 +00:00 (Migrated from git.science.uu.nl)

added 2 commits

  • 4f927bc0 - fix: make DOS from other agents impossible
  • 7dd47c9d - Merge remote-tracking branch 'origin/feat/reset-experiment-and-phase' into...

Compare with previous version

added 2 commits <ul><li>4f927bc0 - fix: make DOS from other agents impossible</li><li>7dd47c9d - Merge remote-tracking branch &#39;origin/feat/reset-experiment-and-phase&#39; into...</li></ul> [Compare with previous version](/ics/sp/2025/n25b/pepperplus-cb/-/merge_requests/43/diffs?diff_id=137882&start_sha=bc1fa2ea35342da1c03ca6d3607b4dfb1b059785)
9828273 commented 2026-01-26 19:20:12 +00:00 (Migrated from git.science.uu.nl)

resolved all threads

resolved all threads
9828273 commented 2026-01-26 19:20:13 +00:00 (Migrated from git.science.uu.nl)

approved this merge request

approved this merge request
k.marinus (Migrated from git.science.uu.nl) merged commit da0f48e96d into dev 2026-01-26 19:20:46 +00:00
k.marinus commented 2026-01-26 19:20:50 +00:00 (Migrated from git.science.uu.nl)

mentioned in commit da0f48e96d

mentioned in commit da0f48e96d07c1291064c779a48be1741e7ea522
s.o.h.luijkx (Migrated from git.science.uu.nl) approved these changes 2026-02-02 13:29:05 +00:00
9828273 (Migrated from git.science.uu.nl) approved these changes 2026-02-02 13:29:05 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: pepperplus/pepperplus-cb#43