Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 25 additions & 23 deletions SPEC.md

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions config/clients/summit.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ project_document_type = "Client Documents" # W2 Type, to confirm (S4)

# The creator table: one [[company]] per row; exactly one of creator /
# creator_rule. Names and aliases are compared trimmed and case-insensitive,
# whole name only; a name not here is COMPANY_UNKNOWN.
# whole name only; a name not here is COMPANY_UNKNOWN. creator_rule =
# "project_creator": the project window's Project Creator. also_agrees and
# agrees_with_any_row widen which title/PDF row agrees with a project of
# the row (Joey, 4 Dec 2026; SPEC.md -> Client 2, Company agrees).

[[company]]
name = "Summit Easystart"
Expand All @@ -31,6 +34,7 @@ creator = "Compactions"

[[company]]
name = "Summit New Homes"
also_agrees = ["New Gen and EasyStart", "New Generation and EasyStart"] # the brand also agrees with a New Homes project (Joey, 4 Dec 2026)
creator = "NH Sub Floor"

[[company]]
Expand All @@ -45,12 +49,13 @@ creator = "Alison Wells" # one L, as MySys spells her (Joey, 26 Nov
[[company]]
name = "Summit Projects" # MySys's spelling (Joey, 26 Nov 2026)
aliases = ["Summit Developments", "Summit Project"] # Summit Project: the row's old name
creator_rule = "previous_task"
creator_rule = "project_creator" # (Joey, 4 Dec 2026; was previous_task)
agrees_with_any_row = true # any title/PDF row agrees with its project (Joey, 4 Dec 2026)

[[company]]
name = "Summit Renovations" # the company's new name (Joey, 24 Nov 2026)
creator_rule = "previous_task"
creator_rule = "project_creator"

