Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

17.6 KB
Raw Blame
description: Agent chat tool-loop regression tests — does the configured model drive add_job and get_resume well enough to ship

# These rows exercise the CHAT surface, not MCP. All five tools are declared
# from the same Zod schemas and descriptions the /api/ai/chat route registers,
# and prompt.ts assembles each turn exactly as the route does — page-context
# block at the tail, paste head after it — so "did the model copy the posting
# it was shown into jobDescription" is measurable here. No route, no database,
# no approval gate: the model chooses and promptfoo asserts on the raw
# tool_calls.
#
# There is no "configured default" for this table to bless. The chat 503s when
# settings.ai.model is unset, so what this measures is which model the user
# should configure, and whether one model can serve both chat and the existing
# review/match surfaces.

providers:
  - id: openai:chat:deepseek-v4-flash
    label: deepseek-v4-flash
    config:
      apiBaseUrl: https://api.deepseek.com
      apiKeyEnvar: DEEPSEEK_API_KEY
      showThinking: false
      temperature: 0
      max_tokens: 8192
      tool_choice: auto
      tools: file://./tools.json

  # Local Ollama via its NATIVE endpoint, which is what the app uses. The
  # OpenAI-compatible /v1 shim cannot measure this surface: promptfoo's
  # openai:chat provider checks message.reasoning FIRST and discards
  # tool_calls when both are present, so every thinking tool call scores as
  # "no tool call". Verified in promptfoo 0.121.19 and 0.122.0 alike.
  - id: ollama:chat:qwen3.5:9b
    label: ollama-qwen3.5-9b
    config:
      # TEMPERATURES.ANALYSIS, which is what the route actually sends. It was
      # 0 here, and greedy sampling cannot see a failure the app hits under
      # sampling: qwen3.5 sends appliedDate:"" often enough to cost two dead
      # turns in a manual run while nine deterministic rows stayed green.
      # The price is that runs are no longer byte-identical, so a token-count
      # comparison across runs is no longer evidence of anything.
      temperature: 0.1
      # Mirrors the route: providerOptions.ollama.think plus AGENT_CHAT_NUM_CTX.
      think: true
      num_ctx: 16384
      tools: file://./tools.json

prompts:
  - file://./prompt.ts

# Grading provider for the llm-rubric in row 8. Declared here rather than
# inline for the same two reasons as the root config: max_tokens (DeepSeek's
# reasoning can consume the default 1024 and leave zero content) and
# showThinking (defaults true, which breaks llm-rubric's JSON extraction).
defaultTest:
  options:
    provider:
      id: openai:chat:deepseek-v4-flash
      config:
        apiBaseUrl: https://api.deepseek.com
        apiKeyEnvar: DEEPSEEK_API_KEY
        showThinking: false
        temperature: 0
        max_tokens: 4096

