dedicated pathword instance for gridworld#4
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5f1c32869
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!pathworldInstance || pathworldInstance.status !== "running") { | ||
| this.logger.warn(`[gridworld] request_train_path: pathworld instance ${pathworldId} not running (status=${pathworldInstance?.status ?? "not found"})`); | ||
| return; |
There was a problem hiding this comment.
Send failure path result when pathworld is unavailable
When the pathworld instance is not running, this handler returns without sending any response back to the source tile instance. In train_path_manager.request_train_path, the requesting train is switched to manual mode and is only restored in apply_train_path_result, so dropped requests during pathworld outages/restarts can leave trains permanently stuck in manual mode until a human resets them.
Useful? React with 👍 / 👎.
|
@ILLISIS I don't particularily mind having the timesync as part of gridworld, but I think it makes more sense to have it as a separate plugin in the main repo. It might as well be one of the defaults to have for any cluster. Would you like to move it or should it stay? |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 85e72fb243
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| function tpm.queue_path_request(path_request) | ||
| log("tpm:queue_path_request id=" .. tostring(path_request.id)) | ||
| storage.gridworld.train_path_requests[path_request.id] = path_request |
There was a problem hiding this comment.
Key queued path requests by source instance
Queued requests on the pathworld are stored under storage.gridworld.train_path_requests[path_request.id], but train IDs are only unique within a single instance save. If two tile instances queue unresolved requests for the same id, the later one overwrites the earlier entry (and clear messages also target only id), which can drop retries or return results for the wrong train. Use a composite key that includes sourceInstanceId to keep requests isolated per instance.
Useful? React with 👍 / 👎.
| } | ||
| -- adjust_pathworld_station_limit | ||
| local station = goals[result.goal_index].train_stop | ||
| station.trains_limit = math.max(0, (station.trains_limit or 0) - 1) |
There was a problem hiding this comment.
Preserve unlimited station limits when reserving destinations
This reservation logic converts unlimited station limits (trains_limit == nil) into 0 because of (station.trains_limit or 0) - 1. That makes unlimited destinations temporarily appear full, so subsequent path requests can incorrectly fail or be retried until the next rail sync restores limits. Only decrement finite limits and leave nil unchanged.
Useful? React with 👍 / 👎.
| this.tiles = await loadTiles(this.controller.config, this.logger); | ||
| this.rebuildTileIndex(); | ||
| this.loadMapExchangeString(); | ||
| await this.loadTimeEpoch(); | ||
| await this.syncTileInstanceConfigs(); | ||
| await this.ensureEdgesForKnownTiles(); |
There was a problem hiding this comment.
Create pathworld during initialization when missing
Initialization loads existing tiles and configures edges but never ensures a pathworld instance exists; pathworld creation currently only happens inside resetGridworld(true). After upgrading an existing deployment that already has tiles but no pathworld, rail sync and train-path forwarding handlers will keep returning early (no pathworld instance found), so cross-instance routing is silently disabled until a manual reset is performed.
Useful? React with 👍 / 👎.
No description provided.