Skip to content

PR #749 follow-up: P2 polish from B.7 /gate (5 items; Phase B is complete after this) #750

Description

@jsavin

Rationale

PR #749 (Phase B.7 — scratch-eval pane) merged at 0e25cc703 with 2 rounds of /gate (1 P0 + 2 P1s addressed). B.7 was the last Phase B milestone — Phase B is now complete.

Several P2/P3 items deferred from PR scope. Tracking as a single bucket.

P2/P3 items to address

Hygiene

  • Clear eval_last_dispatched_id after consuming a response (bar-raiser round 2 P3). Currently a stale id persists in tui_state_t.eval_last_dispatched_id until the next eval submit overwrites it. Collision risk is negligible (0x7FFF wrap on tui_req_id, next eval immediately overwrites), but worth a one-line s->eval_last_dispatched_id = 0; at the end of the Case 2 eval-response branch for hygiene.

Display polish

  • Recover original expression for history entry tags (security round 1 P2 + bar-raiser round 1 P2). B.7 displays [eval] result for every entry because the response path can't recover the dispatched expression. Stash the most-recent dispatched expression at submit time (e.g. s->eval_last_expr[256]) and use it in the rendered history line: [N] expression -> result. Improves audit trail of what the user evaluated.

  • [N] label restarting after ring wrap (bar-raiser round 1 P2). entry_num = eval_history_count + 1 means after wrap, displayed indices restart from [16] [16] [16] because count is clamped at MAX. Use a separate monotonic counter for the displayed [N].

  • strdup OOM accounting drift (bar-raiser round 1 P2). On OOM, eval_history[slot] = NULL but eval_history_count was already incremented; render path skips NULL entries so visible-count drift accumulates silently. Decrement on OOM or pre-allocate.

Test coverage

  • "Modal open, press : ignored" test (bar-raiser round 1 P2). Currently safe by construction (B.4/B.5 modals route all input through boxen_window_set_modal(true) to their own input callback), but a behavioral test would lock the contract.

Continuous improvement (operational)

  • Continuous-improvement memory: "verify both request AND response shapes when integrating a new op" (bar-raiser round 1 P2). B.5 and B.7 both shipped with response-side wire-format bugs because the sub-agent quoted the request line but not the response emit code. Memory entry would help future agents. (Not a code fix; agent prompt / memory addition.)

Context

Exit Criteria

Each item is small (<30 LOC); can be folded into Phase C work or shipped as small standalone PRs. Close as work lands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p2Medium priority - nice to havescope/easy4-8 hours, straightforward implementationworkstream/verb-portingKernel verb implementation and bindings

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions