Skip to content

Conversation

@skull8888888
Copy link
Member

@skull8888888 skull8888888 commented Mar 25, 2025

Important

Add cookie handling to gRPC requests and responses, update agent manager and database logic to support cookies and control flow.

  • gRPC Protocol:
    • Add Cookie message to agent_manager_grpc.proto.
    • Add cookies field to RunAgentRequest and AgentOutput.
    • Add give_control field to ActionResult.
  • Agent Manager Implementation:
    • Update run_agent and run_agent_stream in agent_manager_impl.rs to handle cookies.
    • Modify MockAgentManager in mock.rs to accept cookies.
  • Database:
    • Update insert_agent_message in agent_manager.rs to include created_at.
    • Handle cookies in worker.rs by retrieving and storing them in the database.
  • API and Routes:
    • Update run_agent_manager in agent.rs to pass cookies.
    • Modify run_agent_worker in worker.rs to handle cookies and update agent state.

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

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 dadb20a in 1 minute and 38 seconds

More details
  • Looked at 93 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 9 drafted comments based on config settings.
1. app-server/proto/agent_manager_grpc.proto:25
  • Draft comment:
    Ensure that adding the new optional field 'give_control' (tag 4) is wire-compatible and that existing clients handle the default value correctly.
  • 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 ensure compatibility and correct handling of a new field, which falls under the rule of not asking the author to ensure behavior is intended or tested. This is not a specific code suggestion or a request for a test to be written.
2. app-server/src/agent_manager/types.rs:37
  • Draft comment:
    Adding 'give_control' with serde default is fine, but verify that the default value in Rust matches the intended behavior for backward compatibility.
  • 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 the default value for backward compatibility, which is against the rules. It doesn't provide a specific suggestion or point out a clear issue.
3. app-server/src/agent_manager/types.rs:107
  • Draft comment:
    Timestamp assignment using 'chrono::Utc::now()' in conversions may lead to slight inconsistencies if messages are processed together. Confirm that using Utc::now() here is the intended behavior.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 30% <= threshold 50%
    The comment is pointing out a potential issue with using chrono::Utc::now() for timestamp assignment, which could lead to inconsistencies. However, it asks the author to confirm if this is the intended behavior, which violates the rule against asking for confirmation of intention. The comment could be improved by suggesting an alternative or asking for a test to cover this case.
4. app-server/src/agent_manager/types.rs:178
  • Draft comment:
    Conversion for StepChunkContent assigns both message_id and created_at new values. Verify whether these should be generated here or propagated from upstream if available.
  • 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%
    The comment asks to "verify" something, which violates our rules. It's speculative - we don't know if these fields exist in StepChunkContentGrpc. Looking at the pattern in the file, it seems intentional that new IDs and timestamps are generated during these conversions. The comment isn't pointing out a clear issue, just asking for verification.
    Maybe there's a real architectural concern here about message tracing or timestamp consistency that I'm missing? The repeated pattern of generating new IDs could be masking a design issue.
    While that's possible, we don't have enough context to make that determination. The consistent pattern across the codebase suggests this is intentional behavior. Without clear evidence of a problem, we shouldn't keep speculative comments.
    Delete the comment. It's asking for verification rather than pointing out a clear issue, and the consistent pattern across conversions suggests the current behavior is intentional.
5. app-server/proto/agent_manager_grpc.proto:25
  • Draft comment:
    Consider adding a doc comment for the new 'give_control' field to clarify its purpose.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
6. app-server/src/agent_manager/agent_manager_grpc.rs:29
  • Draft comment:
    Ensure the added 'give_control' field is well-documented and its default behavior is clear.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
7. app-server/src/agent_manager/types.rs:37
  • Draft comment:
    Confirm that defaulting 'give_control' to false via unwrap_or_default() is the intended behavior.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
8. app-server/src/agent_manager/types.rs:109
  • Draft comment:
    Setting 'created_at' to chrono::Utc::now() at conversion time may not reflect the actual message creation time. Verify if this behavior is desired.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 30% <= threshold 50%
    The comment is pointing out a potential issue with setting a timestamp at conversion time rather than at the actual creation time. This could lead to inaccuracies in the data. However, the comment asks the author to verify if this behavior is desired, which is against the rules. Instead, it could suggest a more appropriate approach or ask for confirmation of the intention in a more specific way.
9. app-server/src/agent_manager/types.rs:160
  • Draft comment:
    The FinalOutput conversion generates a new message_id and timestamp using Uuid::new_v4() and chrono::Utc::now(). Confirm if this aligns with the expected message tracking semantics.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None

Workflow ID: wflow_wngd5bOSzpNcbPAW


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.

impl Into<StepChunkContent> for StepChunkContentGrpc {
fn into(self) -> StepChunkContent {
StepChunkContent {
created_at: chrono::Utc::now(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Using chrono::Utc::now() during conversion of StepChunkContent may lead to inconsistent timestamps. Consider if the timestamp should come from the source or be generated uniformly.

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. Incremental review on 5655796 in 2 minutes and 55 seconds

More details
  • Looked at 416 lines of code in 10 files
  • Skipped 0 files when reviewing.
  • Skipped posting 16 drafted comments based on config settings.
1. app-server/proto/agent_manager_grpc.proto:9
  • Draft comment:
    Ensure the use of the name 'Cookie' isn't too generic and conflicts are avoided. Also, consider adding comments for the new cookies field for clarity.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50%
    None
2. app-server/src/agent_manager/agent_manager_grpc.rs:3
  • Draft comment:
    The Cookie struct and conversion using maps is correctly generated. Verify that the conversion from HashMap to Cookie (via Into) is consistently used throughout.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
3. app-server/src/agent_manager/agent_manager_impl.rs:45
  • Draft comment:
    Ensure that converting cookies (via map(|c| c.into())) handles all edge cases. The integration appears correct assuming HashMap→Cookie impl is robust.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
4. app-server/src/agent_manager/mock.rs:32
  • Draft comment:
    Mock implementation ignores cookies which is acceptable for a mock. Confirm that tests do not rely on cookie-related behavior.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
5. app-server/src/agent_manager/mod.rs:26
  • Draft comment:
    Ensure that the trait AgentManagerTrait now correctly includes the cookies parameter in both run_agent and run_agent_stream methods. This looks consistent.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
6. app-server/src/agent_manager/types.rs:64
  • Draft comment:
    Ensure the 'impl Into for HashMap' conversion covers all key cases. The conversion in AgentOutput (extracting cookie_data) is concise.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
7. app-server/src/agent_manager/worker.rs:42
  • Draft comment:
    The retrieval and insertion of cookies within run_agent_worker is handled with proper error logging. Verify if additional error propagation is needed.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
8. app-server/src/api/v1/agent.rs:75
  • Draft comment:
    Passing an empty Vec for cookies in API endpoints is acceptable if cookies aren't provided. Confirm if eventual API changes may need to include cookies from client requests.
  • Reason this comment was not posted:
    Confidence changes required: 30% <= threshold 50%
    None
9. app-server/src/db/agent_manager.rs:22
  • Draft comment:
    Database insert now includes created_at field. Ensure that time zones and consistency in date formats are maintained.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
10. app-server/proto/agent_manager_grpc.proto:9
  • Draft comment:
    New 'Cookie' message and repeated cookie fields added. Ensure version compatibility with existing clients and review any privacy implications.
  • 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 ensure version compatibility and review privacy implications, which falls under the rule of not asking the author to double-check things or ensure behavior. It doesn't provide a specific code suggestion or ask for a specific test to be written.
11. app-server/src/agent_manager/agent_manager_impl.rs:58
  • Draft comment:
    Conversion of cookies using 'into_iter().map(|c| c.into()).collect()' works but consider implementing From<HashMap<_, _>> for Cookie for more idiomatic clarity.
  • 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%
    Without seeing the Cookie type definition or understanding where .into() is converting to, we can't be certain if implementing From would be better. The current code might already be using a standard conversion. The suggestion seems speculative without full context. We don't know if Cookie is even a type we can modify.
    We don't have visibility into the target type of the conversion or whether we have the ability to implement From for it. The current code might already be using an idiomatic approach.
    Given the lack of context about the target type and our inability to verify if implementing From would be possible or better, this comment is too speculative.
    Delete this comment as it makes assumptions about code we can't see and suggests a change without enough context to be confident it would be an improvement.
12. app-server/src/agent_manager/mock.rs:32
  • Draft comment:
    The mock functions now include a '_cookies' parameter that isn’t used. Consider adding a comment to document that cookies are intentionally ignored in the mock implementation.
  • 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%
    In Rust, prefixing parameters with underscore is the standard way to indicate intentionally unused parameters. This is common knowledge for Rust developers. The mock implementation clearly returns default/mock values regardless of inputs. Adding documentation about one specific ignored parameter doesn't add value since all parameters are ignored.
    Perhaps documentation could help newcomers to Rust understand why parameters are prefixed with underscores. Maybe the mock's behavior should be more explicitly documented.
    The underscore prefix is standard Rust convention that developers should know. Documenting one ignored parameter but not others would be inconsistent and unnecessary.
    Delete the comment as it suggests purely informative documentation that doesn't improve code quality or fix issues. The code follows standard Rust conventions.
13. app-server/src/agent_manager/types.rs:77
  • Draft comment:
    When converting AgentOutput, cookies are set to None if empty using 'then_some'. Consider returning an empty vector instead to make downstream handling more explicit.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50%
    The choice between None and Some(empty_vec) is a design decision that depends on how the code is used. Since the field is marked skip_serializing, it's only used internally. Without seeing how this field is used by consumers, we can't be certain which approach is better. The current approach of using None for empty vectors is a common Rust idiom and there's no clear evidence it's causing problems.
    I don't have visibility into how this field is used by consumers, so I can't be certain which approach would be better. The current approach might actually be preferable in some scenarios.
    While the suggestion isn't necessarily wrong, there isn't strong evidence that it would be an improvement over the current implementation.
    Without clear evidence that the current approach is causing issues, and given that it follows common Rust patterns, we should not force this change.
14. app-server/src/api/v1/agent.rs:76
  • Draft comment:
    API endpoints pass an empty cookie vector (Vec::new()). If client-supplied cookie data is anticipated in the future, consider exposing this parameter in the API.
  • 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 appears to be a speculative comment about potential future functionality. It's not pointing out a bug or suggesting a concrete improvement - it's just noting that if cookies are needed in the future, the API would need to be modified. This violates the rule about speculative comments and comments that don't require clear code changes.
    Perhaps this is actually pointing out a design flaw where cookie support should be added now rather than later? Maybe there's existing cookie functionality I'm missing in the broader codebase?
    Without evidence that cookie support is currently needed or planned, this remains a speculative comment. If cookie support becomes necessary, that would be a separate feature addition.
    Delete this comment as it's speculative and doesn't suggest any concrete changes needed now.
15. app-server/src/agent_manager/worker.rs:42
  • Draft comment:
    Error handling for cookie retrieval falls back to an empty vector. Verify that silently using an empty cookie list is acceptable if retrieval fails.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    The comment is asking the author to verify if the behavior of using an empty cookie list is acceptable. This falls under asking the author to confirm their intention, which is against the rules.
16. app-server/src/agent_manager/types.rs:57
  • Draft comment:
    Typographical/grammatical suggestion: The comment "For now, we don't return the state to neither the frontend nor API" can be rephrased for clarity, e.g., "For now, we don't return the state to either the frontend or the API."
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is purely a typographical/grammatical suggestion and does not provide any substantial feedback on the code itself. It doesn't suggest any code changes or improvements, nor does it address any potential issues with the code. Therefore, it violates the rule against making purely informative comments.

Workflow ID: wflow_UQml1OPbOAGioYKM


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.

pub cookies: Option<Vec<HashMap<String, String>>>,
}

impl Into<Cookie> for HashMap<String, String> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Implementing the conversion with Into works but using From<HashMap<_, _>> is more idiomatic in Rust.

Suggested change
impl Into<Cookie> for HashMap<String, String> {
impl From<HashMap<String, String>> for Cookie {

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.

👍 Looks good to me! Incremental review on ad8c4b3 in 1 minute and 31 seconds

More details
  • Looked at 12 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. app-server/src/agent_manager/types.rs:142
  • Draft comment:
    Ensure full serialization of action_result is intended. Embedding the entire result alongside its derived text may expose redundant or sensitive data.
  • 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%
    The comment suggests there might be sensitive data exposure, but looking at the ActionResult struct, there's no evidence of sensitive fields. All fields appear to be intentionally serializable. The duplication of content in both text and action_result seems intentional for API compatibility. This feels like speculation without concrete evidence of an issue.
    I might be missing security implications that aren't obvious from the code. There could be sensitive data passed through these fields that isn't apparent from the type definitions.
    While security concerns are important, we should trust that the type definitions accurately reflect the intended data exposure. The fields are explicitly marked for serialization with no protective attributes.
    The comment should be deleted as it's speculative and asks for verification without concrete evidence of a problem. The serialization appears intentional based on the type definitions.
2. app-server/src/agent_manager/types.rs:142
  • Draft comment:
    Verify that including the entire 'action_result' alongside its 'content' (extracted as "text") is intentional, since it duplicates information.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 40% <= threshold 50%
    The comment is asking the PR author to confirm their intention, which violates the rules. However, it points out a potential issue with duplicating information, which could be useful. The comment could be rephrased to suggest a change or ask for clarification without asking for confirmation.
3. app-server/src/agent_manager/types.rs:141
  • Draft comment:
    Consider aligning field names: 'summary' is used in StepChunk while 'text' is used in FinalOutput. Ensure this distinction is deliberate.
  • 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_DaAbug5fTnkMFQbH


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

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.

👍 Looks good to me! Incremental review on 75ad0f9 in 1 minute and 6 seconds

More details
  • Looked at 18 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. app-server/src/agent_manager/types.rs:138
  • Draft comment:
    Changed JSON key to camelCase. Ensure consistency with frontend naming.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
2. app-server/src/agent_manager/types.rs:142
  • Draft comment:
    Changed JSON key to camelCase. Confirm this change matches API specs.
  • 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 confirm that the change matches API specs, which is against the rules. It does not provide a specific suggestion or point out a potential issue with the code itself. Therefore, it should be removed.
3. app-server/src/agent_manager/types.rs:138
  • Draft comment:
    Change JSON key from 'action_result' to 'actionResult' for consistency. Verify client code uses camelCase.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 50% <= threshold 50%
    The comment suggests a specific change to improve consistency in JSON key naming, which is a valid code suggestion. However, it also asks to verify client code, which is not allowed. The first part of the comment is useful, but the second part violates the rules.
4. app-server/src/agent_manager/types.rs:142
  • Draft comment:
    Renamed key to 'actionResult' in FinalOutput branch; ensure API consumers are updated accordingly.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 40% <= threshold 50%
    The comment is asking the PR author to ensure that API consumers are updated, which is similar to asking them to double-check or verify something. This violates the rule against asking the author to ensure something is done. However, the comment does provide specific information about a change that might affect API consumers, which could be useful for the author to consider. The comment could be rephrased to suggest checking API consumers without directly asking the author to ensure something.
5. app-server/src/agent_manager/types.rs:57
  • Draft comment:
    Minor grammatical issue: the comment on line 57 uses a confusing double negative ('to neither the frontend nor API'). Consider rephrasing it to something like 'For now, we do not return the state to either the frontend or the API' for clarity.
  • 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_kVtRcmQYlG4COHyY


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@dinmukhamedm dinmukhamedm deleted the control branch April 2, 2025 13:06
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.

3 participants