Skip to content

Count queue age until a project leaves the queue, and add four fuel types - #9

Merged
aymanazeem merged 4 commits into
mainfrom
fix/panel-age-fuels
Nov 30, 2026
Merged

aymanazeem merged 4 commits into
mainfrom
fix/panel-age-fuels

Conversation

@aymanazeem

@aymanazeem aymanazeem commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Problem

  • Queue age kept running. queue_age_days counted every project to the day the panel was built. A project that withdrew years ago kept ageing, and every age moved with the build date.
  • Four fuels were hidden. The panel put Berkeley Lab's coal, nuclear, oil and diesel projects in "other", so the agent couldn't answer a question about them.

What changes

  • Queue age ends when a project leaves the queue. It runs from the day a project applied to the day it withdrew or began operating.
    • For a project still in the queue, it runs to the date the data runs to: 31 December 2025 for the pinned workbook (lbnl_data_end in src/config.py), or the day the live queue is pulled.
    • A status the panel doesn't recognise counts to the project's withdrawal or operating date if it has one, and otherwise to the end of the data.
    • The age is blank when a date it needs is missing or out of order.
  • New date columns. The panel keeps withdrawn_date and operational_date, from Berkeley Lab's wd_date and on_date, or gridstatus's Withdrawn Date and Actual Completion Date.
  • New fuel types. fuel_type gains coal, nuclear, oil and diesel.
  • The query tool's description lists the new columns and fuels. It tells the agent to use status, not the dates, to tell whether a project withdrew or is operating. 20 panel rows have a date their status contradicts, so counting withdrawals by date gives 5,146, not 5,226.
  • A build from a named workbook (--file) says which date queue age counts to, and that LBNL_DATA_END sets another.
  • Documentation. The README gives the new fuel counts and explains queue age. docs/decisions.md records both decisions with alternatives and evidence, and docs/future_work.md drops the two items.

Results, rebuilt from the pinned workbook

The panel still has 7,666 projects with the same status counts. Other falls from 631 to 339, as 138 coal, 77 nuclear, 53 oil and 24 diesel projects get their own types.

146 projects have no queue age, up from 48:

  • 86 withdrawn projects with no withdrawal date;
  • 48 projects with no request date;
  • 7 operating projects with no operating date;
  • 5 projects whose end date comes before their request date.

The median ages fall:

  • withdrawn projects, from 3,182.5 days (about 8.7 years) to 714 days (about two years);
  • operating ones, from 5,603 days (over 15 years) to 1,150 days (about three years);
  • active and suspended ones, by 334 days, the time from the end of 2025 to the build day.

Verification

  • make test: 178 passed offline, with the current main merged in.
  • The new queue age and fuel tests fail on the previous code.
  • Ten bugs, planted one at a time, each fail a test:
    • either gridstatus column name misspelt;
    • status other counted to the data end;
    • coal, or a column, left out of the tool description;
    • the --file note dropped;
    • a project that leaves the queue the day it applied given a blank age;
    • an unrecognised status with both dates counted to its operating date;
    • wd_date misspelt in the workbook column map;
    • the --file note printed for a live-queue build.
  • The panel rebuilt from the pinned workbook matches the README's counts. I checked the medians, the January 2026 dates and the hybrid counts in docs/decisions.md against it.

Review

An independent agent reviewed the first commit. It found no bugs in the SQL or the parsing, and confirmed the counts against the workbook. The second commit fixes its findings:

  • Fixed before merge:
    • The tool description's rule for when the dates are blank was wrong.
    • Nothing tested the gridstatus column names.
  • Also fixed:
    • An unrecognised status was aged to the data end even when the project had an exit date.
    • The January 2026 withdrawal dates weren't mentioned.
    • --file with another release gave no warning.
    • The fuel-type decision had no alternatives or evidence.
    • Several wording points.

A second independent review, of the branch with main merged in, approved it with points the third commit fixes:

  • The --file note also printed for a live-queue build, where the workbook's date doesn't apply.
  • The tool description didn't say that the live queue counts to the day it is downloaded.
  • The test workbook took its column names from the code, so a misspelt name would still pass. The test now spells them out, and checks that a named workbook keeps both dates.
  • Two cases had no test: a project that leaves the queue the day it applied (age 0), and an unrecognised status with both dates (ends at the withdrawal date).
  • Clearer wording in the README, and measured medians in docs/decisions.md in place of a made-up example.

Not checked against OpenAI's live API

No OpenAI call was made. The tests check the tool description's text, but I haven't seen the real agent read it, so I haven't confirmed that it uses status rather than the dates, or that it handles the new fuel types. The paid evaluation runs once credits are available.

…ypes

