这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@balanceiskey
Copy link
Contributor

@balanceiskey balanceiskey commented Mar 26, 2025

Introduces handling to transition to AwaitingHumanApproval and make request to HumanLayer API


Important

Adds transition to AwaitingHumanApproval in TaskRunToolCall with HumanLayer API integration for approval requests.

  • Behavior:
    • Adds AwaitingHumanApproval and ErrorRequestingHumanApproval statuses in taskruntoolcall_types.go.
    • Implements transition to AwaitingHumanApproval in taskruntoolcall_controller.go.
    • Sends approval requests to HumanLayer API using postToHumanLayer().
    • Handles errors in HumanLayer requests, setting status to ErrorRequestingHumanApproval.
  • Controller:
    • Updates TaskRunToolCallReconciler to include HLClient for HumanLayer API interactions.
    • Adds getContactChannel() and getHumanLayerAPIKey() for fetching contact channel and API key.
    • Modifies Reconcile() to handle approval logic and requeue if awaiting approval.
  • Tests:
    • Adds tests in taskruntoolcall_controller_test.go for transitions to AwaitingHumanApproval and ErrorRequestingHumanApproval.
    • Mocks HumanLayer client in mock_hlclient.go for testing API interactions.
  • Misc:
    • Updates CRD in kubechain.humanlayer.dev_taskruntoolcalls.yaml to include new statuses.
    • Adds sample configuration in kubechain_v1alpha_contactchannel_with_approval.yaml.

This description was created by Ellipsis for 9a5a149. It will automatically update as commits are pushed.

@balanceiskey balanceiskey force-pushed the eng-1128-trtc-test-refactor-4 branch from dd213ff to 9a5a149 Compare March 26, 2025 15:18
r.MCPManager = mcpmanager.NewMCPServerManager()
}

if r.HLClient == nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A note, I'm piggybacking here and probably breaking the naming of this function, maybe worth looking at renaming?

@balanceiskey balanceiskey marked this pull request as ready for review March 26, 2025 15:21
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Reviewed everything up to 9a5a149 in 3 minutes and 24 seconds

More details
  • Looked at 1412 lines of code in 9 files
  • Skipped 1 files when reviewing.
  • Skipped posting 11 drafted comments based on config settings.
1. kubechain/internal/mcpmanager/mcpmanager.go:157
  • Draft comment:
    Prefer structured logging over fmt.Printf for error messages.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. kubechain/internal/mcpmanager/mcpmanager.go:326
  • Draft comment:
    Consider validating or normalizing the tool name comparison in FindServerForTool.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. kubechain/internal/mcpmanager/mcpmanager.go:298
  • Draft comment:
    Enhance handling of non-text content in tool call output.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. kubechain/api/v1alpha1/taskruntoolcall_types.go:10
  • Draft comment:
    Nice addition of the new status enum value. Ensure that consumers use these constants instead of hard-coded strings for consistency.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
5. kubechain/config/crd/bases/kubechain.humanlayer.dev_taskruntoolcalls.yaml:140
  • Draft comment:
    Added new enum value for status. Verify that all controllers use the constant and not literal strings.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    The comment is asking the PR author to verify that all controllers use the constant instead of literal strings. This is a request for verification, which is not allowed according to the rules. The comment does not provide a specific suggestion or point out a specific issue in the code.
6. kubechain/internal/controller/taskruntoolcall/taskruntoolcall_controller.go:785
  • Draft comment:
    When updating status to 'AwaitingHumanApproval', use the enum constant instead of the string literal.
  • Reason this comment was not posted:
    Marked as duplicate.
7. kubechain/internal/controller/taskruntoolcall/taskruntoolcall_controller.go:801
  • Draft comment:
    Good nil-check for HLClient; ensure that all injected dependencies are verified before use.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is asking the PR author to ensure that dependencies are verified, which is similar to asking them to double-check or ensure behavior. It doesn't provide a specific suggestion or point out a specific issue.
8. kubechain/internal/humanlayer/hlclient.go:18
  • Draft comment:
    Nice refactoring to use an interface and wrapper. Consider adding documentation for each method to improve clarity for future developers.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 20% <= threshold 50%
    The comment is suggesting adding documentation for methods, which is a general suggestion for improvement. It doesn't point out a specific issue or provide a specific code suggestion. It seems to be more of a general best practice reminder, which doesn't align with the rules provided.
9. kubechain/internal/humanlayer/mock_hlclient.go:80
  • Draft comment:
    The mock implementation correctly stores invocation details for verification in tests.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
10. kubechain/internal/mcpmanager/mcpmanager.go:28
  • Draft comment:
    The new MCPManagerInterface is defined properly; ensure callers use the interface abstraction to facilitate testing.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
    This comment is asking the author to "ensure" something rather than pointing out a specific issue. It's making a suggestion about how callers should use the code, but not identifying any actual problem. The interface addition itself looks good, but telling callers to use it is more of a documentation point than a required code change.
    The interface addition is a good practice for testing, so maybe we should keep the comment to encourage good testing practices? The comment could help future maintainers.
    While testing practices are important, this comment violates our rule about not making comments that just ask authors to "ensure" things. It's not pointing out a specific issue that needs fixing.
    Delete this comment as it's asking the author to "ensure" something rather than identifying a specific issue that needs to be fixed. It's more of a general suggestion than an actionable review comment.
11. kubechain/internal/mcpmanager/mcpmanager.go:369
  • Draft comment:
    Consider using a logger instead of fmt.Printf for logging errors when marshaling input schemas.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_26YxJShrTXuKSuYo


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

"tool_name": trtc.Spec.ToolRef.Name,
"task_run": trtc.Spec.TaskRunRef.Name,
"namespace": trtc.Namespace,
})
Copy link
Contributor

@dexhorthy dexhorthy Mar 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think we want isntead of

approve_tool_call({
  "namespace": "default",
  "task_run": "make-fetch-happen-task-1",
  "tool_name": "make-fetch-happen-server__fetch"
})

we want

fetch__fetch({
url: ...
offset: ...
})

}

// Do not pass GO, do not collect $200, if we've errored
if trtc.Status.Status == kubechainv1alpha1.TaskRunToolCallStatusTypeErrorRequestingHumanApproval {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we're in a terminal state, I've tried to hoist these to the top

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i read it wrong ignore me


if needsApproval {

trtcNamespace := trtc.Namespace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as you're going, this could probably be it's own method eventually

@balanceiskey balanceiskey force-pushed the eng-1128-trtc-test-refactor-4 branch from 42674fe to b4334b6 Compare March 26, 2025 17:45
@balanceiskey balanceiskey merged commit 0799333 into humanlayer:main Mar 31, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants