Skip to content

Conversation

@NicolasBelissent
Copy link
Contributor

@NicolasBelissent NicolasBelissent commented Oct 16, 2025

Summary by cubic

Adds a feedback collection meta tool to capture user feedback by account and tool, and integrates it into the StackOne toolset. Also upgrades validation to Zod v4 and exports the tool for SDK use.

  • New Features

    • Added meta_collect_tool_feedback with validated inputs: feedback, account_id, tool_names (snake_case).
    • Supports dryRun to return the payload without making a network call.
    • Exported createFeedbackTool and included it in StackOneToolSet.
    • Added tests for validation, dryRun behavior, and payload formatting.
  • Dependencies

    • Added Zod ^4.0.0 and declared it as a peer dependency.

NicolasBelissent and others added 10 commits September 29, 2025 10:31
- Export createFeedbackTool from tools/feedback
- Integrate feedbackUrl into StackOneToolSet configuration
- Add feedback collection meta tool to StackOneToolSet tools
- Replace reduce with a for loop for better readability and performance.
- Ensure only valid, trimmed string tool names are included in the submission.
Update feedback tool to send `tool_names` instead of `toolNames` to match
the API endpoint requirements. Also update related tests to reflect the changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Removed langsmith package as it's not being used in the SDK codebase.
LangSmith integration is handled server-side by the feedback API endpoint.

Also updated OpenAPI spec snapshots after dependency changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings October 16, 2025 12:04
@NicolasBelissent NicolasBelissent changed the title Feature/feedback tool feedback consent feat: feedback tool Oct 16, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a feedback collection tool for StackOne that allows users to submit feedback about tool performance. The key changes include:

  • Addition of a new meta_collect_tool_feedback tool that collects user feedback with explicit consent
  • Integration of the feedback tool into the StackOneToolSet
  • Updated API specifications including new employee shift endpoints and additional custom fields support

Reviewed Changes

Copilot reviewed 8 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/tools/feedback.ts Implements the new feedback collection tool with validation and API submission logic
src/tools/tests/feedback.spec.ts Comprehensive test suite for the feedback tool functionality
src/toolsets/stackone.ts Integrates the feedback tool into StackOneToolSet
src/index.ts Exports the createFeedbackTool function
package.json Adds Zod as a dependency and peer dependency
src/toolsets/tests/stackone.spec.ts Sets STACKONE_ACCOUNT_ID to undefined for testing
src/toolsets/tests/snapshots/stackone.spec.ts.snap Updated snapshots reflecting API spec changes including new shift endpoints and unified_custom_fields
src/openapi/tests/snapshots/openapi-parser.spec.ts.snap Updated snapshots for OpenAPI parser with new endpoints and field additions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 20 files

Prompt for AI agents (all 2 issues)

Understand the root cause of the following 2 issues and fix them.


<file name="src/tools/feedback.ts">

<violation number="1" location="src/tools/feedback.ts:24">
Whitespace-only tool names are removed during transformation, so inputs like [&quot;   &quot;] bypass validation and produce an empty tool_names array in the request body. Add a post-transform check to ensure at least one non-empty name remains.</violation>
</file>

<file name="bun.lock">

<violation number="1" location="bun.lock:464">
Upgrading zod to 4.1.11 conflicts with existing packages that peer-depend on zod ^3.x (e.g., zod-to-json-schema, @ai-sdk/openai, ai, openai). This upgrade will surface unresolved peer dependency errors and can break those integrations.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

toolNames: z
.array(z.string())
.min(1, 'At least one tool name is required')
.transform((value) => value.map((item) => item.trim()).filter((item) => item.length > 0)),
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 16, 2025

Choose a reason for hiding this comment

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

Whitespace-only tool names are removed during transformation, so inputs like [" "] bypass validation and produce an empty tool_names array in the request body. Add a post-transform check to ensure at least one non-empty name remains.

Prompt for AI agents
Address the following comment on src/tools/feedback.ts at line 24:

<comment>Whitespace-only tool names are removed during transformation, so inputs like [&quot;   &quot;] bypass validation and produce an empty tool_names array in the request body. Add a post-transform check to ensure at least one non-empty name remains.</comment>

<file context>
@@ -0,0 +1,130 @@
+  toolNames: z
+    .array(z.string())
+    .min(1, &#39;At least one tool name is required&#39;)
+    .transform((value) =&gt; value.map((item) =&gt; item.trim()).filter((item) =&gt; item.length &gt; 0)),
+});
+
</file context>
Fix with Cubic

bun.lock Outdated
"yoctocolors-cjs": ["yoctocolors-cjs@2.1.2", "", {}, "sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA=="],

"zod": ["zod@3.24.2", "", {}, "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ=="],
"zod": ["zod@4.1.11", "", {}, "sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg=="],
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 16, 2025

Choose a reason for hiding this comment

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

Upgrading zod to 4.1.11 conflicts with existing packages that peer-depend on zod ^3.x (e.g., zod-to-json-schema, @ai-sdk/openai, ai, openai). This upgrade will surface unresolved peer dependency errors and can break those integrations.

Prompt for AI agents
Address the following comment on bun.lock at line 464:

<comment>Upgrading zod to 4.1.11 conflicts with existing packages that peer-depend on zod ^3.x (e.g., zod-to-json-schema, @ai-sdk/openai, ai, openai). This upgrade will surface unresolved peer dependency errors and can break those integrations.</comment>

<file context>
@@ -459,7 +461,7 @@
     &quot;yoctocolors-cjs&quot;: [&quot;yoctocolors-cjs@2.1.2&quot;, &quot;&quot;, {}, &quot;sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA==&quot;],
 
