Session log 2026-04-30: PS5→PS7 hardening, expected-value contracts, and the agentic-workflow vision #175
Labels
No labels
4-29
bug
documentation
duplicate
enhancement
flow improvement
good first issue
help wanted
invalid
investigating
issue-agent
issue-agent-blocked
issue-agent-complete
issue-agent-pr-open
issue-agent-runner-nelsonlaptop
issue-agent-runner-nelsonpc
issue-agent-runner-nelsonpc-user
issue-agent-running
needs-verification
next to do
question
queue
recon
relics-stats-onboarding
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
romaine-life/spirelens#175
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Documentation of a long, productive session. Filed and closed immediately as the canonical "what happened" record. The work split into three arcs: hardening the existing issue-agent against PS5→PS7 + StrictMode failure modes, raising the verification contract from "evidence existed" to "evidence matched expected", and capturing a meta-architecture rewrite vision for glimmung as the canonical agentic-workflow surface.
Arc 1 — Recovery and PS5→PS7 hardening
Started by recovering a dead claude.ai session transcript via authenticated API + a minted GitHub App installation token (no real credential exposure required; demonstrated end-to-end). The transcript pointed at an in-flight 6-item PowerShell hardening plan against the issue-agent scripts. We finished it.
Code landed:
.PSObject.Propertiesbug class +Set-StrictMode -Version 2.0+ flip$ErrorActionPreferencetoStopinsummarize-issue-agent.ps1. Closed the latent class of bugs where iterating$x.PSObject.Propertiesover[ordered]@{}/[hashtable]returns reflection properties in PS7 instead of dict entries.@(...)so.Countis safe under StrictMode when the filter rejects all elements.Get-ExitCodeText(its caller landed in #139 but the function definition was never committed; ErrorActionPreference=Continue swallowed the missing-function error for 3 days; the StrictMode flip exposed it). Made the workflow's terminal pass-gate surfacescenario_setup:abort reasons when verification was skipped, instead of an emptyverification_reason.return ,@(...)inConvertTo-Arrayto preserve array shape against PS function-return-unwrap; reverted because it broke the pipe form (ConvertTo-Array $x | Where-Object {...}delivered the whole inner array as a single$_). The current solution: plainreturn @(...)plus@(...)wrap at assignment-then-.Countcall sites.Arc 2 — Encounter-default fix and bridge rename completion
Diagnosed and fixed the
FUZZY_WURM_CRAWLER_WEAKencounter that the MCP server published as a system default but the live STS2 catalog no longer recognized.BuildValidationCapabilities; replace with guidance text directing callers to uselist_encounters. Also fix the bundled-save fallback path so_known_save_encounter_idsreturns real ids on a fresh runner.next_normal_encounteras optional (default null); only specify when the relic/card behavior under test depends on which encounter is fought.SpireLensMcp → SpireLensMcpBridge, log strings updated.out/SpireLensMcpBridge/SpireLensMcpBridge.dllso the consumer-side basename matches the manifest id.scenario_id_validationprompt tightening; StrictMode 2.0→3.0 ratchet (verified empirically — V3 only adds out-of-bounds array indexing on PS 7.4, which we confirmed all existing patterns pass); Pester tests for the JSONL parsers (43 tests, AST-extracts function definitions from production scripts so they stay in lockstep);.github/workflows/ps-quality.ymlrunning PSScriptAnalyzer (Error severity gate) + Pester on PRs touching.github/scripts/**.Arc 3 — Expected-value contracts on screenshot evidence
The verification contract was previously: "screenshot exists, target_visible, text_visible, observed_text non-empty." That accepted the agent's misread of
vigor gained: 88asvigor gained: 8because the contract didn't compare observed against an expected literal.## Test Processsection inissue-agent-verification.mdfor every step of the validation plan (what was done, what it was supposed to prove with expected values, what was actually observed). Required even on pass — its purpose is to support reviewer comparison after a PR exists.required_evidenceitems withtext_visible_required:truemust declare a literalexpected_textfield. Test-plan prompt forbids loose phrasings ("non-zero", "≥ N", "at minimum N") and requires the value to be derived fromscenario_setup × validation_plan(one-combat-start of Akabeko ⇒vigor gained: 8). Wrapper comparesobserved_textagainstexpected_textwith a word-boundary-aware regex (sovigor gained: 8does NOT matchvigor gained: 88as a prefix substring) and aborts withclaimed_result_not_observedon mismatch. Verification prompt requires copying literal screenshot characters intoobserved_text, not paraphrased; abort withtarget_evidence_missingif illegible. 9 new Pester tests cover the digit-prefix failure mode + start/end/middle anchoring.ConvertTo-Arraycomma-operator regression that PR #168 introduced (broke pipe forms). 53/53 Pester now passing.Arc 4 — End-to-end validation against issue #142
Re-triggered the issue-agent on issue #142 (Akabeko relic stats) at every milestone; the run history is itself a story.
35d3cda.Countpost-test_plan.Countpatterns needed@()wrap82882f7verification_reason=(empty)materialize_onlydied on FUZZY_WURM4cb3d25.Countpost-verificationvigor gained: 80per agent's own claim, actually 88 in the screenshot); next surface area for.Countexposed292a33a292a33ad58bcb2vigor gained: 88(silently accepted because contract was loose)e00f5ffclaimed_result_not_observedexpected_textcontract caught the silent misread; agent honestly wroteobserved_text="vigor gained: 88", wrapper abortede00f5ffclaimed_result_not_observedNet: PR #170 has a real implementation bug (Akabeko postfix fires more than once per combat → 88 instead of 8). The new contract correctly aborts on it. The bug itself is unfixed pending a follow-up.
Architecture and design captures
Filed for future work, not implemented in this session:
/agent revise <feedback>slash-command on PRs. ~2 days MVP / ~8 days full feature. Includes triage phase, delta-mode planning, per-PR serialization, budget caps, threaded reactions.retryable: truefield already partitions failures correctly; what's missing is the loop control + prior-attempt-aware prompts.The thread connecting #173, #174, and glimmung#17: every loop-control feature we want (self-correction, comment-revise, cost ceilings, per-issue state) is fighting yaml inside GitHub Actions and natural in a real orchestrator. Long-term, the orchestration logic moves to glimmung.
Diagnostic issues closed
Operational artifacts produced
Helpers.psm1,Phases.Tests.ps1,Summarize.Tests.ps1,EvidenceGuard.Tests.ps1. All pass on pwsh 7.4..github/workflows/ps-quality.ymlrunning PSScriptAnalyzer (Error gate) + Pester on PRs touching scripts.Set-StrictMode -Version 2.0 vs 3.0differences on PS 7.4 (V3 only adds OOB array indexing — captured in commit message + StrictMode comment).return ,$xvsreturn @($x)semantics through assign vs pipe. Captured inConvertTo-Arraycomments + test fixtures so the next person doesn't repeat the regression.Unfinished work
RecordAkabekoVigorGainedis invoked multiple times per combat-start because the Harmony patch is hookingAkabeko.BeforeSideTurnStartand the original method is called more than once during combat-init sequencing (or via base-class inheritance — exact root cause needs game-source inspection). Suggested fix:agg.VigorGained = Math.Max(agg.VigorGained, amount)instead of+=, making the per-combat aggregate idempotent under N postfix fires. Not landed.spire-lens-mcpC# namespace cleanup (SpireLens.Mcpnamespace name still references the old fork identity). Documented as out-of-scope on glimmung#15.Closing this issue
This is a session log, not a tracking issue — closing immediately. The unfinished work above lives in its own follow-up issues; this is just the historical record.