Skip to content

Add --objective to search-feedback - #298

Closed
KrisOei wants to merge 2 commits into
mainfrom
feat/search-feedback-objective
Closed

KrisOei wants to merge 2 commits into
mainfrom
feat/search-feedback-objective

Conversation

@KrisOei

@KrisOei KrisOei commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a required --objective flag to search-feedback: the underlying goal behind the search. The search skill's feedback example now includes it.

Requires the API change to be deployed first.

Checks

Typecheck and full test suite (660 tests) passed.

Open in Capy


Summary by cubic

Adds an optional --objective flag to search-feedback so feedback can capture the underlying goal behind the search, not just the query terms.

  • When supplied, the CLI trims it, rejects blank values or text over 2000 characters, and sends it in the feedback request.
  • The firecrawl search skill's feedback example now includes --objective.
  • Requires the API change that accepts objective to be deployed before this ships.

Written for commit 45318d9. Summary will update on new commits.

Review in cubic

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 issues found across 4 files

Confidence score: 4/5

  • search-feedback-objective.test.ts treats a missing --objective as success, which could let the required-flag behavior go unenforced. Change the test to expect rejection when the flag is omitted.
  • src/index.ts duplicates the detail validator in alexandria-feedback.ts, so the two copies could drift. Reuse the existing validator.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/index.ts">

<violation number="1" location="src/index.ts:1404">
P3: `searchFeedbackObjective` duplicates the identical `detail` validator already defined in src/commands/alexandria-feedback.ts (same trim, same 2000-char check, same 'Use 1–2000 characters.' message and it's used for the same `--objective` purpose). Extract a shared text-validator helper into a utils module and reuse it in both places so the limit/message don't drift.</violation>
</file>

<file name="src/__tests__/search-feedback-objective.test.ts">

<violation number="1" location="src/__tests__/search-feedback-objective.test.ts:84">
P2: This test asserts that omitting `--objective` succeeds (silently no-op via `--silent` if the server rejects it). That contradicts the PR's stated intent of "Adds a required `--objective` flag," and the implementation uses a plain `.option(...)` (not `.requiredOption`), so the CLI never enforces it. If the backend now requires objective, agents that omit it (e.g. existing `--silent &` skills feedback) will send payloads the API rejects, and because `--silent` exits 0 on failure the error is swallowed. Make the flag actually required with `.requiredOption(...)` (and reject omission in this test), or update the PR description/skill doc to say it is optional-on-the-CLI.</violation>
</file>

Shadow auto-approve: would not auto-approve because issues were found.

Fix all with cubic | Re-trigger cubic

});
});

