mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-25 14:53:34 +00:00
* Add event-triggered routines and workflow skill templates * Add generic host-verified webhook ingress for tools * Migrate GitHub webhook normalization into github tool * Bump github tool registry version * Stabilize trace E2E test rig and approval behavior * Add reusable gateway workflow harness with mock LLM server (#762) * Add reusable gateway workflow test harness with mock LLM server * Fix clippy issues in workflow harness * Stabilize trace E2E test rig and approval behavior * Address PR review feedback on gateway workflow harness - Extract shared TestChannelHandle into test_channel.rs with name override support, eliminating ~55 lines of duplication between test_rig.rs and gateway_workflow_harness.rs - Remove redundant RoutineEngine creation that was immediately overwritten by Agent::run() - Replace flaky sleep(500ms) with polling loop for routine run count check - Use components.context_manager instead of creating a fresh ContextManager for job tools, ensuring agent and tools share the same instance Co-Authored-By: Claude Opus 4.6 <[email protected]> * Fix import ordering in gateway_workflow_harness Co-Authored-By: Claude Opus 4.6 <[email protected]> --------- Co-authored-by: Claude Opus 4.6 <[email protected]> * Address PR #758 review feedback - Fix header_value to use fully case-insensitive lookup (iterate with to_ascii_lowercase) instead of checking only exact/lower/upper variants - Change comment_id from u32 to u64 to handle GitHub's billion-range IDs - Remove handle_webhook from LLM-facing JSON schema to prevent direct invocation bypassing HMAC verification - Rename enrichment keys from repository/sender to repository_name/ sender_login to preserve original JSON objects in webhook payloads - Remove put_string_normalized helper (no longer needed) - Replace no-op tests (test_validate_event_in_create_pr_review, test_validate_merge_method) with test_header_value_case_insensitive - Add README docs for 6 undocumented actions (list_issue_comments, create_issue_comment, list_pull_request_comments, reply_pull_request_comment, get_pull_request_reviews, get_combined_status) - Add comment explaining max_tool_calls <= 8 bound in e2e test - Fix gateway workflow harness: add webhook_capability with secret auth to MockGithubWebhookTool, matching staging's hardened webhook security - Fix merge artifacts: remove duplicate test function, orphaned code fragment in e2e_routine_heartbeat [skip-regression-check] Co-Authored-By: Claude Opus 4.6 <[email protected]> * Fix formatting in gateway workflow harness Co-Authored-By: Claude Opus 4.6 <[email protected]> * Address Copilot review: filter keys, pr_number fallback, feature gate, version alignment - Update SKILL.md and workflow-routines.md templates to use `repository_name` and `sender_login` (matching enriched payload field names) - Mark webhook HMAC secret as required in SKILL.md prerequisites - Fall back to `/issue/number` for `pr_number` on issue_comment PR webhooks - Gate `gateway_workflow_harness` module behind `#[cfg(feature = "libsql")]` - Align tool version to 0.2.1 in Cargo.toml and capabilities.json Co-Authored-By: Claude Opus 4.6 <[email protected]> --------- Co-authored-by: Claude Opus 4.6 <[email protected]>
GitHub Tool for IronClaw
WASM tool for GitHub integration - manage repos, issues, PRs, and workflows.
Features
- Repository Info - Get repo details, list user repos
- Issues - List/create/get issues, list/add issue comments
- Pull Requests - List/create/get PRs, review files, create reviews, list/reply review comments, merge PRs
- File Content - Read files from repos
- Workflows - Trigger GitHub Actions, check run status
Setup
-
Create a GitHub Personal Access Token at https://github.com/settings/tokens
-
Required scopes:
repo,workflow,read:org -
Store the token:
ironclaw secret set github_token YOUR_TOKEN
Usage Examples
Get Repository Info
{
"action": "get_repo",
"owner": "nearai",
"repo": "ironclaw"
}
List Open Issues
{
"action": "list_issues",
"owner": "nearai",
"repo": "ironclaw",
"state": "open",
"limit": 10
}
Create Issue
{
"action": "create_issue",
"owner": "nearai",
"repo": "ironclaw",
"title": "Bug: Something is broken",
"body": "Detailed description...",
"labels": ["bug", "help wanted"]
}
List Pull Requests
{
"action": "list_pull_requests",
"owner": "nearai",
"repo": "ironclaw",
"state": "open",
"limit": 5
}
Review PR
{
"action": "create_pr_review",
"owner": "nearai",
"repo": "ironclaw",
"pr_number": 42,
"body": "LGTM! Great work.",
"event": "APPROVE"
}
Create Pull Request
{
"action": "create_pull_request",
"owner": "nearai",
"repo": "ironclaw",
"title": "feat: add event-driven routines",
"head": "feat/event-routines",
"base": "main",
"body": "Implements system_event trigger + event_emit tool."
}
Merge Pull Request
{
"action": "merge_pull_request",
"owner": "nearai",
"repo": "ironclaw",
"pr_number": 42,
"merge_method": "squash"
}
List Issue Comments
{
"action": "list_issue_comments",
"owner": "nearai",
"repo": "ironclaw",
"issue_number": 42,
"limit": 10
}
Add Issue Comment
{
"action": "create_issue_comment",
"owner": "nearai",
"repo": "ironclaw",
"issue_number": 42,
"body": "Thanks for reporting this!"
}
List PR Review Comments
{
"action": "list_pull_request_comments",
"owner": "nearai",
"repo": "ironclaw",
"pr_number": 42,
"limit": 30
}
Reply to PR Review Comment
{
"action": "reply_pull_request_comment",
"owner": "nearai",
"repo": "ironclaw",
"comment_id": 123456789,
"body": "Fixed in the latest commit."
}
Get PR Reviews
{
"action": "get_pull_request_reviews",
"owner": "nearai",
"repo": "ironclaw",
"pr_number": 42
}
Get Combined Status
{
"action": "get_combined_status",
"owner": "nearai",
"repo": "ironclaw",
"ref": "main"
}
Get File Content
{
"action": "get_file_content",
"owner": "nearai",
"repo": "ironclaw",
"path": "README.md",
"ref": "main"
}
Trigger Workflow
{
"action": "trigger_workflow",
"owner": "nearai",
"repo": "ironclaw",
"workflow_id": "ci.yml",
"ref": "main",
"inputs": {
"environment": "staging"
}
}
Check Workflow Runs
{
"action": "get_workflow_runs",
"owner": "nearai",
"repo": "ironclaw",
"limit": 5
}
List Workflow Runs (Pagination)
{
"action": "get_workflow_runs",
"owner": "nearai",
"repo": "ironclaw",
"limit": 5,
"page": 2
}
Error Handling
Errors are returned as strings in the error field of the response.
Rate Limit Exceeded
When the GitHub API rate limit is exceeded (and retries fail), you might see:
GitHub API error 429: { "message": "API rate limit exceeded for user ID ...", ... }
The tool automatically logs warnings when the rate limit is low (<10 remaining) and retries on 429/5xx errors.
Invalid Parameters
Invalid event: 'INVALID'. Must be one of: APPROVE, REQUEST_CHANGES, COMMENT
Missing Token
GitHub token not found in secret store. Set it with: ironclaw secret set github_token <token>...
Troubleshooting
"GitHub API error 404: Not Found"
- Check that the
ownerandrepoare correct. - Ensure the
github_tokenhas access to the repository (especially for private repos). - Verify the token scopes include
repoandread:org.
"GitHub API error 401: Bad credentials"
- The token might be invalid or expired.
- Update the token:
ironclaw secret set github_token NEW_TOKEN.
Rate Limiting
- The tool logs a warning when remaining requests drop below 10.
- Check logs for "GitHub API rate limit low".
- If you hit the limit, wait for the reset time (usually 1 hour).
Building
cd tools-src/github
cargo build --target wasm32-wasi --release
License
MIT/Apache-2.0