-    &quot;zod&quot;: [&quot;zod@3.24.2&quot;, &quot;&quot;, {}, &quot;sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==&quot;],
+    &quot;zod&quot;: [&quot;zod@4.1.11&quot;, &quot;&quot;, {}, &quot;sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==&quot;],
 
     &quot;zod-to-json-schema&quot;: [&quot;zod-to-json-schema@3.24.3&quot;, &quot;&quot;, { &quot;peerDependencies&quot;: { &quot;zod&quot;: &quot;^3.24.1&quot; } }, &quot;sha512-HIAfWdYIt1sssHfYZFCXp4rU1w2r8hVVXYIlmoa0r0gABLs5di3RCqPU5DDROogVz1pAdYBaz7HK5n9pSUNs3A==&quot;],
</file context>

✅ Addressed in ef5efc1

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 16, 2025

Open in StackBlitz

npm i https://pkg.pr.new/StackOneHQ/stackone-ai-node/@stackone/ai@125

commit: 85cafd9

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 16, 2025

Open in StackBlitz

npm i https://pkg.pr.new/StackOneHQ/stackone-ai-node/@stackone/ai@125

commit: 5bd2e8a

- Change parameter name from toolNames to tool_names (snake_case)
- Update function signature to match Python: createFeedbackTool(apiKey?, accountId?, baseUrl)
- Update all tests to use new parameter naming
- Fix MCP integration test
- Ensure consistent behavior between Node.js and Python SDKs
- Remove test/ directory that contained outdated integration test documentation
- Clean up temporary artifacts from development process
- All tests are now properly organized in src/tools/tests/ and src/tests/
- Document the meta_collect_tool_feedback tool functionality
- Explain user consent requirements and AI agent integration
- Provide usage examples for both manual and AI agent usage
- Highlight automatic inclusion in StackOneToolSet
- Convert single quotes to double quotes for consistency
- Apply Biome formatting rules to code examples
- Maintain readability while following project style guidelines
@NicolasBelissent
Copy link
Contributor Author

@claude review this pr

@claude
Copy link
Contributor

claude bot commented Oct 17, 2025

Claude encountered an error —— View job


I'll analyze this and get back to you.

- Support both single account ID (string) and multiple account IDs (array)
- Send feedback to each account individually when multiple IDs provided
- Return comprehensive summary with success/failure status for each account
- Update dry run to show all requests that would be sent
- Add comprehensive test coverage for multiple account scenarios
- Update README with multiple account usage examples and response format

This ensures that when LLMs have access to multiple account IDs,
the feedback is properly submitted to each account separately rather
than being lost or only sent to one account.
- Update response format to match Python SDK structure:
  - message: 'Feedback sent to X account(s)'
  - total_accounts, successful, failed counts
  - results array with account_id, status, result/error fields
- Fix error handling to return string error messages instead of objects
- Update all tests to expect the new response format
- Update README documentation to reflect Python SDK compatibility

This ensures feature parity between Node.js and Python SDKs for
the feedback tool's multiple account ID functionality.
- Replace 'any' types with proper type annotations
- Apply Biome formatting to maintain code style consistency
- All tests passing, linting clean, ready for production
Copy link

@willleeney willleeney left a comment

Choose a reason for hiding this comment

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

LGTM

- Restructure tests to match Python SDK's comprehensive approach
- Add 4 validation tests: missing fields, whitespace validation, multiple account IDs, JSON string input
- Add 5 execution tests: single account, call interface, API error handling, multiple accounts, tool integration
- Add 1 integration test: live feedback submission (skipped if no API key)
- Maintain same test coverage with better organization and clearer test names
- All tests pass and CI checks pass
@NicolasBelissent NicolasBelissent merged commit d943e60 into main Oct 17, 2025
6 checks passed
@NicolasBelissent NicolasBelissent deleted the feature/feedback-tool-feedback-consent branch October 17, 2025 10:25
Copy link
Contributor

@ryoppippi ryoppippi left a comment

Choose a reason for hiding this comment

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

i realised some changes happens in stackone.mcp-fetch.spec.ts
i don't think @NicolasBelissent changes anything on mcp-fetcher.ts, so we should not change any test code.

Also in this file we have type error, so we need to fix it

Image

Comment on lines -66 to +74
] as const satisfies MockTool[];
] as const;
Copy link
Contributor

Choose a reason for hiding this comment

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

hey we need keep this type

expect(aiToolDefinition).toBeDefined();
expect(aiToolDefinition.description).toBe('Dummy tool');
expect(aiToolDefinition.inputSchema.jsonSchema.properties.foo.type).toBe('string');
expect(aiToolDefinition.inputSchema.jsonSchema.properties).toBeDefined();
Copy link
Contributor

Choose a reason for hiding this comment

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

did you change the definition of json schema? why did you change it?

you define the property like this

       properties: {
          foo: {
            type: 'string',
            description: 'A string parameter',
          },
        },

so you need keep the test case

Comment on lines +63 to +72
type: 'object',
properties: {
foo: {
type: 'string',
description: 'A string parameter',
},
},
required: ['foo'],
additionalProperties: false,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

why you need to use json schema instead of zod?
overall, i don't think we need to change any test for mcp-fetcheer.

}

// Add feedback collection meta tool
this.tools.push(createFeedbackTool(undefined, this.accountId, this.baseUrl));
Copy link
Contributor

Choose a reason for hiding this comment

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

also do we need this? because we don't have any extra test for this feature in this file.

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.

4 participants