[[company]]
name = "Summit Homes Display"
creator_rule = "previous_task"
creator_rule = "project_creator"
13 changes: 13 additions & 0 deletions docs/decisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ Source of truth for decisions behind `docs/intent.md`, `SPEC.md` (MVP) and `docs

After `tasks/plan.md` is approved (the freeze point), add a dated entry here for every change to what the agent does in MySys or prints in its run output, and for anything that loosens a safety control, in the same commit as the `SPEC.md` changes (`tasks/plan.md` only when a task's plan changes; 5 Nov 2026). Tightening a dev-tooling rule needs only a clear commit message (24 Oct 2026, below).

## 4 Dec 2026 - Summit (Agent 2) missed POs: four rule changes (Joey, 4 Dec 2026, in session summit-missed-pos; loosens Summit's project and company controls and changes the creator it writes, as Joey decided)

- **Why:** Joey listed Summit compaction-test POs that Agent 2 never booked; he booked them by hand on 4 Dec 2026. The diagnosis (the Mac Mini `runs.log` and a read-only live look; the real identifiers stay in `private/summit/missed-2026-12-04/`, laptop only) found three reasons, each repeated on every hourly run: `PROJECT_AMBIGUOUS` (a duplicate project with the same Client Ref No., Cancelled), `COMPANY_MISMATCH` (the "New Gen and EasyStart" brand on the title and PDF of a Summit New Homes project; a Summit Granny Flats PO on a Summit Projects project) and `CREATOR_UNKNOWN` (a Summit Renovations project under the previous-task rule). Joey chose the four rules below.
- **1. A Cancelled search row is dropped:** before the Client Ref No. match, Agent 2 drops every Projects search row whose Status cell (screen-map row 06) reads exactly `Cancelled` after trimming, as the Tasks table's Cancelled. One project left is the match; the Client Internal No. and company checks still apply; two live ones, or a second results page, stay `PROJECT_AMBIGUOUS`; only Cancelled ones is `PROJECT_NOT_FOUND`. A near spelling ("cancelled", "Cancelled Completed") is kept, so it still counts. A Status column not shown reads as empty: the row is kept.
- **2. The New Gen and EasyStart brand on a Summit New Homes project:** the Summit New Homes row gains `also_agrees = ["New Gen and EasyStart", "New Generation and EasyStart"]` (`config/clients/summit.toml`): a New Homes project agrees when the title and the PDF each read one of those names. The creator is the project row's, NH Sub Floor (the same as Summit Easystart's). "Summit Easystart" itself on a New Homes project, the brand on any other row's project, and Summit New Homes on a Summit Easystart project still mismatch.
- **3. The Project Creator replaces the previous task:** for Summit Projects, Summit Renovations and Summit Homes Display (`creator_rule = "project_creator"`, was `previous_task`), the creator is the project window's Project Creator (Client block, the text after `Project Creator:`, a link; screen-map row 07), trimmed. Empty or `---` is `CREATOR_UNKNOWN`. Joey chose this over "the latest task, Variations included" and over keeping tasks only. The driver reads it only when the client's project rule asks (Summit Agent 2; `ProjectRule.reads_project_creator`), at the peek and at W1's reopen; B1 and Agent 3 read nothing new. W1's recheck now compares the Project Creator read again with the decided one (was: the previous task's number and Task Creator); the `Proceed` carries it (`SummitProceed.project_creator`, replacing `previous_task_no` and `previous_task_creator`).
- **4. A Summit Projects project agrees with any title and PDF row:** `agrees_with_any_row = true` on the Summit Projects row; the title and PDF companies must still be in the table (`COMPANY_UNKNOWN` otherwise); the creator is the Project Creator (rule 3).
- **Safe side, Joey to confirm:** (a) the title and the PDF must still name the **same** table row as each other; only the project's row may differ under rules 2 and 4. All five missed cases have title and PDF on one row, so all would book. Taking Joey's "need not be on the same row" as title, PDF and project all free would also book a Summit Homes Group title with a Summit Granny Flats PDF on a Summit Projects project, or a brand title with a "Summit New Homes" PDF. (b) Agent 3 keeps its rules: a Cancelled search row still counts and the three names must agree on one row (Joey decided these for Agent 2's missed POs only; Agent 3 shares `match_project` and the company table, so it was pinned by tests).
- **Tests changed (this `test:` commit, CLAUDE.md Must never #8):** the seam-1 previous-task cases are replaced by Project Creator cases (a Summit Projects project by its alias and Summit Homes Display whatever its Tasks table holds; the same-pln-under-Summit-Projects case expects its Project Creator); `tests/test_client_profile.py`'s creator-table pin reads `project_creator`, and `previous_task` is now refused; `tests/test_summit_booking.py` drops its previous-task W1 tests (its new Project Creator W1 tests stand in their place). Two cases added in this branch's first `test:` commit now expect `COMPANY_MISMATCH` under (a).
- **Real-PO seam:** the three real Summit Projects cases in `private/summit/fixtures/cases.toml` expect the previous-task creator and carry no Project Creator, so they skip `CREATOR_UNKNOWN` until Joey copies each project's Project Creator into its lookup (and its expected creator). They are false skips, never a false PROCEED.
- **Not changed:** the hourly peek budget (an untouched skipped Note is still peeked every run; a separate follow-up).
- **Carried in:** `SPEC.md` -> Client 2 (Decision checks: Project, Company agrees, Creator; the identity paragraph; Creator table and its rule paragraphs; the Proceed; The take and the booking: W1's recheck; client file shape; Summit testing) and Agent 3 (Decision checks: Company, Project); the Project Creator paragraph also says where it is read (the hold re-check too, whose Agent 2 read drops Cancelled rows as well: a recent booking whose project was later Cancelled re-checks as not found, a HOLD_LOST alert, nothing written). `docs/screen-map.md` rows 06 and 07. `docs/ops-runbook.md` 3.5a (Summit's Task Creator by hand) and the W1 "project changed" alert line.

## 4 Dec 2026 - SPEC tidy-ups: V2's PARTIAL_WRITE cases, no "As built" label left in Agent 3's separate run (PR 252 review, Nit 2, and an open review Nit against 2 Dec 2026, leaner process; changes no behaviour, loosens nothing)

- **V2's alert kinds (PR 252 review, Nit 2):** SPEC's V2 said every failed read-back is `ACCURACY_BREACH`, but `mysys/variation.py` stops as `PARTIAL_WRITE` when the New Variation form doesn't close, the new Variation's details row isn't found once, or its detail window isn't as mapped or never readable. SPEC now says so. Both kinds stop with an ALERT and leave both Notes with Agent 3; only the alert's name differs. A wrong or missing value read back is still `ACCURACY_BREACH`.
Expand Down
4 changes: 2 additions & 2 deletions docs/ops-runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ For a Note the agent left after the **Submit** click (step W2 to W5). The goal i
5. **Solved** (if the Note isn't Solved): untick **Send Email Notification**, then Status → **Solved**.
6. Leave the Note assigned to the agent. Once it is Solved, runs no longer stop on it.

**Summit:** the same steps, except: "None" in step 1 means give the Note back (3.4a); in step 2 the PO Number is the full PO number from the Note's title, the Task Creator is the creator table's for the project's company (`config/clients/summit.toml`; for a "previous task" company, the Task Creator of the project's highest-numbered task that is not a Compaction Test and not Cancelled), and the PDF's name may show a `-` as `_`; the Note stays with Agent 2 once Solved.
**Summit:** the same steps, except: "None" in step 1 means give the Note back (3.4a); in step 2 the PO Number is the full PO number from the Note's title, the Task Creator is the creator table's for the project's company (`config/clients/summit.toml`; for a Summit Projects, Summit Renovations or Summit Homes Display project, the project window's Project Creator; decisions, 4 Dec 2026), and the PDF's name may show a `-` as `_`; the Note stays with Agent 2 once Solved.

### 3.5b Finish an Agent 3 job by hand

Expand Down Expand Up @@ -367,7 +367,7 @@ The username works the same way with `mysys_live_username`. For the test site, u
- **Summit: "run stopped; Note not returned"** (often with a `reason=`, for example `reason=CREATOR_UNKNOWN`): Agent 2 took the Note, stopped before Submit and couldn't give it back. For a Note whose assignee was `---`, the agent's own Unlink (decisions, 27 Nov 2026) was refused or didn't read back: **first open the Note and read "Assignee:"**. If it already reads `---`, the Unlink worked and only its log check failed: the Note is back, nothing more to do in MySys, tell Joey. Nothing was submitted. Otherwise give it back by hand (3.4a); until then every Summit run stops at the start with the next detail.
- **Summit: "a Note is still assigned to the agent from an earlier run"**: a Pending Note sits in Agent 2's My Notes. Either an earlier Summit run left it (above) or a person assigned a Note to Agent 2 by hand (nobody should, from go-live step S.1). Find it (3.3) and give it back (3.4a), or finish it (3.5) if a task was made. Then runs go on by themselves.
- **Summit, step W1, `reason=CREATOR_UNKNOWN`** ("creator not an option"): the creator the table gives for the project's company isn't in that project's Creator list, so nothing was selected or submitted. Give the Note back if it is still with Agent 2 (3.4a), book the PO by hand if it is due, and tell Joey: the creator table (`config/clients/summit.toml`) or the project's Creator list has changed. The same Note will stop at W1 again on the next runs until it is fixed.
- **Summit, step W1, "project changed since the decision"**: for a "previous task" company, the project's tasks changed between the agent's read and W1. Nothing was submitted; the Note was given back (or, if `---`, see "Note not returned" above). The next run decides again.
- **Summit, step W1, "project changed since the decision"**: for a Summit Projects, Summit Renovations or Summit Homes Display project, its Project Creator changed between the agent's read and W1. Nothing was submitted; the Note was given back (or, if `---`, see "Note not returned" above). The next run decides again.
- **Agent 3: "run stopped; Note not returned"**: Agent 3 took the job's two Notes, stopped before its first Submit and couldn't give one back (the `note_id` names it; both: Note A). Nothing was submitted. Open each Note and read "Assignee:": `---` is back. Otherwise give it back (3.4b); until then every Agent 3 run stops at the start with the next detail.
- **Agent 3: "a Note is still assigned to the agent from an earlier run"**: a Pending Note sits in Agent 3's My Notes. Either an earlier Agent 3 run left the job (a partial write, or Notes not returned) or a person assigned a Note to Agent 3 by hand (nobody should, from go-live step V.1). Find the Notes (3.3, Agent 3): no Variation made, give them back (3.4b); one made, finish the job (3.5b). A Note assigned by hand goes back to whoever should have it. Then runs go on by themselves.
- **Anything else** (for example "unexpected error (type=...)", "Note not found once"): nothing was submitted and the Note was handed back. Nothing to undo. If the alert has step W2 to W5, treat it as `PARTIAL_WRITE` (3.5).
Expand Down
3 changes: 2 additions & 1 deletion docs/screen-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Projects (sub-tab, not Tasks) → type the internal number in **Search**.
| link | "pln_10001" | `getByRole('link', { name: 'pln_10001' })` | Opens the project |

**Read:** exactly one row; **Client Ref No.** = `2600001B`; **Company** = **B1 Homes**; **Address** = `Lot 123 (#45) Sample Lane Sampleville 6000 WA`. Footer "Page 1 of 1(1 Items)".
**Status** cell: Summit (Agent 2) drops a row reading exactly `Cancelled` (trimmed) before its Client Ref No. match (decisions, 4 Dec 2026; live showed a Cancelled duplicate project with the same Client Ref No.). B1 and Agent 3 don't read it.
**No match:** see row 16.

### Row 07 · Project window
Expand All @@ -148,7 +149,7 @@ Heading **"pln_10001 B1 Homes Sample Lane, Sampleville WA 6000"** (with a `Clien
|---|---|---|
| combobox | "-- Select Task --" | Only the placeholder until the project has tasks |
| text | Title, Office, Created, Lodged By, **Client Internal No.**, Site Owner, **Address**, Estate, Shire, Latitude, Longitude; Soil block | Client Internal No. = `2600001B`; Address as in row 06 |
| link | "B1 Homes" (Project Company), `<project creator>` (Project Creator) | |
| link | "B1 Homes" (Project Company), `<project creator>` (Project Creator) | Client block: `strong` "Project Creator:" (its text in an inner element), the link beside it in the same list item. Summit (Agent 2) reads the text after the label as the creator of a Project Creator row (decisions, 4 Dec 2026); seen on the test site and on live Summit projects |
| button | "Tasks", "Stages", "Log", "Communication", "Documents", "Notes" | Tasks is shown by default |
| button | "Create New Task" | `getByRole('button', { name: 'Create New Task' })`: **the first write** |
| table | columns Lodged By, Task Creator, Create, Office, Stage, Owner, Turn Around Time, Days to Complete, Due Date, Price, Status | Each task takes two rows (below) |
Expand Down
1 change: 1 addition & 0 deletions src/po_agent/b1/decision.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ class B1ProjectRule:
profile's site."""

site: Site
reads_project_creator: bool = False # B1 takes no creator from the project

def match(
self, rows: Sequence[SearchRow], more_pages: bool, internal_no: str
Expand Down
22 changes: 18 additions & 4 deletions src/po_agent/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,18 @@ def _not_blank(value: str) -> str:

class Company(_Section):
"""One creator-table row (SPEC.md -> Client 2, Creator table): the row's
creator, or `previous_task` (the previous task's Task Creator), never
both."""
creator, or `project_creator` (the project window's Project Creator),
never both. `also_agrees`: other rows' names that, on both the title and
the PDF, agree with a project of this row; `agrees_with_any_row`: a
project of this row agrees with any title and PDF row (Agent 2 only;
decisions, 4 Dec 2026)."""

name: str
aliases: tuple[str, ...] = ()
creator: str | None = Field(None, min_length=1)
creator_rule: Literal["previous_task"] | None = None
creator_rule: Literal["project_creator"] | None = None
also_agrees: tuple[str, ...] = ()
agrees_with_any_row: StrictBool = False

@field_validator("name", mode="after")
@classmethod
Expand All @@ -173,7 +178,7 @@ def _name_not_blank(cls, name: str) -> str:
def _creator_not_blank(cls, creator: str | None) -> str | None:
return None if creator is None else _not_blank(creator)

@field_validator("aliases", mode="after")
@field_validator("aliases", "also_agrees", mode="after")
@classmethod
def _aliases_not_blank(cls, aliases: tuple[str, ...]) -> tuple[str, ...]:
return tuple(_not_blank(alias) for alias in aliases)
Expand Down Expand Up @@ -224,6 +229,15 @@ def _names_unique(cls, companies: tuple[Company, ...]) -> tuple[Company, ...]:
if _fold(name) in seen:
raise ValueError("a company name or alias appears twice")
seen.add(_fold(name))
# Each also_agrees name names another row, once: a typo would only
# cost coverage, but is refused at load instead.
for company in companies:
own = {_fold(n) for n in (company.name, *company.aliases)}
also = [_fold(name) for name in company.also_agrees]
if len(set(also)) != len(also):
raise ValueError("an also_agrees name appears twice")
if any(name not in seen or name in own for name in also):
raise ValueError("an also_agrees name names no other row")
return companies


Expand Down
15 changes: 13 additions & 2 deletions src/po_agent/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,14 @@ class OneIframeBody(Frozen):


class SearchRow(Frozen):
"""One Projects search row, cells as shown."""
"""One Projects search row, cells as shown. `status`: its Status cell
("" when the column isn't shown); Summit's Agent 2 drops a Cancelled
row (decisions, 4 Dec 2026)."""

pln: str
client_ref_no: str
company: str
status: str = ""


COMPACTION_TEST = "Compaction Test" # MySys's task name (row 07)
Expand Down Expand Up @@ -154,6 +157,9 @@ class MySysLookup(Frozen):
more_pages: bool # a second results page exists
project_internal_no: str = "" # the project's Client Internal No.
address: str = "" # the project's one Address string, unparsed
# The Client block's Project Creator, read only for a rule that asks
# (ProjectRule.reads_project_creator: Summit's Agent 2, 4 Dec 2026).
project_creator: str = ""
# Every task in table order (task 9.8); `tasks` are its Compaction Test
# ones (B1's duplicate check), derived when left out.
project_tasks: tuple[ProjectTask, ...] = ()
Expand Down Expand Up @@ -239,6 +245,11 @@ class ProjectRule(Protocol):
"""A client's project match rule (ADR-003 decision 3): `mysys/` reads
the Projects search and the project, the client judges them."""

@property
def reads_project_creator(self) -> bool:
"""The project reads also fill `MySysLookup.project_creator`."""
...

def match(
self, rows: Sequence[SearchRow], more_pages: bool, internal_no: str
) -> Skip | str:
Expand All @@ -253,5 +264,5 @@ def judge(self, lookup: MySysLookup, internal_no: str) -> Skip | str:
def recheck(self, lookup: MySysLookup, proceed: Proceed) -> bool:
"""W1's reopen: the opened project still gives what the decision
took from it beyond its pln and Compaction Test tasks (Summit: a
previous-task row's task and Task Creator; B1: nothing more)."""
Project Creator row's Project Creator; B1: nothing more)."""
...
Loading
Loading