queue_age_days counted every project to the day the panel was built,
so a project that withdrew years ago kept ageing, and every age moved
with the build date. The panel also put Berkeley Lab's coal, nuclear,
oil and diesel projects in "other", so the agent couldn't answer a
question about them.

- Queue age now runs from the request to the day a project withdrew
  or began operating. For a project still in the queue it runs to the
  date the data runs to: 31 December 2025 for the pinned workbook
  (lbnl_data_end in src/config.py, from its sheet 02), or the day the
  live queue is pulled. It is null when that end is unknown or before
  the request date.
- The panel keeps withdrawn_date and operational_date, from Berkeley
  Lab's wd_date and on_date, or gridstatus's Withdrawn Date and Actual
  Completion Date.
- fuel_type gains coal, nuclear, oil and diesel.
- The query tool's description, the README, docs/decisions.md and
  docs/future_work.md follow.

Rebuilt from the pinned workbook: 7,666 projects, statuses unchanged.
Other falls from 631 to 339, as 138 coal, 77 nuclear, 53 oil and 24
diesel projects get their own types. 146 projects have no queue age,
up from 48: 86 withdrawn with no withdrawal date, 48 with no request
date, 7 operating with no operating date, 5 ending before their
request. The median age of withdrawn projects falls from 8.7 years to
2.0, of operating ones from 15.3 to 3.1, and of active and suspended
ones by about 11 months.

make test passes offline, with five new tests. The new queue age and
fuel tests fail on the previous code.
…ueue's dates

The query tool's description said withdrawn_date and operational_date
are null unless a project has withdrawn or is operating. 20 panel rows
break that, so an agent counting withdrawals by date would get 5,146
instead of 5,226. It now says to use status for that, and gives the full
rule for a blank queue age.

- A project whose status the panel doesn't recognise counts to its
  withdrawal or operating date if it has one, and otherwise to the end
  of the data. No Berkeley Lab PJM project has such a status, but PJM's
  live queue can.
- A build with --file says which date queue age counts to, and that
  LBNL_DATA_END sets another.
- New tests use gridstatus's own column names for the live queue, cover
  an unrecognised status and an operating project with no operating
  date, and check that the tool description lists every column, status
  and fuel type. Six planted bugs each fail a test.
- docs/decisions.md gives the fuel-type decision its alternatives and
  evidence, and notes the 12 withdrawal dates in January 2026. The
  README explains hybrids.

Rebuilt from the pinned workbook: the README's counts are unchanged,
including the 146 projects with no queue age.
- A live-queue build given --file no longer prints the note about
  LBNL_DATA_END, which only applies to Berkeley Lab's workbook.
- The query tool's description says the live queue counts to the day
  it is downloaded.
- The test workbook spells out Berkeley Lab's column names, and a test
  checks that a named workbook keeps its withdrawal and operating dates.
- New tests: a project that leaves the queue the day it applied has an
  age of 0, and an unrecognised status with both dates ends at its
  withdrawal date.
- The README's queue age wording is clearer, and docs/decisions.md
  gives the measured medians.

178 tests pass offline.
@aymanazeem

Copy link
Copy Markdown
Owner Author

Review and test evidence

Head commit dee6347.

Review. A separate agent reviewed the first commit, and 1e5d2ab fixes its findings. A second separate review, of the branch with main merged in, approved it with points that dee6347 fixes. Those fixes had a self-review, not a third separate review.

Tests.

  • make test: 178 passed offline on Python 3.13.
  • Ten bugs, planted one at a time, each fail a test. The PR description lists them.
  • The panel rebuilt from the pinned workbook has the README's counts: 7,666 projects, the status and fuel counts, and 146 with no queue age. The medians in docs/decisions.md match it.
  • make eval as a dry run, against the rebuilt panel: 6 questions wired, 4 checks would be skipped, and no API call.

CI. Every run used GitHub's standard ubuntu-latest runners, and the timing API reports 0 billable ms for each.

Run Commit Result Billable time
46539510487 dee6347 passed on 3.11 and 3.14 0 ms
46535549907 0ed9974 passed on 3.11 and 3.14 0 ms
46523621480 1e5d2ab passed on 3.11 and 3.14 0 ms

Not checked against OpenAI's live API. No OpenAI call was made, and nothing was spent. I haven't seen the real agent read the new tool description, so I haven't confirmed that it uses status rather than the dates, or that it handles the new fuel types. The paid evaluation runs once credits are available.

@aymanazeem
aymanazeem merged commit 5a7fe11 into main Nov 30, 2026
2 checks passed
@aymanazeem
aymanazeem deleted the fix/panel-age-fuels branch November 30, 2026 23:55
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