You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -151,6 +155,9 @@ Each repository contains its own CLAUDE.md with detailed, repository-specific gu
151
155
## Troubleshooting
152
156
153
157
### Common Issues
158
+
-**Virtual Environment Persistence**: The shell environment, including the activated virtual environment, does **not** persist between `run_shell_command` calls. You **MUST** chain environment setup and the command that requires it in a single call.
This file provides critical operational guidance for the Gemini agent working within the SWF testbed ecosystem.
4
+
5
+
## **CRITICAL: Command Execution in the Virtual Environment**
6
+
7
+
**1. Virtual Environment Directory:**
8
+
The virtual environment for this project is named `.venv` (a hidden directory), not `venv`. Always use this correct path.
9
+
10
+
**2. Execution Method:**
11
+
To ensure commands run reliably, you **MUST** use the full, absolute path to the python executable within the `.venv` directory. This is the most robust method and avoids issues with shell environment persistence.
## **CRITICAL: Checklist for Renaming Components**
38
+
39
+
Renaming components has far-reaching side effects. A simple rename requires a systematic, multi-step check to ensure the application remains stable. The following checklist is based on recent failures and must be followed for any renaming task.
40
+
41
+
**Example Scenario:** Renaming a view from `old_name` to `new_name`.
42
+
43
+
1.**Rename the View Function:**
44
+
* In `views.py`, change `def old_name(request):` to `def new_name(request):`.
***Update `path()`:** Change `path('...', old_name, ...)` to `path('...', new_name, ...)`.
49
+
***Update URL Name:** Change `name='old_name'` to `name='new_name'`. This is critical for template tags.
50
+
***Check URL Parameters:** Ensure any captured URL parameters (e.g., `<str:table_name>`) match the arguments in the new view function's signature.
51
+
52
+
3.**Update Templates (`*.html`):**
53
+
***Find and Replace `{% url %}` tags:** Search all templates for `{% url 'monitor_app:old_name' %}` and replace it with `{% url 'monitor_app:new_name' %}`.
54
+
***Rename Template File:** If the view renders a template with a corresponding name (e.g., `old_name.html`), rename the file to `new_name.html`.
55
+
56
+
4.**Global Code Search:**
57
+
* Perform a project-wide search for the string `"old_name"` to find any other references in Python code, JavaScript, or comments.
58
+
59
+
5.**Verification:**
60
+
***Run `manage.py check`:** This is the most important step. It will catch most `ImportError`, `NameError`, and `NoReverseMatch` issues without needing to run the server.
61
+
***Restart and Test:** Only after the check passes, restart the server and manually test the affected pages.
cd ../swf-monitor && git checkout -b infra/baseline-v1
613
613
cd ../swf-common-lib && git checkout -b infra/baseline-v1
614
614
615
+
# CRITICAL: Push branches to origin immediately to make them available remotely
616
+
cd swf-testbed && git push origin infra/baseline-v1
617
+
cd ../swf-monitor && git push origin infra/baseline-v1
618
+
cd ../swf-common-lib && git push origin infra/baseline-v1
619
+
615
620
# Work freely across repositories
616
621
# Commit frequently with descriptive messages
617
622
# Let commit messages document the nature and progression of changes
@@ -631,18 +636,22 @@ For features that primarily affect a single repository:
631
636
# Create feature branch in the primary repository
632
637
git checkout -b feature/your-feature-name
633
638
639
+
# CRITICAL: Push branch to origin immediately to make it available remotely
640
+
git push origin feature/your-feature-name
641
+
634
642
# Work, commit, and create pull request as normal
635
643
# If cross-repo changes are needed, coordinate with infrastructure approach
636
644
```
637
645
638
646
#### Development Guidelines
639
647
640
648
1. **Never push directly to main** - Always use branches and pull requests
641
-
2. **Coordinate cross-repo changes** - Use matching branch names for related work
642
-
3. **Test system integration** - Run `./run_all_tests.sh` before merging infrastructure changes
643
-
4. **Maintain test coverage** - As you add functionality, extend the tests to ensure `./run_all_tests.sh` reliably evaluates system integrity
644
-
5. **Document through commits** - Use descriptive commit messages to explain the progression of work
645
-
6. **Maintain sibling structure** - Keep all `swf-*` repositories as siblings in the same parent directory
649
+
2. **Push branches to origin immediately** - Always run `git push origin branch-name` right after creating a branch to make it available across all development machines
650
+
3. **Coordinate cross-repo changes** - Use matching branch names for related work
651
+
4. **Test system integration** - Run `./run_all_tests.sh` before merging infrastructure changes
652
+
5. **Maintain test coverage** - As you add functionality, extend the tests to ensure `./run_all_tests.sh` reliably evaluates system integrity
653
+
6. **Document through commits** - Use descriptive commit messages to explain the progression of work
654
+
7. **Maintain sibling structure** - Keep all `swf-*` repositories as siblings in the same parent directory
# Summary of Current Issue: `example_daqsim_agent.py` Hangs on Connection
2
+
3
+
## 1. High-Level Goal
4
+
5
+
The objective is to create a set of standalone, example agents in the `swf-testbed/example_agents/` directory. These agents should serve as a blueprint for real agents, communicating with the `swf-monitor` application via its REST API for logging/heartbeats and with ActiveMQ for messaging.
6
+
7
+
We began by implementing the `example_daqsim_agent.py` as the first example.
8
+
9
+
## 2. The Problem
10
+
11
+
The `example_daqsim_agent.py` script hangs indefinitely when executed. The script successfully starts, but it never proceeds past the ActiveMQ connection logic, and no errors are printed to the console.
- A new directory `example_agents/` has been created.
24
+
-`base_agent.py`: Contains a reusable `ExampleAgent` class to handle common logic.
25
+
-`example_daqsim_agent.py`: A simple agent that inherits from `ExampleAgent`. Its purpose is to connect to ActiveMQ and (eventually) produce messages.
26
+
-`requirements.txt`: Contains `requests` and `stomp.py`.
27
+
28
+
## 4. Debugging Steps Taken & Results
29
+
30
+
The following steps were taken to diagnose the hanging issue:
31
+
32
+
1.**Initial Run (Background):** The script was run in the background. **Result:** The agent never appeared in the API's list of system agents. No logs were visible.
33
+
2.**Foreground Run:** The script was run in the foreground to observe errors. **Result:** The script hangs silently with no output and must be manually interrupted.
34
+
3.**Verify ActiveMQ Service:** Checked if the ActiveMQ Docker container was running using `docker ps`. **Result:** The container is running correctly.
35
+
4.**Verify Port Accessibility:** Used `nc -zv localhost 61616` to check if the STOMP port was open. **Result:** The port is open and the connection succeeds, ruling out firewall or port mapping issues.
36
+
5.**Add STOMP Heartbeats:** Modified `base_agent.py` to include `heartbeats=(10000, 10000)` in the `stomp.Connection` constructor, as a lack of heartbeating is a common cause of hangs. **Result:** The script still hangs.
37
+
38
+
## 5. Current Hypothesis
39
+
40
+
- The issue is not with the `swf-monitor` API or basic network connectivity.
41
+
- The problem lies specifically within the `stomp.py` connection logic in `base_agent.py`.
42
+
- The hang occurs at the `self.conn.connect(self.mq_user, self.mq_password, wait=True)` line.
43
+
- Since heartbeats did not solve it, the issue is likely a more subtle STOMP protocol-level problem (e.g., a version mismatch, an issue with vhost, or another parameter disagreement between the client and the Artemis broker) that is causing the handshake to never complete.
44
+
45
+
## 6. Last Proposed Action
46
+
47
+
My last action before being stopped was to propose enabling the `stomp.py` library's internal debug logging to print the raw STOMP frames being sent and received. This would provide a low-level view of the handshake and reveal exactly where it is failing.
0 commit comments