-
Notifications
You must be signed in to change notification settings - Fork 0
Codegen bot/add team roles documentation 1757612602 #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
d3659ae
996cb4e
c1d8314
7c701b7
75c5155
1f89699
0f44339
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3,8 +3,8 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## ⚡ TL;DR - 3 Step Process | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1. **Import the logger**: `from codegen.shared.logging.get_logger import get_logger` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2. **Add `extra={}` to your log calls**: `logger.info("message", extra={"key": "value"})` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3. **Enable telemetry**: `codegen config telemetry enable` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1. **Add `extra={}` to your log calls**: `logger.info("message", extra={"key": "value"})` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1. **Enable telemetry**: `codegen config telemetry enable` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
**That's it!** Your logs automatically go to Grafana Cloud when telemetry is enabled. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -22,11 +22,14 @@ from codegen.shared.logging.get_logger import get_logger | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger = get_logger(__name__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# Find any existing console.print() or error handling and add: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info("Operation completed", extra={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "command_name", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"org_id": org_id, # if available | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"success": True | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"Operation completed", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
extra={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "command_name", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"org_id": org_id, # if available | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"success": True, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
### 2. Test the Integration Right Now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -38,7 +41,7 @@ codegen config telemetry enable | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# 2. Run the demo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
python example_enhanced_agent_command.py | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# 3. Run any CLI command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# 3. Run any CLI command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
codegen agents # or any other command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# 4. Check status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -48,69 +51,56 @@ codegen config telemetry status | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## 📝 Copy-Paste Patterns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
### Pattern 1: Operation Start/End | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
```python | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger = get_logger(__name__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# At start of function | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info("Operation started", extra={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "command.subcommand", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"user_input": relevant_input | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# At end of function | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info("Operation completed", extra={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "command.subcommand", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"success": True | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info("Operation started", extra={"operation": "command.subcommand", "user_input": relevant_input}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# At end of function | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info("Operation completed", extra={"operation": "command.subcommand", "success": True}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
58
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logger calls in this example have been condensed to a single line. For calls with multiple parameters in the
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
### Pattern 2: Error Handling | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
```python | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
try: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# your existing code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pass | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
except SomeSpecificError as e: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.error("Specific error occurred", extra={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "command.subcommand", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"error_type": "specific_error", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"error_details": str(e) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, exc_info=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.error("Specific error occurred", extra={"operation": "command.subcommand", "error_type": "specific_error", "error_details": str(e)}, exc_info=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# your existing error handling | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
### Pattern 3: API Calls | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
```python | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# Before API call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info("Making API request", extra={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "api.request", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"endpoint": "agent/run", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"org_id": org_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info("Making API request", extra={"operation": "api.request", "endpoint": "agent/run", "org_id": org_id}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# After successful API call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info("API request successful", extra={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "api.request", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"endpoint": "agent/run", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"response_id": response.get("id"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"status_code": response.status_code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info("API request successful", extra={"operation": "api.request", "endpoint": "agent/run", "response_id": response.get("id"), "status_code": response.status_code}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. response.get(...) conflicts with response.status_code; use response.json().get("id") to access the JSON id from a requests.Response Prompt for AI agents
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
79
to
84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix incorrect Response usage in example
-logger.info("API request successful", extra={"operation": "api.request", "endpoint": "agent/run", "response_id": response.get("id"), "status_code": response.status_code})
+logger.info(
+ "API request successful",
+ extra={
+ "operation": "api.request",
+ "endpoint": "agent/run",
+ "response_id": response.json().get("id"),
+ "status_code": response.status_code,
+ },
+) Optionally align this with the agent example that assigns 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## 🎯 What to Log (Priority Order) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
### 🔥 High Priority (Add These First) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **Operation start/end**: When commands begin/complete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **API calls**: Requests to your backend | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **Authentication events**: Login/logout/token issues | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **Authentication events**: Login/logout/token issues | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **Errors**: Any exception or failure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **User actions**: Commands run, options selected | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
### ⭐ Medium Priority | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **Performance**: Duration of operations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **State changes**: Status updates, configuration changes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **External tools**: Claude CLI detection, git operations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
### 💡 Low Priority (Nice to Have) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **Debug info**: Internal state, validation steps | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **User behavior**: Which features are used most | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -126,30 +116,30 @@ logger = get_logger(__name__) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
def create(prompt: str, org_id: int | None = None, ...): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"""Create a new agent run with the given prompt.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ADD: Log start | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info("Agent creation started", extra={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "agent.create", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"org_id": org_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"prompt_length": len(prompt) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# Your existing code... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
try: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
response = requests.post(url, headers=headers, json=payload) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
agent_run_data = response.json() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ADD: Log success | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ADD: Log success | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info("Agent created successfully", extra={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "agent.create", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"agent_run_id": agent_run_data.get("id"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"status": agent_run_data.get("status") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
except requests.RequestException as e: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ADD: Log error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.error("Agent creation failed", extra={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "agent.create", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "agent.create", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"error_type": "api_error", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"error": str(e) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -163,52 +153,49 @@ def create(prompt: str, org_id: int | None = None, ...): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger = get_logger(__name__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
def _run_claude_interactive(resolved_org_id: int, no_mcp: bool | None) -> None: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
session_id = generate_session_id() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ADD: Log session start | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info("Claude session started", extra={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "claude.session_start", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"session_id": session_id[:8], # Short version for privacy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"org_id": resolved_org_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"Claude session started", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
extra={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "claude.session_start", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"session_id": session_id[:8], # Short version for privacy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"org_id": resolved_org_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# Your existing code... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
try: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
process = subprocess.Popen([claude_path, "--session-id", session_id]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
returncode = process.wait() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ADD: Log session end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info("Claude session completed", extra={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "claude.session_complete", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"session_id": session_id[:8], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"exit_code": returncode, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"status": "COMPLETE" if returncode == 0 else "ERROR" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"Claude session completed", extra={"operation": "claude.session_complete", "session_id": session_id[:8], "exit_code": returncode, "status": "COMPLETE" if returncode == 0 else "ERROR"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
except Exception as e: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ADD: Log session error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.error("Claude session failed", extra={ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"operation": "claude.session_error", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"session_id": session_id[:8], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"error": str(e) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.error("Claude session failed", extra={"operation": "claude.session_error", "session_id": session_id[:8], "error": str(e)}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## 🧪 Verification | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
After making changes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1. **Run the command**: Execute your enhanced CLI command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2. **Check telemetry status**: `codegen config telemetry status` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3. **Look for logs in Grafana Cloud**: Search for your operation names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4. **Test with telemetry disabled**: `codegen config telemetry disable` - should still work normally | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1. **Check telemetry status**: `codegen config telemetry status` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1. **Look for logs in Grafana Cloud**: Search for your operation names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1. **Test with telemetry disabled**: `codegen config telemetry disable` - should still work normally | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
190
to
+193
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The numbered list under the "Verification" section is incorrect. All items are numbered as
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## 🚀 Progressive Enhancement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
**Week 1**: Add basic operation logging to 2-3 commands | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
**Week 2**: Add error logging to all commands | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
**Week 2**: Add error logging to all commands | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
**Week 3**: Add performance metrics and detailed context | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
**Week 4**: Create Grafana dashboards using the collected data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
--- | ||
title: "Team Member Roles" | ||
sidebarTitle: "Team Roles" | ||
icon: "users" | ||
--- | ||
|
||
Team member roles control what actions users can perform within your Codegen organization. The role system uses a hierarchical permission model to ensure proper access control while allowing teams to delegate responsibilities appropriately. | ||
|
||
## Role Hierarchy | ||
|
||
There are **three roles** in the system with a hierarchical structure where higher roles inherit all permissions from lower roles: | ||
|
||
`MEMBER` < `MANAGER` < `ADMIN` | ||
|
||
## Role Definitions | ||
|
||
### 🔴 **ADMIN** (Highest Level) | ||
|
||
Admins have **full administrative access** to the organization and can perform all actions: | ||
|
||
- **Manage billing** and subscription settings | ||
- **Delete repositories** (only admins can do this) | ||
- **Change user roles** (promote/demote team members) | ||
- **Manage integrations** (GitHub, Linear, Slack, etc.) | ||
- **Access organization settings** | ||
- **View cost breakdowns and analytics** | ||
- **Invite users to the organization** | ||
|
||
### 🟡 **MANAGER** (Middle Level) | ||
|
||
Managers have operational permissions but lack administrative controls: | ||
|
||
- **Manage integrations** (GitHub, Linear, Slack, etc.) | ||
- **View and manage organization integrations** | ||
Comment on lines
+33
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicate Integration Management Permission
Tell me moreWhat is the issue?Redundant permission listed for Manager role. 'Manage integrations' and 'View and manage organization integrations' describe the same functionality. Why this mattersListing the same permission twice in different words can cause confusion about whether these are distinct capabilities, potentially leading to misunderstandings about the role's actual permissions. Suggested change ∙ Feature PreviewRemove one of the redundant entries. Keep only: - **Manage integrations** (GitHub, Linear, Slack, etc.) Provide feedback to improve future suggestions💬 Looking for more details? Reply to this comment to chat with Korbit. |
||
- **Cannot** access billing information | ||
- **Cannot** manage user roles | ||
- **Cannot** delete repositories | ||
|
||
### 🟢 **MEMBER** (Basic Level) | ||
|
||
Members have basic permissions for day-to-day work: | ||
|
||
- **View agent traces and runs** | ||
- **Use main application features** (creating agents, viewing repos, etc.) | ||
- **View their own profile and settings** | ||
- **Cannot** manage integrations | ||
- **Cannot** access billing information | ||
- **Cannot** manage other users | ||
- **Cannot** delete repositories | ||
|
||
## Permission Matrix | ||
|
||
| Feature | Member | Manager | Admin | | ||
|---------|--------|---------|-------| | ||
| View repositories | ✅ | ✅ | ✅ | | ||
| Create and run agents | ✅ | ✅ | ✅ | | ||
| View agent traces | ✅ | ✅ | ✅ | | ||
| Manage integrations | ❌ | ✅ | ✅ | | ||
| Delete repositories | ❌ | ❌ | ✅ | | ||
| Access billing | ❌ | ❌ | ✅ | | ||
| Change user roles | ❌ | ❌ | ✅ | | ||
| Organization settings | Limited | Limited | Full | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ambiguous Organization Settings Access
Tell me moreWhat is the issue?The permission matrix shows 'Limited' access for both Member and Manager roles without specifying what 'Limited' means. Why this mattersWithout clear definition of 'Limited' access, users won't understand what organization settings they can actually access, potentially leading to confusion or access-related issues. Suggested change ∙ Feature PreviewEither define what 'Limited' means or be specific about the exact permissions in the matrix: | Organization settings | View Only | View & Edit Basic | Full | Provide feedback to improve future suggestions💬 Looking for more details? Reply to this comment to chat with Korbit. |
||
| Invite users | ❌ | ❌ | ✅ | | ||
|
||
## Managing Team Roles | ||
|
||
### Default Role Assignment | ||
|
||
- New team members are assigned the **MEMBER** role by default | ||
- This ensures new users have basic access without administrative privileges | ||
|
||
### Changing Roles | ||
|
||
Only **ADMIN** users can promote or demote other team members: | ||
|
||
1. Navigate to your organization's team management page | ||
2. Find the user whose role you want to change | ||
3. Select the new role from the dropdown | ||
4. Confirm the change | ||
|
||
### Role Restrictions | ||
|
||
- You cannot assign a role higher than your own | ||
- The system prevents privilege escalation attacks | ||
- At least one ADMIN must remain in each organization | ||
|
||
## Best Practices | ||
|
||
### Security Considerations | ||
|
||
- **Principle of Least Privilege**: Assign the minimum role necessary for each team member's responsibilities | ||
- **Regular Audits**: Periodically review team member roles and adjust as needed | ||
- **Onboarding**: Start new team members as MEMBER and promote as they gain experience | ||
|
||
### Role Assignment Guidelines | ||
|
||
- **MEMBER**: Developers, contractors, or team members who primarily work with code and agents | ||
- **MANAGER**: Team leads, project managers, or senior developers who need to manage integrations | ||
- **ADMIN**: Organization owners, DevOps engineers, or senior leadership who need full control | ||
Comment on lines
+98
to
+99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Vague ADMIN role assignment criteria
Tell me moreWhat is the issue?The Role Assignment Guidelines lack specifics about when to grant ADMIN access, which could lead to overprivileged accounts. Why this mattersOverly broad ADMIN role assignments increase security risks and complicate access management. Suggested change ∙ Feature Preview
Provide feedback to improve future suggestions💬 Looking for more details? Reply to this comment to chat with Korbit. |
||
|
||
### Workflow Integration | ||
|
||
- Consider your team's structure when assigning roles | ||
- Ensure critical functions (billing, user management) are accessible to multiple admins | ||
- Document role assignments and responsibilities for your team | ||
|
||
## Related Documentation | ||
|
||
- [Agent Permissions](/settings/agent-permissions) - Configure what actions agents can perform | ||
- [Organization Rules](/settings/organization-rules) - Set organization-wide rules | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The link to
|
||
- [Repository Rules](/settings/repo-rules) - Configure repository-specific behavior | ||
Comment on lines
+109
to
+111
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainBroken/undeclared link: Organization Rules
Run: 🏁 Script executed: #!/bin/bash
fd -a 'organization-rules.*' docs || true
jq -r '.navigation.tabs[0].groups[]?|select(.group=="Settings")|.pages' docs/docs.json Length of output: 174 Add missing navigation entry: Organization Rules docs/settings/team-roles.mdx (lines 109–111) links to /settings/organization-rules; docs/settings/organization-rules.mdx exists but "settings/organization-rules" is not listed in docs/docs.json (navigation.tabs[0].groups[] where group == "Settings"). Add "settings/organization-rules" to that pages array or update the link to an existing page. 🤖 Prompt for AI Agents
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
"""Claude Code integration commands.""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The numbered list for the "3 Step Process" is incorrect. All items are numbered as
1.
. For a correctly rendered ordered list, they should be numbered sequentially (1.
,2.
,3.
).