Skip to content

feat(mcp): expose keyless job feedback - #407

Open
Max17190 wants to merge 25 commits into
mainfrom
max/enable-keyless-feedback
Open

Max17190 wants to merge 25 commits into
mainfrom
max/enable-keyless-feedback

Conversation

@Max17190

@Max17190 Max17190 commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Why

Let agents discover and optionally submit evidence for keyless Search, Scrape, and Parse using the API contract in #4616.

Summary

  • Expose the existing firecrawl_feedback tool to keyless callers, including after operation quota exhaustion, and forward trusted hosted caller identity.
  • Preserve job references and invitations on success and failure, including structured Search responses.
  • Use optional, evidence-based guidance in tool descriptions and keyless instructions. Keep descriptions within 2,048 characters.
  • Forward validation details and retry timing for keyless feedback rejections. Preserve authenticated contracts and preferences.

Release after the API is deployed and Docs #1414 is published.

Test Plan

  • Frozen-lockfile installation, build, TypeScript checks, and lint pass.
  • All 190 tests pass, covering discovery, hosted identity, quota exhaustion, success/failure references, rejection details, description limits, and authenticated regressions.
  • Actual Search, Scrape, and Parse calls against the API staging deployment preserve invitations, accept feedback, and return the original feedback ID on retry. A failed Scrape with HTTP 200 and success: false is an MCP error with its job reference in both text and structured output; its failure feedback and retry succeed.

Remove the daily submission rule and the exact attempt rate from the feedback
tool guidance and README. Each keyless job accepts one submission, retries
return the original feedback ID, and attempts are described as rate limited.
Model the smoke test's 429 on the API attempt throttle response.
Resolve conflicts with Alexandria session feedback, the compact response
format, and the tool description budget:

- Register firecrawl_feedback for keyless sessions while Alexandria result
  pointers keep their authenticated availability check.
- Accept Alexandria session feedback and keyless job feedback through the same
  tool, and keep exposing the Search id to keyless callers.
- Move the keyless observation rules to the observations parameter so every
  tool description fits the client description window, and place keyless
  feedback copy after the routing copy.
- Describe keyless feedback as requested in exchange for free keyless access.
…E copy

Replace the remaining optional keyless feedback wording in the local keyless startup message and the Search tool README entry.
Restore the authenticated Search id sentence from main next to the keyless feedback sentence so both contracts stay described.
…rong

Replace the in-exchange framing with an optional ask tied to a trigger:
if a result is wrong, incomplete, blocked, or an error. This covers the
Search, Scrape and Parse descriptions, the feedback tool, the keyless
instructions, the startup message and the README. The descriptions say
"via" so Search stays inside the 2,048-character description cap.
…ions

Tool descriptions are read by every session, so authenticated agents
should not carry keyless-only guidance. Keyless agents still get the ask
in each keyless result's invitation, the feedback tool's description and
the keyless instructions.
@Max17190
Max17190 marked this pull request as ready for review October 1, 2026 16:08

@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.

1 issue found across 6 files

Confidence score: 4/5

  • In src/index.ts, failed keyless jobs omit the jobId from the displayed error, so hosted clients may not show users which job failed. Include the ID in the message text.
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:3194">
P2: A failed keyless job throws a UserError whose message is only the API error text; the jobId is passed only as the structured payload. Hosted clients receive the text block (see the convention noted at the `KEYLESS_SIGNUP_FALLBACK_URL` comment, and `executeExchangeCalls`, which embeds requestId in the message for this reason), so the caller cannot obtain the job reference needed to submit `kind: failure` feedback that the keyless instructions advertise. Include the job reference in the message text.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread src/index.ts
Comment thread src/index.ts
Comment on lines +3194 to +3197
if (json?.metadata?.jobId) {
throw new UserError(
json.error || `Firecrawl request failed (HTTP ${response.status})`,
json

@cubic-dev-ai cubic-dev-ai Bot Oct 1, 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: A failed keyless job throws a UserError whose message is only the API error text; the jobId is passed only as the structured payload. Hosted clients receive the text block (see the convention noted at the KEYLESS_SIGNUP_FALLBACK_URL comment, and executeExchangeCalls, which embeds requestId in the message for this reason), so the caller cannot obtain the job reference needed to submit kind: failure feedback that the keyless instructions advertise. Include the job reference in the message text.

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 3194:

<comment>A failed keyless job throws a UserError whose message is only the API error text; the jobId is passed only as the structured payload. Hosted clients receive the text block (see the convention noted at the `KEYLESS_SIGNUP_FALLBACK_URL` comment, and `executeExchangeCalls`, which embeds requestId in the message for this reason), so the caller cannot obtain the job reference needed to submit `kind: failure` feedback that the keyless instructions advertise. Include the job reference in the message text.</comment>

<file context>
@@ -3194,6 +3191,12 @@ async function keylessPost(
       if (hints) payload.agent_hints = hints;
       throw new UserError(String(payload.message), payload);
     }
+    if (json?.metadata?.jobId) {
+      throw new UserError(
+        json.error || `Firecrawl request failed (HTTP ${response.status})`,
</file context>
Suggested change
if (json?.metadata?.jobId) {
throw new UserError(
json.error || `Firecrawl request failed (HTTP ${response.status})`,
json
if (json?.metadata?.jobId) {
const message =
json.error || `Firecrawl request failed (HTTP ${response.status})`;
throw new UserError(
`${message} Job reference: ${json.metadata.jobId}`,
json
);
}
Fix with cubic

Comment thread tests/mcp-search-profile.test.mjs Outdated
Comment thread tests/mcp-smoke.test.mjs
@Max17190

Max17190 commented Oct 1, 2026

Copy link
Copy Markdown
Member Author

@cubic-dev-ai review this PR in full at the current head.

Use the API contract in firecrawl/firecrawl#4616 as the source of truth. Keyless feedback is optional, available for Search, Scrape, and Parse, and requires task, assessment, observations, and Parse docClass. The shared tool schema retains optional evidence fields for authenticated compatibility; keyless sessions validate the required fields before a request. Failed jobs retain the full API envelope in text and structured output, including HTTP 200 responses with success: false. Feedback submissions bypass operation eligibility checks but retain trusted hosted caller identity.

Please recheck the complete diff and the prior findings against the current implementation.

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR in full at the current head.

Use the API contract in firecrawl/firecrawl#4616 as the source of truth. Keyless feedback is optional, available for Search, Scrape, and Parse, and requires task, assessment, observations, and Parse docClass. The shared tool schema retains optional evidence fields for authenticated compatibility; keyless sessions validate the required fields before a request. Failed jobs retain the full API envelope in text and structured output, including HTTP 200 responses with success: false. Feedback submissions bypass operation eligibility checks but retain trusted hosted caller identity.

Please recheck the complete diff and the prior findings against the current implementation.
...

@Max17190 I have started the AI code review. It will take a few minutes to complete.

@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.

No issues found across 5 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Expands keyless MCP exposure by adding firecrawl_feedback to anonymous callers and widening the public tool set and search output contract; the rollout, identity, and abuse tradeoffs need human sign-off.

Re-trigger cubic

This branch has not been deployed

No deployments
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