-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: handle milliseconds in ISO 8601 rate limit reset timestamps #1846
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
45456a0
0a1ae80
ca88820
304995d
905d8e2
fedaf42
06f90f1
6a9dc4b
426cde6
d88744c
b718374
9c52252
a86a7e2
1e3e2c3
3276395
4d8cae4
22bc0d5
5513395
83b9929
cd37697
4c20549
2705682
a143f52
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 |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| """ | ||
|
|
||
| import json | ||
| import re | ||
| import shutil | ||
| import subprocess | ||
| from pathlib import Path | ||
|
|
@@ -60,8 +61,19 @@ def handle_batch_create_command(batch_file: str, project_dir: str) -> bool: | |
| for idx, task in enumerate(tasks, 1): | ||
| spec_id = f"{next_id:03d}" | ||
| task_title = task.get("title", f"Task {idx}") | ||
| task_slug = task_title.lower().replace(" ", "-")[:50] | ||
| spec_name = f"{spec_id}-{task_slug}" | ||
|
|
||
| # Extract category tag like [sec-001] from title if present | ||
| tag_match = re.match(r"^\[(\w+-\d+)\]\s*(.*)", task_title) | ||
|
Contributor
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. 🧹 Nitpick | 🔵 Trivial Tag regex only matches a single
🤖 Prompt for AI Agents |
||
| if tag_match: | ||
| tag = tag_match.group(1) # e.g. "sec-001" | ||
| title_rest = tag_match.group(2) # e.g. "Remove hardcoded API key..." | ||
| title_slug = re.sub(r"[^\w\-]", "-", title_rest.lower()) | ||
| title_slug = re.sub(r"-+", "-", title_slug).strip("-")[:50] | ||
| spec_name = f"{spec_id}-[{tag}]-{title_slug}" | ||
|
Comment on lines
66
to
72
Contributor
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. Brackets in directory names can break shell globbing and downstream tooling.
Consider escaping or replacing brackets in the spec name: ♻️ Suggested fix — use parentheses or plain hyphens instead of brackets- spec_name = f"{spec_id}-[{tag}]-{title_slug}"
+ spec_name = f"{spec_id}-{tag}-{title_slug}"This keeps the tag visible in the directory name without introducing glob-sensitive characters. If visual grouping of the tag is desired, parentheses 🤖 Prompt for AI Agents |
||
| else: | ||
| task_slug = re.sub(r"[^\w\-]", "-", task_title.lower()) | ||
| task_slug = re.sub(r"-+", "-", task_slug).strip("-")[:50] | ||
| spec_name = f"{spec_id}-{task_slug}" | ||
| spec_dir = specs_dir / spec_name | ||
| spec_dir.mkdir(exist_ok=True) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -344,7 +344,11 @@ def get_worktree_path(self, spec_name: str) -> Path: | |
|
|
||
| def get_branch_name(self, spec_name: str) -> str: | ||
| """Get the branch name for a spec.""" | ||
| return f"auto-claude/{spec_name}" | ||
| # Sanitize spec_name: remove characters invalid in git branch names | ||
| sanitized = re.sub(r"[\[\]~^:?*\\{}]", "", spec_name) | ||
| # Collapse repeated dashes from removal | ||
| sanitized = re.sub(r"-{2,}", "-", sanitized) | ||
| return f"auto-claude/{sanitized}" | ||
|
Comment on lines
345
to
351
Contributor
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. 🧹 Nitpick | 🔵 Trivial 🧩 Analysis chain🏁 Script executed: # Find all calls to get_branch_name
rg -n 'get_branch_name\(' --type=py -B2 -A2Repository: AndyMik90/Auto-Claude Length of output: 2309 🏁 Script executed: # Check for any validation of spec_name before it reaches this function
rg -n 'spec_name' --type=py -B2 -A2 | head -100Repository: AndyMik90/Auto-Claude Length of output: 6249 🏁 Script executed: # Look for tests of the get_branch_name function
rg -n 'test.*get_branch_name|get_branch_name.*test' --type=py -B1 -A5Repository: AndyMik90/Auto-Claude Length of output: 47 🏁 Script executed: # Examine the worktree.py file around the function
head -360 apps/backend/core/worktree.py | tail -60Repository: AndyMik90/Auto-Claude Length of output: 2603 🏁 Script executed: # Find _generate_spec_name implementation
rg -n '_generate_spec_name' --type=py -A10 | head -60Repository: AndyMik90/Auto-Claude Length of output: 4293 🏁 Script executed: # Check the full test_create_worktree_with_spec_name test
rg -n 'test_create_worktree_with_spec_name' --type=py -A20Repository: AndyMik90/Auto-Claude Length of output: 1429 🏁 Script executed: # Look for any validation of spec_name in the codebase
rg -n 'spec_name.*validate|validate.*spec_name|spec_name.*check' --type=py -B2 -A2Repository: AndyMik90/Auto-Claude Length of output: 47 🏁 Script executed: # Find the actual implementation of _generate_spec_name
rg -n 'def _generate_spec_name' --type=py -A30Repository: AndyMik90/Auto-Claude Length of output: 2753 🏁 Script executed: # Check if spec_name can come from external sources (not just _generate_spec_name)
rg -n 'spec_name\s*=' --type=py | grep -v test | head -30Repository: AndyMik90/Auto-Claude Length of output: 1751 🏁 Script executed: # Find the actual generate_spec_name implementation
rg -n 'def generate_spec_name' --type=py -A20Repository: AndyMik90/Auto-Claude Length of output: 1360 🏁 Script executed: # Check batch_commands.py line 64 to see spec_name construction
sed -n '60,70p' apps/backend/cli/batch_commands.pyRepository: AndyMik90/Auto-Claude Length of output: 511 🏁 Script executed: # Get the complete generate_spec_name function
sed -n '123,180p' apps/backend/spec/pipeline/models.pyRepository: AndyMik90/Auto-Claude Length of output: 1080 🏁 Script executed: # Get more of the generate_spec_name function including the actual sanitization logic
sed -n '123,200p' apps/backend/spec/pipeline/models.pyRepository: AndyMik90/Auto-Claude Length of output: 1552 🏁 Script executed: # Get the complete generate_spec_name function
sed -n '123,210p' apps/backend/spec/pipeline/models.pyRepository: AndyMik90/Auto-Claude Length of output: 1837 Branch name sanitization is technically incomplete but mitigated by upstream validation. Git's branch naming rules forbid spaces, The current implementation is safe and functional, but adding comprehensive git ref validation here would be good defensive practice—for instance, if 🤖 Prompt for AI Agents |
||
|
|
||
| def worktree_exists(self, spec_name: str) -> bool: | ||
| """Check if a worktree exists for a spec.""" | ||
|
|
||
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.