tests:
  - description: Full posting, everything in the head - extracts and copies the description
    vars:
      jobPosting: file://./fixtures/full-posting.txt
      userMessage: Add this job.
      pageLocation: jobs-list
      expectCompany: Helio Systems
      expectTitle: Staff Data Engineer
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsAddJob
      - type: javascript
        value: file://./assertions.ts:assertValidToolInput
      - type: javascript
        value: file://./assertions.ts:assertCompanyAndTitle
      - type: javascript
        value: file://./assertions.ts:assertDescriptionCopiedFromPaste

  - description: Shared backend posting - same three assertions, different wording
    vars:
      jobPosting: file://../job-match/fixtures/backend-job.txt
      userMessage: Save this posting to my tracker.
      expectCompany: Northwind Cloud
      expectTitle: Senior Backend Engineer
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsAddJob
      - type: javascript
        value: file://./assertions.ts:assertValidToolInput
      - type: javascript
        value: file://./assertions.ts:assertCompanyAndTitle
      - type: javascript
        value: file://./assertions.ts:assertDescriptionCopiedFromPaste

  # The path the delimited rows above cannot measure. A posting under
  # AGENT_CHAT_PASTE_THRESHOLD makes no chip, so it arrives as ordinary message
  # text and there is no pastedText for execute to splice in: what the model
  # puts in jobDescription is what the record keeps, and an omission here is
  # the failure that lowering the threshold to 1000 was meant to stop being
  # routine. 861 chars, so it stays inline as long as the threshold does.
  - description: Sub-threshold posting, inline not pasted - copies it into jobDescription
    vars:
      userMessage: Add this job.
      inlinePosting: file://./fixtures/short-posting.txt
      pageLocation: jobs-list
      expectCompany: Marlowe Payments
      expectTitle: Integration Engineer
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsAddJob
      - type: javascript
        value: file://./assertions.ts:assertValidToolInput
      - type: javascript
        value: file://./assertions.ts:assertCompanyAndTitle
      - type: javascript
        value: file://./assertions.ts:assertDescriptionCopiedFromMessage

  # Documents the accepted loss rather than asserting against it: the salary
  # sits at char 3048, past the 2000-char head, so it is not recoverable here.
  - description: Salary past the head boundary - company and title only
    vars:
      jobPosting: file://./fixtures/salary-at-bottom.txt
      userMessage: Track this one.
      expectCompany: Cobalt Analytics
      expectTitle: Senior Machine Learning Engineer
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsAddJob
      - type: javascript
        value: file://./assertions.ts:assertValidToolInput
      - type: javascript
        value: file://./assertions.ts:assertCompanyAndTitle

  - description: Posting with no salary and no location - invents neither
    vars:
      jobPosting: file://./fixtures/no-salary.txt
      userMessage: Add it.
      forbiddenFields: salaryRange,location
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsAddJob
      - type: javascript
        value: file://./assertions.ts:assertValidToolInput
      - type: javascript
        value: file://./assertions.ts:assertNoInventedFields

  - description: Posting carrying injected instructions - extracts, does not obey
    vars:
      jobPosting: file://./fixtures/injection-posting.txt
      userMessage: Add this job.
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsAddJob
      - type: javascript
        value: file://./assertions.ts:assertValidToolInput
      - type: javascript
        value: file://./assertions.ts:assertIgnoresInjectedInstructions

  # 96 chars, so the composer never makes a chip for it: it arrives inline,
  # carrying a company and a title but no description of the role at all.
  # add_job is unreachable — execute rejects a call with no description, and
  # needsApproval is false for it, so the model does not even spend a
  # confirmation card learning that. The only correct turn is to ask, and the
  # capabilities clause says to ask for all three fields together.
  - description: Title-only stub, no description - asks for all three
    vars:
      userMessage: Save this.
      inlinePosting: file://../mcp-tools/fixtures/title-only.txt
    assert:
      - type: javascript
        value: file://./assertions.ts:assertNoToolCall
      # Scoped to what the clause defends rather than to its literal reading:
      # asking only for the piece that is missing is better UX than re-asking
      # for a company and title the message already gave, and the regression
      # the clause exists for is the description being dropped from the ask or
      # offered as optional.
      - type: llm-rubric
        value: >-
          The reply asks the user for the posting text or a description of what
          the role involves, and treats it as required rather than optional. It
          does not claim to have saved or added the job.

  # The typed path's inverse: with no paste there is nothing to splice, so the
  # description has to come from the model or the tool stores nothing.
  - description: Typed details, no paste - supplies the description itself
    vars:
      userMessage: >-
        Add a job: Senior Platform Engineer at Stripe, remote, posted on
        LinkedIn. It's a backend infrastructure role working on payments
        reliability.
      expectCompany: Stripe
      expectTitle: Senior Platform Engineer
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsAddJob
      - type: javascript
        value: file://./assertions.ts:assertValidToolInput
      - type: javascript
        value: file://./assertions.ts:assertCompanyAndTitle
      - type: javascript
        value: file://./assertions.ts:assertDescriptionSupplied

  # The step after Confirm. The user has already pressed it and the row starts
  # from the write, so any mention of a confirmation card here is the model
  # asking them to do again what they just did — which is what the capabilities
  # clause about a created result forbids. Note there is no page-context block
  # on this row: the route only pushes one when the last message is the user's,
  # and an approval-resume POST ends on the assistant's turn.
  - description: After Confirm - reports the save, never re-asks for confirmation
    vars:
      userMessage: Add this job.
      priorAddJob: created
    assert:
      - type: javascript
        value: file://./assertions.ts:assertNoToolCall
      - type: llm-rubric
        value: >-
          The reply states plainly that the job was added or saved. It does not
          mention a confirmation card, and does not ask the user to confirm,
          review, check or press anything.

  # US-5 measured rather than asserted in prose: the agent has no read tool,
  # so the only correct answer is to say so.
  - description: Asks about saved data the agent cannot read - declines, no tool call
    vars:
      userMessage: How many jobs have I applied to this month?
    assert:
      - type: llm-rubric
        value: >-
          The reply states it cannot read the user's saved jobs. It does not
          give a number and does not call a tool.

  # The review flow's only step now: one tool call, and the app does the rest.
  - description: Review request - calls review_resume
    vars:
      userMessage: Review my resume.
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsReviewResume

  # get_resume is a general read, not a review tool. A plain question about
  # resume contents should reach for it too.
  - description: Plain resume question - reads the resume instead of refusing
    vars:
      userMessage: What skills are listed on my resume?
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsGetResume

  # The two resume tools must not be interchangeable: a critique is a review,
  # a factual question is a read. This is the row that catches a tool
  # description that blurs them.
  - description: Critique wording - still review_resume, not get_resume
    vars:
      userMessage: Can you give me feedback on how strong my resume is?
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsReviewResume

  # Follow-ups are the whole point of moving review into the chat: answered
  # from context, no second read, and no second SCORES line to re-trigger a
  # save.
  - description: Follow-up question - answers from context, no re-read, no new scores
    vars:
      userMessage: Review my resume.
      priorReview: file://./fixtures/prior-review.md
      followUp: Which of those improvements would you do first, and why?
    assert:
      - type: javascript
        value: file://./assertions.ts:assertFollowUpStaysConversational

  # The follow-up must be answerable from the review ALONE — the resume text is
  # never in this transcript, only the critique of it. An earlier version asked
  # the model to "rewrite the summary bullet you flagged", which the review
  # neither flags nor quotes, so fetching the resume was the correct response
  # and the row failed on deepseek for the whole of its life.
  - description: Follow-up asking about a specific section - still conversational
    vars:
      userMessage: Review my resume.
      priorReview: file://./fixtures/prior-review.md
      followUp: In the summary you said several achievements describe responsibilities rather than outcomes. What do you mean by that?
    assert:
      - type: javascript
        value: file://./assertions.ts:assertFollowUpStaysConversational

  # Capability honesty, restated for two tools: resumes are now readable,
  # jobs still are not. The existing jobs row stays as-is.
  - description: Asks about tasks it still cannot read - declines, no tool call
    vars:
      userMessage: What tasks are due this week?
    assert:
      - type: llm-rubric
        value: >-
          The reply states it cannot read the user's tasks. It does not list
          tasks and does not call a tool.

  # The match flow's only step: one tool call, and the app does the rest.
  - description: Match request - calls match_job
    vars:
      userMessage: How well do I match this job?
      pageLocation: job
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsMatchJob

  # What the job page's Match with AI button actually sends. It is the primary
  # entry point, so it is measured rather than assumed to behave like the
  # typed phrasings above.
  - description: Match button phrasing - calls match_job
    vars:
      userMessage: Match my resume to Senior Backend Engineer at Northwind Cloud
      pageLocation: job
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsMatchJob

  # The decision phrasing, which never names a resume or a score.
  - description: Should-I-apply wording - still match_job
    vars:
      userMessage: Should I apply to this one?
      pageLocation: job
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsMatchJob

  # The other half of the page-context block, and the half the eight
  # pageLocation: job rows cannot measure. Off a job's page the tool would
  # return no_job in a millisecond, but the block tells the model where the
  # user is before it spends the call, and capabilities tells it to redirect
  # instead. The jobs-list line also forbids the failure mode that came with
  # the page vocabulary: answering a match request by asking them to paste or
  # re-add a job they already have saved.
  - description: Match request from the jobs list - redirects, no tool call
    vars:
      userMessage: How well do I match this job?
      pageLocation: jobs-list
    assert:
      - type: javascript
        value: file://./assertions.ts:assertNoToolCall
      - type: llm-rubric
        value: >-
          The reply says the user is on the jobs list rather than a single
          job's page, and asks them to open the job they mean. It does not ask
          them to paste a posting or to add the job again, and does not claim
          to have scored anything.

  # The 'elsewhere' page line, which names no page: the model can say a job's
  # page is not open, and nothing more.
  - description: Cover letter request off a job's page - redirects, no tool call
    vars:
      userMessage: Can you write me a cover letter for this job?
    assert:
      - type: javascript
        value: file://./assertions.ts:assertNoToolCall
      - type: llm-rubric
        value: >-
          The reply says no job's page is open and asks the user to open the
          job they want the letter for. It does not write a cover letter and
          does not claim to have written or saved one.

  # Both nested tools in one step serialize on Ollama past the turn deadline
  # and lose both generations. The prompt clause says one per turn; this is
  # what measures whether the model obeys it.
  - description: Both analyses at once - exactly one nested tool call
    vars:
      userMessage: Review my resume and tell me how well I match this job.
      pageLocation: job
    assert:
      - type: javascript
        value: file://./assertions.ts:assertOneNestedCall

  # The cover letter flow's only step: one tool call, and the app does the rest.
  - description: Cover letter request - calls generate_cover_letter
    vars:
      userMessage: Write me a cover letter for this job.
      pageLocation: job
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsCoverLetter

  # What the job page's Cover Letter button will send once Task 5 rewires it.
  # It is the primary entry point, so it is measured rather than assumed.
  - description: Cover letter button phrasing - calls generate_cover_letter
    vars:
      userMessage: Write a cover letter for Senior Backend Engineer at Northwind Cloud
      pageLocation: job
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsCoverLetter

  # Different wording for the same intent, and the one most likely to be
  # answered with prose instead of a tool call.
  - description: Letter-of-application wording - still generate_cover_letter
    vars:
      userMessage: Can you draft a letter of application I can send with this?
      pageLocation: job
    assert:
      - type: javascript
        value: file://./assertions.ts:assertCallsCoverLetter

  # A letter is not a match. This is the row that catches a tool description
  # that blurs the two job-page tools.
  - description: Match and letter at once - exactly one nested tool call
    vars:
      userMessage: How well do I match this job, and write me a cover letter.
      pageLocation: job
    assert:
      - type: javascript
        value: file://./assertions.ts:assertOneNestedCall