it('still sends feedback without an objective', async () => {

@cubic-dev-ai cubic-dev-ai Bot Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This test asserts that omitting --objective succeeds (silently no-op via --silent if the server rejects it). That contradicts the PR's stated intent of "Adds a required --objective flag," and the implementation uses a plain .option(...) (not .requiredOption), so the CLI never enforces it. If the backend now requires objective, agents that omit it (e.g. existing --silent & skills feedback) will send payloads the API rejects, and because --silent exits 0 on failure the error is swallowed. Make the flag actually required with .requiredOption(...) (and reject omission in this test), or update the PR description/skill doc to say it is optional-on-the-CLI.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/__tests__/search-feedback-objective.test.ts, line 84:

<comment>This test asserts that omitting `--objective` succeeds (silently no-op via `--silent` if the server rejects it). That contradicts the PR's stated intent of "Adds a required `--objective` flag," and the implementation uses a plain `.option(...)` (not `.requiredOption`), so the CLI never enforces it. If the backend now requires objective, agents that omit it (e.g. existing `--silent &` skills feedback) will send payloads the API rejects, and because `--silent` exits 0 on failure the error is swallowed. Make the flag actually required with `.requiredOption(...)` (and reject omission in this test), or update the PR description/skill doc to say it is optional-on-the-CLI.</comment>

<file context>
@@ -0,0 +1,101 @@
+  });
+});
+
+it('still sends feedback without an objective', async () => {
+  const index = feedbackArgs.indexOf('--objective');
+  const withoutObjective = feedbackArgs.filter(
</file context>
Fix with cubic

Comment thread src/index.ts
return researchCmd;
}

function searchFeedbackObjective(value: string): string {

@cubic-dev-ai cubic-dev-ai Bot Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: searchFeedbackObjective duplicates the identical detail validator already defined in src/commands/alexandria-feedback.ts (same trim, same 2000-char check, same 'Use 1–2000 characters.' message and it's used for the same --objective purpose). Extract a shared text-validator helper into a utils module and reuse it in both places so the limit/message don't drift.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/index.ts, line 1404:

<comment>`searchFeedbackObjective` duplicates the identical `detail` validator already defined in src/commands/alexandria-feedback.ts (same trim, same 2000-char check, same 'Use 1–2000 characters.' message and it's used for the same `--objective` purpose). Extract a shared text-validator helper into a utils module and reuse it in both places so the limit/message don't drift.</comment>

<file context>
@@ -1401,6 +1401,13 @@ Examples:
   return researchCmd;
 }
 
+function searchFeedbackObjective(value: string): string {
+  const text = value.trim();
+  if (!text || text.length > 2000)
</file context>
Fix with cubic

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 issues found and verified against the latest diff

Confidence score: 4/5

  • search-feedback-objective.test.ts can exit successfully without sending a request when either disable flag is set in the contributor’s environment. Clear those flags in the child process environment.
  • src/index.ts’s >2000 rejection branch in searchFeedbackObjective is untested, so regressions in the upper-bound check could go unnoticed. Add a test for that boundary.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/__tests__/search-feedback-objective.test.ts">

<violation number="1" location="src/__tests__/search-feedback-objective.test.ts:46">
P3: The child process inherits `process.env`, so a contributor with `FIRECRAWL_NO_SEARCH_FEEDBACK` or `FIRECRAWL_DISABLE_SEARCH_FEEDBACK` set locally gets the CLI exiting 0 without sending any request, and the first test fails on `requests` being empty (see `isSearchFeedbackDisabledLocally` in src/commands/search-feedback.ts). Neutralize both opt-out vars in the child env so the test is deterministic.</violation>
</file>

<file name="src/index.ts">

<violation number="1" location="src/index.ts:1406">
P3: The >2000 rejection branch of `searchFeedbackObjective` has no test coverage. `src/__tests__/search-feedback-objective.test.ts` exercises only the missing and blank cases, so the newly added upper-bound check is untested.</violation>
</file>

Shadow auto-approve: would auto-approve with 2 open P3 issues. Adds an optional --objective flag to the search-feedback CLI with trimming/validation, forwarding in the feedback request, skill documentation, and tests; existing behavior without the flag is preserved.

Fix all with cubic | Re-trigger cubic

...(await exec(process.execPath, ['dist/index.js', ...args], {
timeout: 10000,
env: {
...process.env,

@cubic-dev-ai cubic-dev-ai Bot Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: The child process inherits process.env, so a contributor with FIRECRAWL_NO_SEARCH_FEEDBACK or FIRECRAWL_DISABLE_SEARCH_FEEDBACK set locally gets the CLI exiting 0 without sending any request, and the first test fails on requests being empty (see isSearchFeedbackDisabledLocally in src/commands/search-feedback.ts). Neutralize both opt-out vars in the child env so the test is deterministic.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/__tests__/search-feedback-objective.test.ts, line 46:

<comment>The child process inherits `process.env`, so a contributor with `FIRECRAWL_NO_SEARCH_FEEDBACK` or `FIRECRAWL_DISABLE_SEARCH_FEEDBACK` set locally gets the CLI exiting 0 without sending any request, and the first test fails on `requests` being empty (see `isSearchFeedbackDisabledLocally` in src/commands/search-feedback.ts). Neutralize both opt-out vars in the child env so the test is deterministic.</comment>

<file context>
@@ -0,0 +1,96 @@
+      ...(await exec(process.execPath, ['dist/index.js', ...args], {
+        timeout: 10000,
+        env: {
+          ...process.env,
+          HOME: home,
+          USERPROFILE: home,
</file context>
Fix with cubic

Comment thread src/index.ts

function searchFeedbackObjective(value: string): string {
const text = value.trim();
if (!text || text.length > 2000)

@cubic-dev-ai cubic-dev-ai Bot Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: The >2000 rejection branch of searchFeedbackObjective has no test coverage. src/__tests__/search-feedback-objective.test.ts exercises only the missing and blank cases, so the newly added upper-bound check is untested.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/index.ts, line 1406:

<comment>The >2000 rejection branch of `searchFeedbackObjective` has no test coverage. `src/__tests__/search-feedback-objective.test.ts` exercises only the missing and blank cases, so the newly added upper-bound check is untested.</comment>

<file context>
@@ -1401,6 +1401,13 @@ Examples:
 
+function searchFeedbackObjective(value: string): string {
+  const text = value.trim();
+  if (!text || text.length > 2000)
+    throw new InvalidArgumentError('Use 1–2000 characters.');
+  return text;
</file context>
Fix with cubic

@KrisOei

KrisOei commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Closing: not proceeding with this change for now.

@KrisOei KrisOei closed this Oct 2, 2026
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.

1 participant