Skip to content

Prospecting runs: saved_query_ids and chat_closed - #36

Merged
yudelevi merged 21 commits into
developmentfrom
feat/agentic-prospecting
Sep 29, 2026
Merged

yudelevi merged 21 commits into
developmentfrom
feat/agentic-prospecting

Conversation

@yudelevi

@yudelevi yudelevi commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Adds saved_query_ids (every saved contact list part, in order) and chat_closed to ProspectingRun, and documents the misuse stop reason. Matches discolike-platform !908; merge when that ships. The contract check stays red for prospecting until the endpoints are deployed.

  • Checkpoints: document/support the checkpoints setting (ask/auto) and how to answer a check-in; auto runs sharpen a weak pilot once and keep going.

Large runs now split their saved contact list into parts instead of
truncating at 50 MiB (platform commit 2fbd2d6e5). saved_query_ids
carries all of them in order, with saved_query_id staying the first
entry for backward compatibility.
A chat closed for off-topic use cancels an unapproved or paused run
with stop_reason "misuse" while an approved queued or running one
keeps working. Callers need chat_closed on the run model to know
when to stop chatting and start a new conversation. The API's 403
on a start past the daily new-chat limit already surfaces cleanly
through the existing detail-message extraction, so no client change
was needed there.
Comment thread scripts/check_contract.py
Comment thread packages/discolike/src/discolike/resources/prospecting.py
…pes in the contract script

A key with a newline passed local validation and only failed later when the
transport built the Idempotency-Key header. check_models() also compared
schema property names only, so a type or requiredness change on a mirrored
model (e.g. saved_query_ids, chat_closed) would pass silently.
The platform's GET /prospecting/runs now accepts before (a run ID) to
page past a full page of results, ordered by created_at then run_id
descending. Forward it through the SDK and CLI so callers can walk
past the 50-row max instead of only ever seeing the newest page.
Prospecting runs can now pause at decision points (a pilot check on
large lists, a search drifting off target, running short, reaching the
target) and ask the user, or decide on their own in auto mode. The API
defaults to auto so unattended callers never stall; the web chat
defaults to asking, and the CLI is a person at a terminal, so it
follows the chat rather than the API.

The brief's checkpoints field is hidden from the platform's OpenAPI
schema to keep the MCP tool listing small, so the request generator
pins it by hand and the contract check allows it instead of flagging
drift. Approval's field is pending until the platform deploys it.

At a checkpoint, `prospecting wait` asks on a terminal and keeps
waiting. Scripts and agents get a distinct exit code 7 with the
question and suggested replies on stderr, so they can answer through
`prospecting message` without parsing prose or mistaking a pause for
success.
… list id

The platform declares prospecting status, kind, role and stage as named
type aliases, which its OpenAPI spec emits as $ref schemas. The contract
check read every $ref as "object", so all four fields reported drift on
models that actually matched. It now follows the ref to the target's
type, so a genuine type change behind a ref is still caught.

Runs gain companies_saved_query_id. The spec marks it required, but the
SDK defaults it to None so it still parses servers from before the
field existed; the contract check allows that one difference instead of
failing on it.
The owner changed the rule: a poor pilot in auto mode now sharpens the
criteria once and keeps the run going with a notice, instead of
stopping outright. pilot_failed is now reserved for a re-pilot fit
still under 20% (the searches are broken); a failed sharpening attempt
falls back to the original criteria and continues.
--summary and --negate-summary help said semantic search, which the
API never did. It matches every word of a term in any order; quoting
keeps words together as one term but no longer means an exact phrase,
since the persona summary index dropped phrase positions.
A released SDK should keep working when the API adds a status, stage or
message kind, or raises a server-side cap. Response enums are now open
(Literal | str), and a run's brief parses into a response model without
the request-side limits. The contract check flags only drift that would
break parsing, and CONTRIBUTING spells out the rules for new fields.

The polling deadline is renamed timeout -> max_wait (signup takes
request_timeout) so it no longer reads like the HTTP timeout, and the
floor moves to Python 3.11 ahead of 3.10's end of life.
Customers go in as their own field so the platform can group them into
segments and find lookalikes of each; approval can narrow which segments
are expanded and turn results grouping on or off. The CLI reads the
customer list from a file, the same format as --domains-file.

The spec now carries every property that was pending in the generator
(geo filters, approve checkpoints), so those overlays are gone and the
merge path is tested with a stand-in entry instead.
The agentic prospecting default is moving from 25 companies and 2
contacts per company to 1000 and 1, matching the platform's own
fallback when a brief omits both and planning can't infer a count.
Unset fields are still dropped from the wire, so this only changes
what an unset ProspectingBrief reports locally.

_generated/requests.py is hand-edited ahead of a spec regen: the
platform OpenAPI spec still carries the old defaults, so the next
`gen_requests.py` run reproduces this once that spec change lands.

Also fixes stale doc claims from the task-17 review: the CHANGELOG's
seed_segments=None description said it keeps "every segment but
Other" when it actually keeps the run's current selection (the plan
card's default, or whatever a chat edit set) -- the approve()
docstrings already had this right.
The API now keeps reply_pending true while a "segment these" request
on a finished run is in flight, which can last more than an hour.
Callers waiting on the flag need to know the acknowledgement is not
the end, and that the flag expires after about 90 minutes if
grouping dies.
Prospecting has never shipped, so its within-release iterations,
server-only notes and a 'breaking' default change to an unreleased
model were noise; one entry describes it. The daily conversation
limit is a silent guardrail and stays out of public notes.
The API now uses DELETE on a run to remove the chat (cancelling it
first if active), so cancel() moved to POST .../cancel and delete()
wraps the new behaviour. No released version has prospecting.
The API can now retitle a prospecting chat in any status, so SDK users
get the same control the app has. Takes a generated ProspectingRunUpdate
like the other request-taking methods and returns the list() summary.
No CLI command, matching delete().

Regenerated request models from the dev spec, which also picks up the
reworded customer_domains description.
@yudelevi
yudelevi merged commit 273d4f2 into development Sep 29, 2026
8 checks passed
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